OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: ual002 on 25 Aug 2010, 04:44:34
-
Ok so ive got a tent with addaction and it points to a script... this is the script....
_nearestgrp = [spawntent, allgroups] call CBA_fnc_getNearest
_sold = random 3
tr0 = "Ins_Soldier_Medic"
tr1 = "Ins_Soldier_1"
tr2 = "Ins_Soldier_2"
tr3 = "Ins_Soldier_AT"
_unit = _nearestgrp createUnit ["tr_sold", getPos spawntent, [], 0, "none"];
removeallweapons _unit; _unit addweapon "ACE_M16A4_Iron";
addswitchableunit _unit;
Tried to use the random command and assign variables to the numbers and im getting no results. Anybody see what im doing wrong?
-
Right out of my head:
I'd replace
_sold = random 3
tr0 = "Ins_Soldier_Medic"
tr1 = "Ins_Soldier_1"
tr2 = "Ins_Soldier_2"
tr3 = "Ins_Soldier_AT"
_unit = _nearestgrp createUnit ["tr_sold", getPos spawntent, [], 0, "none"];
with:
all_tr = ["Ins_Soldier_Medic","Ins_Soldier_1","Ins_Soldier_2","Ins_Soldier_AT"];
_sold = all_tr select (random floor (count all_tr));
_unit = _nearestgrp createUnit [_sold, getPos spawntent, [], 0, "none"];
(not sure about random floor <number>, i think it worked that way if i remember correctly)
-
Another thing...based on your code sample, it looks like you're switching back and forth between SQS and SQF syntax (i.e., semicolons at the end of statements, etc.)
-
Great thanks, this worked. I love the OFP/ARMA community!!
all_tr = ["Ins_Soldier_Medic","Ins_Soldier_1","Ins_Soldier_2","Ins_Soldier_AT"];
_sold = all_tr select (random floor (count all_tr));
_unit = _nearestgrp createUnit [_sold, getPos spawntent, [], 0, "none"];
sqs semicolon, sqf no semicolon?
-
SQF scripts use semicolons at the end of statements and code blocks.
http://community.bistudio.com/wiki/SQF_syntax
-
why have i never run into that.