If i put a global variable inside a local function, will it still be global?
I almost never use custom script locals, but I have to since the attacking unit is being dispersed quickly.
If someone confirms this works I'm happy. I cannot test the assist system before release, so I need someone who knows how locals works to take a look at this trigger.
The purpose of the trigger:
The assistance counters is supposed to work in that way the assistance should count until 4 seconds after the last attack. The counter is a global variable, while the attacking player is decleared local.
I almost never use custom script locals, but I have to since the attacking unit is being dispersed quickly.
If someone confirms this works I'm happy. I cannot test the assist system before release, so I need someone who knows how locals works to take a look at this trigger.
-
Assistance Normal Attack
-
Events
- Unit - A unit Is attacked
-
Conditions
- ((Triggering unit) is A Hero) Equal to True
- (Owner of (Attacking unit)) Not equal to Neutral Hostile
- ((Triggering unit) belongs to an ally of (Owner of (Attacking unit))) Equal to False
-
Actions
- Set blahblah blah LOTS of non important triggers -then...
- Custom script: local player udg_AssAtt
- Custom script: local player udg_AssDef
- Set AssAtt = (Owner of (Attacking unit))
- Set AssDef = (Owner of (Triggering unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Owner of (Attacking unit)) is in AssistPlayerGroup[(Player number of (Owner of (Triggering unit)))]) Equal to False
-
Then - Actions
- Player Group - Add AssAtt to AssistPlayerGroup[(Player number of AssDef)]
- Else - Actions
-
If - Conditions
- Set AssistCounter[(Player number of AssAtt)] = (AssistCounter[(Player number of AssAtt)] + 1)
- Wait 4.00 seconds
- Set AssistCounter[(Player number of AssAtt)] = (AssistCounter[(Player number of AssAtt)] - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- AssistCounter[(Player number of AssAtt)] Less than 1
-
Then - Actions
- Set AssistCounter[(Player number of AssAtt)] = 0
- Player Group - Remove AssAtt from AssistPlayerGroup[(Player number of AssDef)]
- Else - Actions
-
If - Conditions
- Custom script: set udg_AssDef = null
- Custom script: set udg_AssAtt = null
-
Events
The purpose of the trigger:
The assistance counters is supposed to work in that way the assistance should count until 4 seconds after the last attack. The counter is a global variable, while the attacking player is decleared local.