Jump to content
Sign in to follow this  
thegunnysgt

Respawn w/Weapons

Recommended Posts

I need it when player dies and respawn he respawn with the weapons of his choice that was "taken" at the beginning of the mission. So if I pick up 1 grenade, m16, and 2 m16 magazines then die with only the m16 and 1 m16 magazines. So when I respawn I respawn with the 1 grenade, m16, and 2 m16 magazines.

An example would be in Evolution Blue and Red. I have broken the pbo's apart and can't understand the scripts within as there are so many scripts and they don't make sense to me.

Any suggestions? Any help?

Share this post


Link to post
Share on other sites

Looking at this script, I think Evo uses the last weapons retrieved from an ammo box, not the first weapons taken at start of mission:

myweapons.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">for [{_loop=0}, {_loop<1}, {_loop=_loop}] do

{

sleep 1.001;

waitUntil {animationState player == "ainvpknlmstpslaywrfldnon" or animationState player == "ainvpknlmstpsnonwnondnon_3"};

waitUntil {animationState player != "ainvpknlmstpslaywrfldnon" and animationState player != "ainvpknlmstpsnonwnondnon_3"};

pweapons = weapons player;

_count = count _weapons;

pallammo = [];

i=0;

while {_i < _count} do

{

_gun = _weapons select 0;

_ammo = player ammo _gun;

pallammo = pallammo + [_ammo];

_i=_i+1;

sleep 0.1;

};

hint format["weapons = %1, ammo = %2",pweapons,pallammo];

};

spawn.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...

removeAllWeapons _player;

{player addmagazine _x} forEach pallammo;

{player addweapon _x} forEach pweapons;

player selectweapon (primaryWeapon player);

...

There are other scripts like Universal Weapons Respawn Script which is taken from this weapons_respawn.sqs topic.

Maybe you can modify one of these to do what you want.

Share this post


Link to post
Share on other sites

When using the universal weapons respawn:

(named soldier_1 in this example)

Put this in soldiers init:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["soldier_1",0] exec "weapons_respawn.sqs";

if you want to use it with having loadout you die with , change 0 to 1.

Just make sure this script is in your mission folder root....

Share this post


Link to post
Share on other sites

Come to think about it, how can I get it to work say when they get weapons from the supply crates and such.

But thanks, I'll give the above a try when I can.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×