• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger Event issue...

Status
Not open for further replies.
Level 5
Joined
Jun 18, 2011
Messages
79
Event
Player - Player 1 (Red)'s Current gold becomes Less than or equal to ((Real((Player 1 (Red) Current gold))) - 1000.00)

Ok here is an event I am working on, and I am probably missing something so stupid.... I am not very good at math, and then trying to apply it to this default editor system... ugh... Anyhow, I need a trigger event that reads; whenever a player spends an amount of gold greater then 1000, or whenever a players gold changes totalling a number greater or less then 1000 of what it use to be then actions fire. Although that one above isn't responding for some reason. I could probably find another way to achieve what I am looking for, I usually do. But it would be great if anyone can help speed this one up for me =)
 
Level 4
Joined
Jun 23, 2011
Messages
70
You could run it as a difference function, setting "Gold1" equal to the amount of gold of the target player every maybe 5-10 seconds.

Sort of like, repeating timer event of 7 seconds:

Set Gold2 = Gold1
Set Gold1 = gold of target player
Set GoldCheck = Gold2-Gold1
If GoldCheck > 1000, then run (Trigger) ignoring conditions.
If Goldcheck < 1000, then do nothing.
 
You use a real for your event : "Real((Player 1 (Red) Current gold))". Let say the players have 0 gold when the map starts, the event will be registered using the current player's gold.
So you'll end up with an event like this :
"Player - Player 1 (Red)'s Current gold becomes Less than or equal to (0.00 - 1000.00)"
That won't happen so frequently.

As they said above, you can use a variable and update it periodically. But I think you can also use the event "A unit sell an item" if gold isn't spent yet when the trigger fires...
If no one make an example for it, I'll do tomorrow. It won't work for all kind of gold loss, though.

EDIT : Gold is already spent when "A unit sell an item" is triggered... Someone may use "A unit is issued an order" and check if it is an unit/item order but that's a pain and a bit buggy.
So nevermind.
 
Last edited:
Level 4
Joined
Jun 23, 2011
Messages
70
Here's your example. The frequency of gold check can be edited depending on how frequently players are spending large amounts of money (for example, if player is spending hundreds constantly, you'll need to increase the frequency to avoid a case of 400 + 500 + 300 > 1000).

  • Your New Trigger
    • Events
      • Time - Every 7.00 seconds of game time
    • Conditions
    • Actions
      • Set Gold2 = Gold1
      • Set Gold1 = (Player 1 (Red) Current gold)
      • Set GoldCheck = (Gold2 - Gold1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GoldCheck Greater than or equal to 1000
        • Then - Actions
          • Trigger - Run Your Intended Actions <gen> (ignoring conditions)
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top