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

Equipment Save, Vehicle spawn, minor questions.

Recommended Posts

Hello,

I am a total newb to scripting and I am working on my first real mission (with scripts).

I managed to make a trigerred marker change, respawn, armed civilians, pseudo-missions (only flag markers showing the place) and nice game ending when all flag areas are secured.

I have managed to script basic things, download and edit some more scripts, but still I have problems.

So first - I have searched and read A LOT. So please save comment's like "you are lazy" for yourselves.

Then:

I am looking for a way to loop a script from armaholic (or get a looped one, working):

_weapons = weapons player;

_magazines = magazines player;

hint "Equipment Saved. Save it again if you die!";

waitUntil {!alive player};

waitUntil {alive player};

_p = player;

removeAllItems _p;

removeAllWeapons _p;

{_p addMagazine _x} forEach _magazines;

{_p addWeapon _x} forEach _weapons;

hint "Equipment Loaded. Go and save it again!";

_primw = primaryWeapon _p;

if (_primw != "") then {

_p selectWeapon _primw;

// Fix for weapons with grenade launcher

_muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");

_p selectWeapon (_muzzles select 0);

};

Script is saving weapon layout by adding "SAVE" option to an ammo crate, and restore the same layout after respawn, but just once. I managed to loop it but in a wrong way, it repeats the whole script, saves and loads over and over. I need to loop the load only, and launch it only after I die, that I can die over and over again, and I won't have to save the weapon everytime.

Being unable to do so, I just changed hint to "Equipment Loaded. Go and save it again!" (I am so noobish,right?)

Other thing - how can I make a reward vehicle appear after conditions are met? (at example finished mission using ({alive _x} count [t1,t2,...]<1 script - 10 dead bodies? You deserve a car.)

Is it possible to make bandits appear when someone arrive a trigger area?

Thanks for any answers.

Share this post


Link to post
Share on other sites

you can try doing it that way:

create a script and name it "gearsave.sqf":

_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;

if (_target != _caller) exitWith {hint "this is not your Action, dont use it!"};

_target removeAction _id;

_weapons = weapons _target;
_magazines = magazines _target;

_target setVariable ["Weapons", _weapons, false];
_target setVariable ["Magazines", _magazines, false];

hint "Equipment Saved!";

then create another script:

while {true} do {
waitUntil {!alive player};
waitUntil {alive player};
_gearRestoreAction = player addAction ["<t color='#0000CD'>Restore Gear</t>", "gearload.sqf"];
};

Create another one and name it "gearload.sqf":

_p = _this select 0;
_caller = _this select 1;
_id = _this select 2;

if (_p != _caller) exitWith {hint "this is not your Action, dont use it!"};

_weapons = _p getVariable "Weapons";
_magazines = _p getVariable "Magazines";

_p removeAction _id;

removeAllItems _p;
removeAllWeapons _p;
{_p addMagazine _x} forEach _magazines;
{_p addWeapon _x} forEach _weapons;
hint "Equipment Loaded!";
_primw = primaryWeapon _p;
if (_primw != "") then {
_p selectWeapon _primw;
// Fix for weapons with grenade launcher
_muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles");
_p selectWeapon (_muzzles select 0);
};

last thing, in the init field of every player, place this line:

null = this addAction ["<t color='#0000CD'>Save Gear</t>", "gearsave.sqf"];

as for the vehicle reward, just set the conditions in a trigger, then in the on act field, make a createVehicle.

Share this post


Link to post
Share on other sites

Well, thanks for trying. There are problems with your script. The save is possible only at first body (if dead, go and find it to save again). Script can't see the .sqf (checked the name multiple times) and so - I can't check if loading works. Probably I did something wrong.

I was counting on some sort of changing the previous script, as it only need to get it's load work on every death (loop, refresh, something), which I wasn't able to do with my "skills". Or maybe someone can explain to me, how Xeno did the job with his Domination map. I just can't find that script anywhere.

Share this post


Link to post
Share on other sites

Sorry. I can't really make it work. Now, I am thinking about of a trigger saving it automatically on the map. I also can't solve this

This is init field of save crates: this addAction["Save Equipment","weaponRespawn.sqf"];

I don't know how to switch it to save weapon from a trigger in a place where players respawn.

Share this post


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

×