Continual projectile spawner
Posted: Tue Oct 16, 2012 10:16 pm
Hi all,
I'm fairly new to LUA scripting, so please excuse the potentially silly questions that will no doubt follow
I'm trying to make a spawner shoot poison_bolts continually until a lever is in the activated state. So I created a lever and a 'for' loop script that in theory checks for the state of a lever and if it's deactivated, then do something. When I try and do this code...
...I get the error 'attempt to call a string value' on line 2. My attempt to work around this was to use another script that sets the counter and then maybe modify the above script to use this numerical state instead. Using this code:
Then flicking the lever back to deactivated gives me the more vague error 'bad self' on line 3.
I might be using a completely arcane approach for which there's a very simple answer (I couldn't see a 'continual' flag on the spawner...). Any suggestions for how I can fix this would be most welcome!
Thank you.
I'm fairly new to LUA scripting, so please excuse the potentially silly questions that will no doubt follow
I'm trying to make a spawner shoot poison_bolts continually until a lever is in the activated state. So I created a lever and a 'for' loop script that in theory checks for the state of a lever and if it's deactivated, then do something. When I try and do this code...
Code: Select all
function poison()
for i in lever_lv2PoisonLever:getLeverState() do
if i.LeverState == "deactivated" then
spawner_lv2PoisonSpitter:activate()
else
spawner_lv2PoisonSpitter:destroy()
end
end
endCode: Select all
function workplease()
if lever_lv2PoisonLever:getLeverState() == "deactivated" then
counter_2.setValue(0)
end
endI might be using a completely arcane approach for which there's a very simple answer (I couldn't see a 'continual' flag on the spawner...). Any suggestions for how I can fix this would be most welcome!
Thank you.