Edit: The Timer Elevator13 never starts. But the elapse of TImer Elevator1 triggers Timer Elevator 12, without killing the objects or paths.--ELEVATOR1 PLANNING
--///vvvbegin sequence
PlayAnimation("Elevator")
BlockPlanningGraphArcs("Elevator1-down")
BlockPlanningGraphArcs("Elevator1-up")
CreateTimer("Elevator1")--Creates
SetTimerRate("Elevator1", 1)--Sets the rate
SetTimerValue("Elevator1", 10)--and value of
StartTimer("Elevator1")--then starts the downgoing timer
ShowTimer("Elevator1")
--///^^^begin sequence
--///vvvDownGoingTimerElapse-What happens when the downgoing timer ends
OnTimerElapse(
function(timer)
UnblockPlanningGraphArcs("Elevator1-up")--allows units to follow plans onto elevator at bottom
KillObject("elebars2")
KillObject("elebars3")
CreateTimer("Elevator12")--Creates
SetTimerRate("Elevator12", 1)--Sets the rate
SetTimerValue("Elevator12", 20)--and value of
StartTimer("Elevator12")--then starts the bottomwait timer
ShowTimer("Elevator12")
end,
"Elevator1"
)
--///^^^DowngoingTimerElapse
--///vvvbottomwait timer elapse-Stuff that happens when the elevator starts going back up
OnTimerElapse(
function(timer)
BlockPlanningGraphArcs("Elevator1-up")
RespawnObject("elebars2")
RespawnObject("elebars3")
CreateTimer("Elevator13")--Creates
SetTimerRate("Elevator13", 1)--Sets the rate
SetTimerValue("Elevator13", 10)--and value of
StartTimer("Elevator13")--then starts the upgoing timer
ShowTimer("Elevator13")
end,
"Elevator12"
)
--///^^^bottomwait timer elapse
--///vvv upgoing timer elapse-Stuff that happens when the elevator reaches the top again
OnTimerElapse(
function(timer)
DisableBarriers("Elevator1-top")
UnblockPlanningGraphArcs("Elevator1-down")
KillObject("elebars1")
CreateTimer("Elevator14")--Creates
SetTimerRate("Elevator14", 1)--Sets the rate
SetTimerValue("Elevator14", 20)--and value of
StartTimer("Elevator14")--then starts the top waiting timer
ShowTimer("Elevator14")
end,
"Elevator13"
)
--///^^^ upgoing timer elapse
--///vvv top wait timer elapse-Stuff that happens when the elevator starts going back down
RespawnObject("elebars1")
SetTimerRate("Elevator1", 1)--reSets the rate
SetTimerValue("Elevator1", 10)--and value of
StartTimer("Elevator1")--then restarts the downgoing timer
ShowTimer("Elevator1")
--///^^^ top wait timer elapse
--end ELEVATOR1 PLANNING
Elevator Pathing Script-Functions not carried out!
Moderator: Moderators
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Elevator Pathing Script-Functions not carried out!
For some reason the following script, designed to to disable plans and barriers (objects too) coninciding with an animated elevator, neglects to kill and respawn objets and apparently, the pathing funtions. However, the next timer is created and started. Any ideas? Also, the spelling is right (I think)
-
archer01
First off, NEVER use CreateTimer() inside a timer elapse function. Every time the function runs it will create a new timer and there is no telling what that is doing inside the computer's memory. Create all the timers you need at the top. Even when a timer finishes, it doesn't disappear until you use the DestroyTimer() function. Just keep setting the timer time then starting/stopping it as needed.
Secondly, the planning you are trying to disable/enable, are they "dynamic" connections. Only dynamic planning can be turned on/off at runtime.
Third, are the things you are trying to kill 'props' or 'buildings'? Only entities (like soldiers and destroyables) can be killed using KillObject(). Props/buildings cannot.
Secondly, the planning you are trying to disable/enable, are they "dynamic" connections. Only dynamic planning can be turned on/off at runtime.
Third, are the things you are trying to kill 'props' or 'buildings'? Only entities (like soldiers and destroyables) can be killed using KillObject(). Props/buildings cannot.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
RE: Elevator Pathing Script-Functions not carried out!
You are saying:
Paths blocked
Timer 1 starts
Timer 1 ends
No paths unblocked
No objects killed
Timer 12 starts
Timer 12 ends
No paths blocked
No objects respawned
(13 never starts)
General Tip for debugging:
You can place ShowMessageText("") in your code, then count the number of times it shows up ingame to see which sections of code are really running and which fail to run.
Paths blocked
Timer 1 starts
Timer 1 ends
No paths unblocked
No objects killed
Timer 12 starts
Timer 12 ends
No paths blocked
No objects respawned
(13 never starts)
General Tip for debugging:
You can place ShowMessageText("") in your code, then count the number of times it shows up ingame to see which sections of code are really running and which fail to run.
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Elevator Pathing Script-Functions not carried out!
Thanks again.
So, Create 'n' rate all timers directly in post load, and only start them in the elapse.
And, there's no elapse event for timer 14 . . .
So, Create 'n' rate all timers directly in post load, and only start them in the elapse.
And, there's no elapse event for timer 14 . . .
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
RE: Elevator Pathing Script-Functions not carried out!
If there is no elapse event for a timer, then there is no reason to have that timer. Unless its counting up how long the map has been playing. Though timers don't count up so...
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
RE: Elevator Pathing Script-Functions not carried out!
No, It was another mistake, I forget to type in the OntimerElapse( etc around the functions I wanted executed, thats all.
