Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
speeder

AddAction beginner..

Recommended Posts

Hi people.

So I've started to TRY and mess about with the addaction, but not with much luck.

I'm kind of a novice with scripting, but here goes:

I want a unit to have an action to spawn 4 weapon crates around him.

Remove his action.

Mark spawn-area with smoke.

Destroy the crates.

Delete the crates

Give him back the action.

But nothing happens when I call my script. This is what I got:

In my guys INIT

this addAction ["Spawn Ammo","weapons.sqf"]

weapons.sqf

if (!isServer) exitWith {};

_host		= _this select 0;
_unit 		= _this select 1;
_id 		= _this select 2;
_pos		= (getpos _unit);
_crate1		= "RULaunchersBox";
_crate2		= "USLaunchersBox";
_crate3		= "RUSpecialWeaponsBox";
_crate4		= "USSpecialWeaponsBox"[size="5"]:[/size]
_smoke1		= "SmokeShellGreen"

if (not alive _host) exitwith {
hint "The Group Leader has died"; 
_host removeaction _id;
};

_host removeAction _id;

_box1Dest = [(_pos select 0)+10,(_pos select 1)+10,(_pos select 2)];
_box2Dest = [(_pos select 0)-10,(_pos select 1)+10,(_pos select 2)];
_box3Dest = [(_pos select 0)+10,(_pos select 1)-10,(_pos select 2)];
_box4Dest = [(_pos select 0)-10,(_pos select 1)-10,(_pos select 2)];
_smoke1Dest = [(_pos select 0),(_pos select 1),(_pos select 2)];

_box1 = _crate1 createvehicle _box1Dest;
_box2 = _crate2 createvehicle _box2Dest;
_box3 = _crate3 createvehicle _box3Dest;
_box4 = _crate4 createvehicle _box4Dest;

_smokemarker1 = _smoke1 createvehicle _smoke1Dest;

sleep 20;

_box1 setdamage 1;
_box2 setdamage 1;
_box3 setdamage 1;
_box4 setdamage 1;

sleep 10;

deletevehicle _box1;
deletevehicle _box2;
deletevehicle _box3;
deletevehicle _box4;

sleep 10;

_action = _host addAction ["Spawn Ammo","weapons.sqf"];

---------- Post added at 18:21 ---------- Previous post was at 17:40 ----------

Nevermind - I spotted my error - I had put in a : instead of a ;

Share this post


Link to post
Share on other sites
Nevermind - I spotted my error - I had put in a : instead of a ;

Nice you found it, those small errors are nasty.

A good tool for locating such errors or just double checking a script is using squint

Share this post


Link to post
Share on other sites
Sign in to follow this  

×