Jump to content
Sign in to follow this  
Recon1

easy weapons change respawn

Recommended Posts

i was wondering I'm new at this so...   how do i make my guys start up in the map with a "m107" weapon for example

thank you

Share this post


Link to post
Share on other sites

Well, at mission start... just put it in his initialization field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeAllWeapons this; this addMagazine "10Rnd_127x99_M107 "...(a few times); this addWeapon "M107" (and whatever else you want)

When he respawns... call this from init.sqs:

i.e. --->  [] exec "respawn.sqs"

change 'player' to that specific player's name or else it will give it to all players when they respawn.

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

;this is respawn.sqs, for instance

#START

@ not (alive player)

@ alive player

if (local player) then

{

 removeAllWeapons player;

 player addMagazine "10Rnd_127x99_M107 ";

 player addMagazine "10Rnd_127x99_M107 ";

 player addMagazine "10Rnd_127x99_M107 ";

 player addMagazine "10Rnd_127x99_M107 ";

 player addWeapon "M107";

}

goto "START"

note: always add the magazines before adding the weapon, else he'll start w/ an empty rifle.

This is just to give you an idea of how to do it.. this is my no means how you would actually want to implement it in a true MP game...

You'd have to set up some IF statements based on which type of player died, etc. Or better yet make it an SQF and use the switch/case feature.

Share this post


Link to post
Share on other sites

it worked great thanks alot, now does anyone have a "cheat sheet" for all the ammo and weapons i cant figure out how to get the exact code for ammo and weapons thanks

Share this post


Link to post
Share on other sites

Player init:

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

Weaponsrespawn.sqs:

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

?!(player==_this):exit

_mags=magazines player

_weps=weapons player

#Loop

@!alive player

@alive player

removeallweapons player

_i=0

while {_i<count _mags} do {player addmagazine (_mags select _i);_i=_i+1}

_i=0

while {_i<count _weps} do {player addweapon (_weps select _i);_i=_i+1}

player selectweapon primaryweapon player

goto "Loop"

This way you dont have to make one script for every type of loadout. The script will check what loadout the player has at the start of the mission and adds it when he respawns.

Share this post


Link to post
Share on other sites

ok i have to change "player" with the characters name right well do i do that to all the players or just the first one

by the way I'm making a new map called Ghost Reloaded it a small map but tactical trying to make it as close to Ghost Recon as possible. So if anyone is bored and wanna help with the scripts and everything else let me know we'll chat over teamspeak or vent it dont matter thanks guys

Recon1

Share this post


Link to post
Share on other sites
ok i have to change "player" with the characters name right well do i do that to all the players or just the first one

No "player" is a hard coded variable in ArmA which is local to the clients PC in which the human player is associated with the name of their on screen avatar (ie. character). As its local to the client the player variable is associated with a different unit on each human players machine. Importantly, AI units are not detected by the player variable.

If you want a weapon_respawn script that works for both players and AI you can't go past Toadlife's which you can read about and get from here: http://www.armaholic.com/page.php?id=1554

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  

×