OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Dubieman on 05 Feb 2004, 00:07:01
-
Ok i want this script to create a grenade under or at the car position when it reaches 20 speed to disable it and not kill it, the script here is not working really. I named the car "vehicle" and the guy "unit".
; a small carbomb script
_unit = _this select 0
_vehicle = _this select 1
#update
? (_unit in _vehicle) && (speed _vehicle >20) : "goto blowup"
~2
goto "update"
#blowup
~5
_vehicle = "grenade" camcreate getpos _vehicle
exit
-
not working really
So what's the problem?
You've got _vehicle twice I see. If the grenade is too powerful try camcreating it a few metres underground.
-
_vehicle = "grenade" camcreate getpos _vehicle
yeah that looks like the problem to me as well.... you've already defined _vehicle as the car and now you're trying to define the grenade as _vehicle as well... :P
_bomb = "grenade" camcreate getpos _vehicle
:toocool:
-
Ahh yeah I kindof had a brain freeze there.... >:(
Just trying to get more scripting practice...
By not working I meant it is not working at all nothing blows up, but should work now. :)
-
Another possible problem would be:
? (_unit in _vehicle) && (speed _vehicle >20) : "goto blowup"
It should be:
? (_unit in (Crew _vehicle)) && (speed _vehicle >20) : "goto blowup"
-
Here you go:
; a small carbomb script
_unit = _this select 0
_vehicle = _this select 1
#update
? (_unit in _vehicle) && ((speed _vehicle) > 20) : goto "blowup"
~2
goto "update"
#blowup
~5
"grenade" camcreate (getpos _vehicle)
exit