Weyrling
New Member
- Reaction score
- 25
I'm creating a stealth type system, which will check a 'Detection' value, and a 'Stealth' value for every unit on the map, I'm creating this so that I can increase sight range significantly, but still retain the element of surprise. I also think it's better than the Boolean Invisible/Detected system currently in place.
Every unit with a stealth value will have permanent invisibility.
Here's the detection trigger:
Here's the 'Un'Detection trigger:
I can't test it right now, so I'd appreciate if somebody could look it over and tell me:
1) Will it work properly?
2) Would it lag horribly?
2a) How can I optimize it if so?
Every unit with a stealth value will have permanent invisibility.
Here's the detection trigger:
Code:
Stealth Detect
Events
Time - Every 0.60 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Set Integer = (Integer A)
Set TempPoint = (Position of PlayerHeros[Integer])
Set TempGroup[0] = (Units within PlayerStealthDetect[Integer] of TempPoint matching (((Matching unit) belongs to an enemy of (Player(Integer))) Equal to True))
Unit Group - Pick every unit in TempGroup[0] and do (Actions)
Loop - Actions
Set TempPoint2 = (Position of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A Hero) Equal to True
((Random real number between 5.00 and 200.00) + (PlayerStealthDetect[Integer] - ((Distance between TempPoint and TempPoint2) / 3.00))) Greater than or equal to PlayerStealth[(Player number of (Owner of (Picked unit)))]
(TempPoint2 is visible to (Player(Integer))) Equal to True
Then - Actions
Unit - Grant shared vision of (Picked unit) to (Player(Integer))
Unit Group - Add (Picked unit) to PlayerDetectedGroup[Integer]
Else - Actions
Custom script: set udg_TempPoint2 = null
Custom script: set udg_TempPoint = null
Custom script: set udg_TempGroup[0] = null
Set TempGroup[1] = (Units of type Footman)
Unit Group - Pick every unit in TempGroup[1] and do (Actions)
Loop - Actions
Set TempUnit[0] = (Picked unit)
Set TempPoint = (Position of (Picked unit))
Set TempGroup[2] = (Units within 500.00 of TempPoint matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True)))
Unit Group - Pick every unit in TempGroup[2] and do (Actions)
Loop - Actions
Set TempPoint2 = (Position of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(750.00 - ((Distance between TempPoint and TempPoint2) / 3.00)) Greater than or equal to PlayerStealth[(Player number of (Owner of (Picked unit)))]
Then - Actions
Unit - Grant shared vision of (Picked unit) to (Owner of TempUnit[0])
Else - Actions
Custom script: set udg_TempPoint2 = null
Custom script: set udg_TempGroup[2] = null
Custom script: set udg_TempPoint = null
Custom script: set udg_TempGroup[1] = null
Here's the 'Un'Detection trigger:
Code:
Stealth UnDetect
Events
Time - Every 0.60 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Unit Group - Pick every unit in PlayerDetectedGroup[Integer] and do (Actions)
Loop - Actions
Set Integer = (Integer A)
Set TempPoint = (Position of PlayerHeros[Integer])
Set TempPoint2 = (Position of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Distance between TempPoint and TempPoint2) Greater than or equal to PlayerStealthDetect[Integer]
(TempPoint2 is visible to (Player(Integer))) Equal to False
Then - Actions
Unit - Deny shared vision of (Picked unit) to (Player(Integer))
Unit Group - Remove (Picked unit) from PlayerDetectedGroup[Integer]
Else - Actions
Custom script: set udg_TempPoint2 = null
Custom script: set udg_TempPoint = null
I can't test it right now, so I'd appreciate if somebody could look it over and tell me:
1) Will it work properly?
2) Would it lag horribly?
2a) How can I optimize it if so?