Page 1 of 1

Something broke..

Posted: Thu Jun 18, 2015 8:04 pm
by Emera Nova
So I have this code

Code: Select all

step = 1
function tick()
	local seq = {1,2,3,4}
	findEntity ("bic_"..seq[step]).controller:start()
	step = step%#seq+1
end
set up to allow for a flashing light I have set up to work.

I also have

Code: Select all

step = 1
function tick()
   local seq = { 1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2 }
   findEntity("firespawner_"..seq[step]).controller:activate() 
   step = step%#seq+1
end

this one as well that has fire balls get launched out.. I think the firespawner one is breaking the other step counters in the dungeon but not sure why. If it isn't that then I have no idea whats causing it to break..

I have a total of 4 different scripts that run off that same build of code.. My guess is the local seq is what is fucking shit up even tho its set to different timers and different Entitys..

Re: Something broke..

Posted: Thu Jun 18, 2015 8:34 pm
by minmay
The local variable seq isn't doing anything. The script-global variable step is probably your problem; if both of those snippets are in the same ScriptComponent then only one "step" variable exists and both functions are setting it.

Re: Something broke..

Posted: Mon Jun 22, 2015 7:34 pm
by Emera Nova
Each of those are housed in their own ScriptComponent. The only thing they share is they are on the same level. I have 4 different scripts that all call on a tick to be used to keep timing of spawning objects and the destruction of them. Timers alone are accurate enough for that type of thing and often end up catching up to each other over time.