Jump to content
Sign in to follow this  
iceman77

Car Bomb Script Help

Recommended Posts

Iam trying to get my carbomb script working..It is supposed to 1).Detect if the unit is in the vehicle. 2).detect if the speed of the car is greater than five. 3).blow up if both conditions are met..

the unit gets in the car and it blows up instantly...obviously the syntax is messed up or something...

it gives me a "generic error in expression" error banghead.gif  

Quote[/b] ]?(_unit in _vehicle) and (|#|_vehicle speed >5):goto....

here is the script below..any help would be appreciated.

_unit = _this select 0

_vehicle = _this select 1

#update

?(_unit in _vehicle) and (_vehicle speed >5):goto "bomb"

~2

:goto "update"

#bomb

~5

_vehicle setdammage 1

_unit setdammage 1

exit

Regards Iceman

Share this post


Link to post
Share on other sites

mmm... seems problem of "speed" command:

http://community.bistudio.com/wiki/speed

Your parameter is first.. and must be after the command wink_o.gif

Try this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?((_unit in _vehicle) && ( speed _vehicle >5)): goto "bomb";

And think about convert and use SQF in your scripts wink_o.gif...

Share this post


Link to post
Share on other sites

GoTo doesn't work in SQF though.

You don't need the : before the GoTo "update"

Share this post


Link to post
Share on other sites

thanks guys..it works now..Dachevs is correct..you don't need the : before the goto "update" command...iam assuming that the goto command after the : will only activate if a certain condition is met   i.e. : goto "blowup"  when the unit is in the vehicle and the vehicle is going over the speed of 5

we want the script to keep checking if the unit is in the vehicle and is going over speed of 5

therefore no need for the :

Iam a noob scripter trying to learn...please correct anything i've said in this post if it's incorrect..

Regards,

 Iceman

Share this post


Link to post
Share on other sites

Here's a similar script to the one i've posted above...exept i want the vehicle explode when the units inside the vehicle and the vehicles engine is on..

iam getting another generic error in expression

Quote[/b] ]?(_unit in _vehicle)and(|#|engineon _vehicle):goto...

_unit = _this select 0

_vehicle = _this select 1

#update

?(_unit in _vehicle)and(engineon _vehicle):goto "blowup"

~2

goto "update"

#blowup

_vehicle setdammage 1

_unit setdamage 1

~3

player sidechat "Took care of that punk!"

exit

Regards,

Iceman

Share this post


Link to post
Share on other sites

To DaChevs:

Quote[/b] ]

GoTo doesn't work in SQF though.

Yes... excuse my bad english... i never said that that code was sqf... i said "think about convert.." wink_o.gif

Quote[/b] ]

You don't need the : before the GoTo "update"

You are right!! I didn´t see the ":" banghead.gif

To Texas*BDA*:

Quote[/b] ]

?(_unit in _vehicle)and(|#|engineon _vehicle):goto...

May be the problem is engineon command... try isEngineOn wink_o.gif

http://community.bistudio.com/wiki/isEngineOn

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

?((_unit in _vehicle) and (isEngineOn _vehicle)) : goto...

Share this post


Link to post
Share on other sites

No problem blackgrain.

@TexasBDA

As for the : , I believe this is only needed when you are using it for a unit, just as you said wink_o.gif Like ?(Unit1 == player) : GoTo "blank".

Good luck thumbs-up.gif

Hope you get your scripts workin.

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  

×