• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] How to count spent gold?

Status
Not open for further replies.
I want to count spent gold in the multiboard. I tried with this trigger, but it's not working. Do you have any idea how to do it?

  • gold in multiboards
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Sold Item)) Equal to RING_AGI[1]
              • (Item-type of (Sold Item)) Equal to RING_ATTACK[1]
              • (Item-type of (Sold Item)) Equal to RING_ATTACK[1]
              • (Item-type of (Sold Item)) Equal to RING_HASTE[1]
              • (Item-type of (Sold Item)) Equal to RING_INT[1]
              • (Item-type of (Sold Item)) Equal to RING_MANA_RG[1]
              • (Item-type of (Sold Item)) Equal to RING_MOB[1]
              • (Item-type of (Sold Item)) Equal to RING_PROT[1]
              • (Item-type of (Sold Item)) Equal to RING_REGEN[1]
              • (Item-type of (Sold Item)) Equal to RING_STAMINA[1]
              • (Item-type of (Sold Item)) Equal to RING_STR[(Integer A)]
              • (Item-type of (Sold Item)) Equal to RING_WISDOM[(Integer A)]
              • (Item-type of (Sold Item)) Equal to Upgrade
        • Then - Actions
          • Set ML_Gold_Spent[(Player number of (Owner of (Buying unit)))] = (ML_Gold_Spent[(Player number of (Owner of (Buying unit)))] + 200)
        • Else - Actions
      • Multiboard - Set the text for Multiboard item in column 5, row (Player number of (Owner of (Buying unit))) to (String(ML_Gold_Spent[(Player number of (Owner of (Buying unit)))]))
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I would suggest you to use a slightly more advanced option and simply take the difference between the current gold and total gathered gold of the player.
Take a look at this:
  • Show Gold GUI
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set TempPlayer[0] = Player 1 (Red)
      • Set TempForce[0] = (Player group(TempPlayer[0]))
      • Set TempInteger[0] = ((TempPlayer[0] Total gold gathered) - ((TempPlayer[0] Current gold) - 500))
      • Cinematic - Clear the screen of text messages for TempForce[0]
      • Game - Display to TempForce[0] the text: (Spend gold = + (String(TempInteger[0])))
      • Custom script: call DestroyForce(udg_TempForce[0])
 

Ardenian

A

Ardenian

^I wanted to post that first, too, but it will add all gold spend to the display, not only the one spent for items
 

Ardenian

A

Ardenian

Hm...

But his trigger obviously refers to only items, I think it depends on interpretation
 
Level 13
Joined
Jun 20, 2014
Messages
479
for the init trigger make an array for item types and another one for item price. for the sold event loop through all the items youve stored then update you multiboard it will make your life easy and just add the items that you want to keep the price on.
 

sentrywiz

S

sentrywiz

Make an PlayerSpendsGold[Array] as INT.

Then fill it with pre-added values during events like "Finishes training a Unit / Upgrade" and "Acquires an Item".

Its a lot of triggers, but you can make it.
 
Status
Not open for further replies.
Top