- Joined
- Apr 23, 2011
- Messages
- 527
I am making a triggered line of sight system for front-only vision by using lines of dummy units in a cone (is this the best way to go about it? it stutters when going up to 24 players)
What is the issue with how I have coded this? I am testing this on a blank map (attached below).
edit: I think I forgot to remove an unintended action in the testmap (Kill last created unit).
-
losinit
-

Events
-


Time - Elapsed game time is 0.03 seconds
-
-

Conditions
-

Actions
-


For each (Integer loop) from 1 to 2, do (Actions)
-



Loop - Actions
-




Set playerunits = (Units owned by (Player(loop)) of type Peasant)
-




Unit Group - Pick every unit in playerunits and do (Actions)
-





Loop - Actions
-






Set unit[loop] = (Picked unit)
-






Set p[0] = (Position of unit[loop])
-






Set facing = ((Facing of unit[loop]) - 150.00)
-






For each (Integer loop2) from 1 to 7, do (Actions)
-







Loop - Actions
-








For each (Integer loop3) from 1 to 10, do (Actions)
-









Loop - Actions
-










Set p[1] = (p[0] offset by (100.00 x (Real(loop3))) towards facing degrees)
-










Unit - Create 1 Sight for (Player(loop)) at p[1] facing Default building facing degrees
-










Set sight[sightindex[loop]] = (Last created unit)
-










Set sightindex[loop] = (sightindex[loop] + 1)
-










Custom script: call RemoveLocation(udg_p[1])
-
-
-








Set facing = (facing + 30.00)
-
-
-






Custom script: call RemoveLocation(udg_p[0])
-
-
-




Custom script: call DestroyGroup(udg_playerunits)
-
-
-
-
-
losloop
-

Events
-


Time - Every 0.50 seconds of game time
-
-

Conditions
-

Actions
-


For each (Integer loop) from 1 to 2, do (Actions)
-



Loop - Actions
-




Set p[0] = (Position of unit[loop])
-




Set facing = ((Facing of unit[loop]) - 150.00)
-




Set sightindex[loop] = 0
-




For each (Integer loop2) from 1 to 7, do (Actions)
-





Loop - Actions
-






For each (Integer loop3) from 1 to 10, do (Actions)
-







Loop - Actions
-








Set p[1] = (p[0] offset by (100.00 x (Real(loop3))) towards facing degrees)
-








Unit - Move sight[sightindex[loop]] instantly to p[1]
-








Set sightindex[loop] = (sightindex[loop] + 1)
-








Custom script: call RemoveLocation(udg_p[1])
-
-
-






Set facing = (facing + 30.00)
-
-
-




Custom script: call RemoveLocation(udg_p[0])
-
-
-
-
What is the issue with how I have coded this? I am testing this on a blank map (attached below).
edit: I think I forgot to remove an unintended action in the testmap (Kill last created unit).
Attachments
Last edited:




