Failing Formulas?
-
can formulas be set to fail to function after a certain number of frames?
-
What do you mean by "fail"?
-
...I think he means to stop working.
-
yup.
if frame==0 then setVar("foo",1);elsif frame==100 then setVar("foo",0);end;
What it means: if frame is at 0, then set the variable "foo" to 1. if the frame is at 100, then get the variable "foo", and set it to 0. End.
fails at 100.skp
NOTE: the script can be put in the onTick box of any object. -
I need to know how to get a controlled script to fail, like a car out of gas
-
Somewhere give it a full tank.
setVar("gas",100) if frame==0
In the motor accel
(getVar("gas")<0? 0;1)*whatevermotorstrength;
Somewhere consume the gas
if(key("up")>0);g=getVar("gas");setVar("gas",g-1);end
-
The example wasn't what i wanted an example for. i need a thruster on a plane to not function regardless of control inputs.
-
...That is what you're looking for physicsguy, isn't it?
-
...my first example? all you have to do is type getVar("foo")* before each value. Here's something you may find familiar, with this technique in use
Dies completely (except bombs) after frame 500.By the way, C.Phillips, mind explaning that script? I wouldn't mind figuring out how it works What's g?
...all I can get so far is that gas is 100, if gas is smaller than 0, then the motor stops, and when up is pressed, g is equal to gas, which is equal to one less than g, thus lowering the value by 1 each frame up is>0 (pressed). But can you just use a letter as a variable? It doesn' seem to work for me... -
thanks
-
@unknownuser said:
By the way, C.Phillips, mind explaning that script? I wouldn't mind figuring out how it works What's g?
...all I can get so far is that gas is 100, if gas is smaller than 0, then the motor stops, and when up is pressed, g is equal to gas, which is equal to one less than g, thus lowering the value by 1 each frame up is>0 (pressed). But can you just use a letter as a variable? It doesn' seem to work for me...Yes "g" is a temporary variable. It could have been "gas" or (almost) anything. I tested the code and it seems to work as expected. How does it not work for you?
Advertisement