Jump to content
Sign in to follow this  
Alert23

Addaction with Condition

Recommended Posts

Hi all,


Im trying to create a "addaction" script which will detect a vehicle with its  setVectorUp [0,0,-1];  // vehicle is upside down

 

and add the "addaction" only when the vehicle is upside down and remove it after the vehicle is aligned to the surface again.

 

Maybe like:

 

if (car1 setVectorUp [0,0,-1];) then { car1 addAction["UNFLIP KART", "flipcar1.sqf", [], 7, true, true, "", "driver car1 == player"];};

Share this post


Link to post
Share on other sites

What exactly is your question? Since, going by your code ( driver car1 == player ), you already know that you can add a condition directly. Ok, I won't be a smartass:

car1 addAction["UNFLIP KART", "flipcar1.sqf", [], 7, true, true, "", "vectorUp car1 == [0,0,-1]"];

Btw it won't work since the vectorUp won't ever be [0,0,-1] but something like [0.002,-0.078,-0.94], so you should instead use

vectorUp car1 select 2 < 0

.

Why do you even attempt to write your own script (vectorUp in condition, not setVectorUp) when the first Google result soves it for you?

 

Share this post


Link to post
Share on other sites
57 minutes ago, theend3r said:

What exactly is your question? Since, going by your code ( driver car1 == player ), you already know that you can add a condition directly. Ok, I won't be a smartass:


car1 addAction["UNFLIP KART", "flipcar1.sqf", [], 7, true, true, "", "vectorUp car1 == [0,0,-1]"];

Btw it won't work since the vectorUp won't ever be [0,0,-1] but something like [0.002,-0.078,-0.94], so you should instead use


vectorUp car1 select 2 < 0

.

Why do you even attempt to write your own script (vectorUp in condition, not setVectorUp) when the first Google result soves it for you?

 

hey thanks for your help.

indeed the "vectorUp car1 == [0,0,-1]" dident worked but using "vectorUp car1 select 2 < 0" works perfect =)

i rly dont undertsand much of scripting thats why i dident realise that (driver car1 == player) is actually a condition =) i found that script on the net and just copy pasted it.

but with ur help i got it working now everytime a vehicle is flipped over an action is added allowing to unflip the vehicle while the driver remains inside the vehicle that was my goal.

thank you for your help.

Share this post


Link to post
Share on other sites

Take time to have a look at the BIKI page for addAction. I guess you will not apply this code for car1 only but all the karts. So, your best condition code could be using the special variables _this and _target (condition parameter). I don't know if your players are invincible. If not, you need to rerun this addAction in case of respawn, as written in script shared by theend3r.

Share this post


Link to post
Share on other sites
52 minutes ago, pierremgi said:

Take time to have a look at the BIKI page for addAction. I guess you will not apply this code for car1 only but all the karts. So, your best condition code could be using the special variables _this and _target (condition parameter). I don't know if your players are invincible. If not, you need to rerun this addAction in case of respawn, as written in script shared by theend3r.

okay ill take a look at it and also thank you for your advise.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×