- Joined
- May 20, 2009
- Messages
- 822
So, I'm restarting my movement system from scratch that I was working on a while ago. Somewhere along the line, the indexing gets fucked up though. If more than one unit is moving, they'll get locked up or get added speed from other units.
Map attached to post.
EDIT: It was a very, very simple mistake. If I have any other issues, I'll post it in this same thread.
Triggers:
Map attached to post.
EDIT: It was a very, very simple mistake. If I have any other issues, I'll post it in this same thread.
Triggers:
-
IndexMovers
-
Events
-
Unit - A unit Is issued an order targeting a point
-
Unit - A unit Is issued an order targeting an object
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Issued order) Equal to (Order(smart))
-
(Issued order) Equal to (Order(move))
-
-
-
-
Then - Actions
-
For each (Integer MS_Index[2]) from 1 to MS_MaxIndex, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Triggering unit) Equal to MS_Unit[MS_Index[2]]
-
-
Then - Actions
-
-------- DEINDEX ORDER --------
-
Custom script: call RemoveLocation(udg_MS_OrderPoint[udg_MS_Index[1]])
-
Set MS_OrderPoint[MS_Index[1]] = MS_OrderPoint[MS_MaxIndex]
-
-------- DEINDEX UNIT --------
-
Set MS_Unit[MS_Index[1]] = MS_Unit[MS_MaxIndex]
-
Set MS_Unit[MS_MaxIndex] = No unit
-
Custom script: call RemoveLocation(udg_MS_MoverPoint[udg_MS_Index[1]])
-
Set MS_MoverPoint[MS_Index[1]] = MS_MoverPoint[MS_MaxIndex]
-
Set MS_XOfMover[MS_Index[1]] = MS_XOfMover[MS_MaxIndex]
-
Set MS_XOfMover[MS_MaxIndex] = 0.00
-
Set MS_YOfMover[MS_Index[1]] = MS_YOfMover[MS_MaxIndex]
-
Set MS_YOfMover[MS_MaxIndex] = 0.00
-
-------- DEINDEX POLAR --------
-
Set MS_Angle[MS_Index[1]] = MS_Angle[MS_MaxIndex]
-
Set MS_Angle[MS_MaxIndex] = 0.00
-
Set MS_Distance[MS_Index[1]] = MS_Distance[MS_MaxIndex]
-
Set MS_Distance[MS_MaxIndex] = 0.00
-
Set MS_CalcDist[MS_Index[1]] = MS_CalcDist[MS_MaxIndex]
-
Set MS_CalcDist[MS_MaxIndex] = 0.00
-
Set MS_MoveDist[MS_Index[1]] = MS_MoveDist[MS_MaxIndex]
-
Set MS_MoveDist[MS_MaxIndex] = 0.00
-
Set MS_FinalMov[MS_Index[1]] = MS_FinalMov[MS_MaxIndex]
-
Set MS_FinalMov[MS_MaxIndex] = 0.00
-
Custom script: call RemoveLocation(udg_MS_Polar[udg_MS_Index[1]])
-
Set MS_Polar[MS_Index[1]] = MS_Polar[MS_MaxIndex]
-
-------- DEINDEX X/Y --------
-
Set MS_MoveX[MS_Index[1]] = MS_MoveX[MS_MaxIndex]
-
Set MS_MoveX[MS_MaxIndex] = 0.00
-
Set MS_MoveY[MS_Index[1]] = MS_MoveY[MS_MaxIndex]
-
Set MS_MoveY[MS_MaxIndex] = 0.00
-
-------- DESTROY INDEX --------
-
Set MS_MaxIndex = (MS_MaxIndex - 1)
-
-
Else - Actions
-
-
-
-
Game - Display to (All players) the text: FIRED!
-
Set MS_MaxIndex = (MS_MaxIndex + 1)
-
Set MS_Order[MS_MaxIndex] = (Issued order)
-
Set MS_Target[MS_MaxIndex] = (Target unit of issued order)
-
Set MS_OrderPoint[MS_MaxIndex] = (Target point of issued order)
-
Set MS_XOfOrder[MS_MaxIndex] = (X of MS_OrderPoint[MS_MaxIndex])
-
Set MS_YOfOrder[MS_MaxIndex] = (Y of MS_OrderPoint[MS_MaxIndex])
-
Set MS_Unit[MS_MaxIndex] = (Ordered unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MS_Target[MS_MaxIndex] Equal to No unit
-
-
Then - Actions
-
Set MS_UnitOrPoint[MS_MaxIndex] = point
-
-
Else - Actions
-
Set MS_UnitOrPoint[MS_MaxIndex] = unit
-
-
-
-
Else - Actions
-
-
-
-
MoveIndexedUnits
-
Events
-
Time - Every 0.02 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer MS_Index[1]) from 1 to MS_MaxIndex, do (Actions)
-
Loop - Actions
-
For each (Integer MS_Index[2]) from 1 to MU_MaxIndex, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of MS_Unit[MS_Index[1]]) Equal to MU_Unit[MS_Index[2]]
-
-
Then - Actions
-
Set MS_IndexedSpeed[MS_Index[1]] = MU_Speed[MS_Index[2]]
-
-
Else - Actions
-
-
-
-
-------- UNIT POINT STUFF --------
-
Set MS_MoverPoint[MS_Index[1]] = (Position of MS_Unit[MS_Index[1]])
-
Set MS_XOfMover[MS_Index[1]] = (X of MS_MoverPoint[MS_Index[1]])
-
Set MS_YOfMover[MS_Index[1]] = (Y of MS_MoverPoint[MS_Index[1]])
-
-------- POLAR STUFF --------
-
Set MS_Angle[MS_Index[1]] = (Angle from MS_MoverPoint[MS_Index[1]] to MS_OrderPoint[MS_Index[1]])
-
Set MS_Distance[MS_Index[1]] = (Distance between MS_MoverPoint[MS_Index[1]] and MS_OrderPoint[MS_Index[1]])
-
Set MS_CalcDist[MS_Index[1]] = (MS_Distance[MS_Index[1]] - (MS_Distance[MS_Index[1]] x 2.00))
-
Set MS_MoveDist[MS_Index[1]] = ((MS_IndexedSpeed[MS_Index[1]] x 64.00) / 50.00)
-
Set MS_FinalMov[MS_Index[1]] = (MS_MoveDist[MS_Index[1]] + MS_CalcDist[MS_Index[1]])
-
Set MS_Polar[MS_Index[1]] = (MS_OrderPoint[MS_Index[1]] offset by MS_FinalMov[MS_Index[1]] towards MS_Angle[MS_Index[1]] degrees)
-
-------- SETTING X/Y --------
-
Set MS_MoveX[MS_Index[1]] = (X of MS_Polar[MS_Index[1]])
-
Set MS_MoveY[MS_Index[1]] = (Y of MS_Polar[MS_Index[1]])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MS_MoveDist[MS_Index[1]] Greater than or equal to MS_Distance[MS_Index[1]]
-
-
Then - Actions
-
Custom script: call SetUnitX( udg_MS_Unit[udg_MS_Index[1]], udg_MS_XOfOrder[udg_MS_Index[1]])
-
Custom script: call SetUnitY( udg_MS_Unit[udg_MS_Index[1]], udg_MS_YOfOrder[udg_MS_Index[1]])
-
-
Else - Actions
-
Custom script: call SetUnitX( udg_MS_Unit[udg_MS_Index[1]], udg_MS_MoveX[udg_MS_Index[1]])
-
Custom script: call SetUnitY( udg_MS_Unit[udg_MS_Index[1]], udg_MS_MoveY[udg_MS_Index[1]])
-
-
-
Custom script: call RemoveLocation(udg_MS_MoverPoint[udg_MS_Index[1]])
-
Custom script: call RemoveLocation(udg_MS_Polar[udg_MS_Index[1]])
-
-------- DEINDEX --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MS_XOfMover[MS_Index[1]] Equal to MS_XOfOrder[MS_Index[1]]
-
MS_YOfMover[MS_Index[1]] Equal to MS_YOfOrder[MS_Index[1]]
-
-
Then - Actions
-
-------- DEINDEX ORDER --------
-
Custom script: call RemoveLocation(udg_MS_OrderPoint[udg_MS_Index[1]])
-
Set MS_OrderPoint[MS_Index[1]] = MS_OrderPoint[MS_MaxIndex]
-
-------- DEINDEX UNIT --------
-
Set MS_Unit[MS_Index[1]] = MS_Unit[MS_MaxIndex]
-
Set MS_Unit[MS_MaxIndex] = No unit
-
Custom script: call RemoveLocation(udg_MS_MoverPoint[udg_MS_Index[1]])
-
Set MS_MoverPoint[MS_Index[1]] = MS_MoverPoint[MS_MaxIndex]
-
Set MS_XOfMover[MS_Index[1]] = MS_XOfMover[MS_MaxIndex]
-
Set MS_XOfMover[MS_MaxIndex] = 0.00
-
Set MS_YOfMover[MS_Index[1]] = MS_YOfMover[MS_MaxIndex]
-
Set MS_YOfMover[MS_MaxIndex] = 0.00
-
-------- DEINDEX POLAR --------
-
Set MS_Angle[MS_Index[1]] = MS_Angle[MS_MaxIndex]
-
Set MS_Angle[MS_MaxIndex] = 0.00
-
Set MS_Distance[MS_Index[1]] = MS_Distance[MS_MaxIndex]
-
Set MS_Distance[MS_MaxIndex] = 0.00
-
Set MS_CalcDist[MS_Index[1]] = MS_CalcDist[MS_MaxIndex]
-
Set MS_CalcDist[MS_MaxIndex] = 0.00
-
Set MS_MoveDist[MS_Index[1]] = MS_MoveDist[MS_MaxIndex]
-
Set MS_MoveDist[MS_MaxIndex] = 0.00
-
Set MS_FinalMov[MS_Index[1]] = MS_FinalMov[MS_MaxIndex]
-
Set MS_FinalMov[MS_MaxIndex] = 0.00
-
Custom script: call RemoveLocation(udg_MS_Polar[udg_MS_Index[1]])
-
Set MS_Polar[MS_Index[1]] = MS_Polar[MS_MaxIndex]
-
-------- DEINDEX X/Y --------
-
Set MS_MoveX[MS_Index[1]] = MS_MoveX[MS_MaxIndex]
-
Set MS_MoveX[MS_MaxIndex] = 0.00
-
Set MS_MoveY[MS_Index[1]] = MS_MoveY[MS_MaxIndex]
-
Set MS_MoveY[MS_MaxIndex] = 0.00
-
-------- DESTROY INDEX --------
-
Set MS_MaxIndex = (MS_MaxIndex - 1)
-
-
Else - Actions
-
-
-
-
-
-
Vanilla Unit Stats
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set MU_MaxIndex = (MU_MaxIndex + 1)
-
Set MU_Unit[MU_MaxIndex] = Peasant
-
Set MU_Speed[MU_MaxIndex] = 2.00
-
Set MU_WalAnim[MU_MaxIndex] = walk
-
-
Attachments
Last edited: