L
Luxxum
Guest
I'm trying to set up some code so that if the player character dashes (simple x=x+var currently) they must wait a certain amount of time before dashing again, with the potential to upgrade to multiple dash "charges" later on. I don't want to use alarms because I am told you can only have 12 of them at any given time, so I am trying to use timelines. However, I can't seem to get it to work. The script containing the code to create the timeline is definitely running, but the timeline isn't being created or isn't working how it should. I think it might have to do with me trying to use a variable for the name, but am unsure.
Here is what I have:
----------------------------------------------------------------------------------------------------------------
if timeline_exists(dsh_script_count) //to stop weird code for multiple dashes
{
dsh_script_count = dsh_script_count + 1
}
dsh_script_count = timeline_add()
timeline_moment_add_script(dsh_script_count, 0, dash_timer_animation_script)
timeline_moment_add_script(dsh_script_count, dsh_timer, dash_add_script)
timeline_moment_add_script(dsh_script_count, dsh_timer+1,end_dash_timeline_script)
timeline_index = dsh_script_count
timeline_position = 0
timeline_running = true
timeline_loop = false
------------------------------------------------------------------------------------------------------------------
dash_timer_animation_script:
------------------------------------------------------------------------------------------------------
dshvar = dsh_script_count //so if another timeline is created while this one is running, this timeline can still delete itself
//add animation for dash timer here
------------------------------------------------------------------------------------------------------------------
dash_add_script:
------------------------------------------------------------------------------------------------------
dshst = dshst + 1 //a "charge" of dshst is consumed for each dash, so this restores it
------------------------------------------------------------------------------------------------------------------
end_dash_timeline_script
------------------------------------------------------------------------------------------------------
timeline_delete(dshvar)
------------------------------------------------------------------------------------------------------------------
Any idea what might be going on?
Here is what I have:
----------------------------------------------------------------------------------------------------------------
if timeline_exists(dsh_script_count) //to stop weird code for multiple dashes
{
dsh_script_count = dsh_script_count + 1
}
dsh_script_count = timeline_add()
timeline_moment_add_script(dsh_script_count, 0, dash_timer_animation_script)
timeline_moment_add_script(dsh_script_count, dsh_timer, dash_add_script)
timeline_moment_add_script(dsh_script_count, dsh_timer+1,end_dash_timeline_script)
timeline_index = dsh_script_count
timeline_position = 0
timeline_running = true
timeline_loop = false
------------------------------------------------------------------------------------------------------------------
dash_timer_animation_script:
------------------------------------------------------------------------------------------------------
dshvar = dsh_script_count //so if another timeline is created while this one is running, this timeline can still delete itself
//add animation for dash timer here
------------------------------------------------------------------------------------------------------------------
dash_add_script:
------------------------------------------------------------------------------------------------------
dshst = dshst + 1 //a "charge" of dshst is consumed for each dash, so this restores it
------------------------------------------------------------------------------------------------------------------
end_dash_timeline_script
------------------------------------------------------------------------------------------------------
timeline_delete(dshvar)
------------------------------------------------------------------------------------------------------------------
Any idea what might be going on?