How to make mana Degen every 5sec (out of combat)

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Well, a blunt way would be checking every 5 seconds for the current order of an unit. If it's "attack", don't do anything, if it's "hold ground" or "stop", set the units mana to units mana - 5.
 

J3LADE

New Member
Reaction score
7
o_O im kinda stuck now... what happens if theres more than 1 of this unit?

I have made my first trigger to add mana to the unit every time it attacks. Also it sets the variable "Warrior [Player Number of (Attacking Unit)]" to (Attacking Unit)

Then my next trigger is like this so far:

Event:
Every 5sec of game
Conditions:
Actions:
If Then Else:
Conditions:
Or any Conditions are true: Current order of the variable "Warrior [???]" equal to stop
Current order of the variable "Warrior [???]" equal to Hold Ground
Current order of the variable "Warrior [???]" equal to Move
Current order of the variable "Warrior [???]" equal to Patrol

Replace ??? with something that works plz or change the triggering alltogether if you want. Try to make it generic if you can so i don't have to write a trigger for every player. o_O
 

Tinki3

Special Member
Reaction score
418
For Each (Integer A) from 1 to 12 do Loop - Actions
--Loop - Actions
----If Then Else:
------Conditions:
--------Or any Conditions are true:
----------Current order of the variable "Warrior [(Integer A)]" equal to stop
----------Current order of the variable "Warrior [(Integer A)]" equal to Hold Ground
----------Current order of the variable "Warrior [(Integer A)]" equal to Move
----------Current order of the variable "Warrior [(Integer A)]" equal to Patrol

Use "Integer A" to refer to every warrior from 1 - X
 

J3LADE

New Member
Reaction score
7
Yea ive never thought of that Integer 1 to X because i don't really know what it refers to. Like how do you know it's not 1 - 12 items or attacks? o_O So could you give me some enlightenment on this?

Thanks Tinki3
 

Tinki3

Special Member
Reaction score
418
> could you give me some enlightenment on this?

Code:
Example
    Events
        Time - Every 5.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to <Number of Warriors>, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Or - Any (Conditions) are true
                            Conditions
                                (Current order of Warrior[(Integer A)]) Equal to (Order(stop))
                                 ...
                    Then - Actions
                        Unit - Set mana of Warrior[(Integer A)] to ((Mana of Warrior[(Integer A)]) - 10.00)
                    Else - Actions
The "Loop - Actions" will loop through every "Warrior" unit that has a current order of "stop", every 5 seconds.

And, if the current Warrior that is being looped in the loop matches the conditions, it will have it's mana deducted by 10.

"(Integer A)", in this case, refers to each Warrior array index. It works sort of the same way as "Picked Unit".
 

Tinki3

Special Member
Reaction score
418
You'll know if its Picked the units or not after they've had their mana deducted :p

They obviously can't have their mana deducted unless they match the conditions, however.

(Notice that I said "They" - "(Integer A)" basically means the same thing, in this case)
 

J3LADE

New Member
Reaction score
7
If 1 of the warriors matches the conditions will it deduct the mana of the others if there are others?

And also the warriors are trained from a tavern, does this effect Integer A in any way? Because does Integer A refer only to whats there at the time or can it be modified like say someone comes in late game and chooses a warrior then when theres already been a warrior from the start of the game, does Integer A include the guy who was trained later in the game?
 

Tinki3

Special Member
Reaction score
418
If 1 of the warriors matches the conditions will it deduct the mana of the others if there are others?
Well, if the other Warrior's current orders were nothing equal to what was filtered in your conditions, then, no.
And also the warriors are trained from a tavern, does this effect Integer A in any way?
Not if Integer A loops up to 8191 times (8191 is the maximum array value a variable can cope with).

You'll need to make sure that each Warrior has its own specific array value, however.
does Integer A refer only to whats there at the time
Yes - It'll only loop through Warrior variables that actually have a value.
can it be modified like say someone comes in late game and chooses a warrior
Yes, it can.
does Integer A include the guy who was trained later in the game?
No, it doesn't.
 

J3LADE

New Member
Reaction score
7
Quote:
can it be modified like say someone comes in late game and chooses a warrior

Yes, it can.

Quote:
does Integer A include the guy who was trained later in the game?

No, it doesn't.

----------------------------------------------

Those are both the same questions really and they got different answers?!?!?!

My heroes are from a tavern (all of them) so they are not actually in the game at "Map Initialization" so will that effect it? (That's basicly what i'm saying)
 

Tinki3

Special Member
Reaction score
418
My heroes are from a tavern (all of them) so they are not actually in the game at "Map Initialization" so will that effect it? (That's basicly what i'm saying)
That will affect it, yes.

Here's a solution:
Code:
Example
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Index Greater than # of players
            Then - Actions
                Trigger - Turn off (This trigger)
            Else - Actions
                Set Index = (Index + 1)
                Set Warrior[Index] = (Triggering unit)
Remove the condition function to 'unrestrict' the amount of valued Warriors.
 

J3LADE

New Member
Reaction score
7
For some reason: (Current order of Warrior[(Integer A)]) Equal to (Order(move)) is not responding to decrease the warriors mana when "stop" and "hold ground" are working. (I haven't tried patrol yet)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top