OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Captain Crunch on 03 Apr 2007, 14:34:35
-
Hi, in OFP, to sparkle up some missions, I used to have this script that made barrels explode if they were hit too many times. I try to use it in ArmA but it doesn't work. I know that CamCreate was replaced by CreateVehicle but there must be something else I do wrong. Please help.
This is what the script looks like:
;In Init field type : [] Exec "Script.sqs"
_Barrel = _This Select 0
#Loop
? (GetDammage _Barrel > 0.05) : GoTo "Kaboom"
~1
GoTo "Loop"
#Kaboom
Bang = "HandGrenade" CreateVehicle GetPos _Barrel
~6
Bang = "SmokeShell" CreateVehicle GetPos _Barrel
Exit
Thanx in advance.
-
Please use the code and /code tags to make the code easier to read.
Will test this script, no errors displayed by the engine in the top left corner?
EDIT: after a few shots on the barrel it catches fire. The script seems to do nothing, except for producing white smoke?
EDIT1: the smoke shell does indeed get created, I don't think that the class name for the hand grenade it correct.
EDIT2: haven't found the correct classname for a handgrenade, but I think that it's the problem as using a Sh_122_HE shell (artillery round) instead almost killed me.
Can't find classname to let the code work, maybe someone else knows the howto..
-
Thank You for the swift reply Cheetah.
That is weird. I tried with the Sh_122_HE instead and it still doesn't work. And if I get it right, the script seems to work with You since, I quote: The script seems to do nothing, except for producing white smoke?
The script doesn't work at all for me. I get no explosions, no white smoke, nothing. The way I do it is I type in every Init field of the barrels I put in the mission:
[] Exec "Barrels.sqs"
Anyone knows why I get no results. It used to work great in OFP.
-
I put this activation code in the init of the barrel: [this] exec "script.sqs";
Attached is the working mission.
-
Classnames for the grenades are : "HandGrenade" and "HandGrenadeTimed".
However you need to use the ammo classname instead of the magazine classname.
"GrenadeHand"
"GrenadeHandTimed"
Planck
-
Thank You guys. This works great.
-
I do something similar.
; Use this to call the script directly
; [unit,delay,ammo] exec "DamSmoke.sqs" ie. in a trigger
;unit = oil drum
;delay= time before explosion
; ammo= the type of explosive
; Or Place this in the init line of and object or unit
; I find Oil drums work best.
; this addEventHandler ["hit",{[_this select 0,4,"G_30mm_HE"] exec "DamSmoke.sqs"}]
_veh=_THIS SELECT 0
_delay=_this select 1
_charge =_this select 2
_veh removeAllEventHandlers "hit"
_veh setdamage 1
; rnd=delay before exploding
_rnd= random _delay
~_rnd
; crate the bang
BOMB1 = _charge createVehicle getpos _veh
; I had some slight lag with the object moving before exploding
~0.2
; some items just wont move or need more inertia
_veh setvelocity[-4+(random 8),-4+(random 8),random 16]
exit
I like to use the velocity command to make the object a little lighter it helps them get off the ground.
It's looks good if you group a few together and place them on the side of a hill.
-
I have a script similar to this.
I think I found a bug with large explosives that have been made using createvehicle.
I got about 5 people on a dedicated server and ran a script to spawn an lgb at each of their feet. Everyone, including the dedicated server crashed to desktop.
Hopefully you won't have this problem with the grenade.