Jump to content
Sign in to follow this  
Grimfist

Respawn with loadout.

Recommended Posts

here is a unit script:

; ****************************************************************
; Custom unit script for Armed Assault
; Created with ArmA Edit - Version 1.3.4000
; HELP: Run this script from the INITIALIZATION box of the unit.
; CODE: [this] exec "RU_CM.sqs"
; Made by grimfist
; ****************************************************************

; Get the unit parameter given
_unit = _this select 0

; Strip the units current gear
removeAllWeapons _unit

; Add the new gear to the unit
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addMagazine "30Rnd_545x39_AK"
_unit addWeapon "AK_107_GL_Kobra"
_unit addMagazine "8Rnd_9x18_Makarov"
_unit addMagazine "8Rnd_9x18_Makarov"
_unit addWeapon "Makarov"
_unit addMagazine "HandGrenade_East"
_unit addMagazine "HandGrenade_East"
_unit addMagazine "SmokeShellRed"
_unit addMagazine "SmokeShellRed"
_unit addMagazine "FlareRed_GP25"
_unit addMagazine "FlareRed_GP25"
_unit addMagazine "FlareRed_GP25"
_unit addMagazine "FlareRed_GP25"
_unit addMagazine "1Rnd_SMOKERED_GP25"
_unit addMagazine "1Rnd_SMOKERED_GP25"
_unit addMagazine "1Rnd_SMOKERED_GP25"
_unit addMagazine "1Rnd_SMOKERED_GP25"
_unit addWeapon "Binocular"

Exit

How do i get it so when the player/ai re-spawns in MP, they get this loadout, not the defualt one, or wepons they have picked up.

i have tried to do add event handler killed --> [this] exec "RU_CM.sqs" but i cant get it to work.

TIA, grim.

SRY, wrong thread, and i cant delete it. i haven't really used this place much!

Edited by Grimfist

Share this post


Link to post
Share on other sites
_unit = _this select 0;

removeAllWeapons _unit;

{_unit addMagazine "30Rnd_545x39_AK"} foreach [1,2,3,4,5,6,7,8];
_unit addWeapon "AK_107_GL_Kobra";
{_unit addMagazine "8Rnd_9x18_Makarov"} foreach [1,2];
_unit addWeapon "Makarov";
{_unit addMagazine "HandGrenade_East"} foreach [1,2];
{_unit addMagazine "SmokeShellRed"} foreach [1,2];
{_unit addMagazine "FlareRed_GP25"} foreach [1,2,3,4];
{_unit addMagazine "1Rnd_SMOKERED_GP25"} foreach [1,2,3,4];
_unit addWeapon "Binocular";

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Your evenhandler should work, just add waituntil that checks when the player has respawned. Your script runs as soon as the played died, way before he has respawned.

Ermh, whatever waituntil is in SQS, @?

Share this post


Link to post
Share on other sites

waitUntil {alive player};

_unit = player;

removeAllWeapons _unit;

{_unit addMagazine "30Rnd_545x39_AK"} foreach [1,2,3,4,5,6,7,8];

_unit addWeapon "AK_107_GL_Kobra";

{_unit addMagazine "8Rnd_9x18_Makarov"} foreach [1,2];

_unit addWeapon "Makarov";

{_unit addMagazine "HandGrenade_East"} foreach [1,2];

{_unit addMagazine "SmokeShellRed"} foreach [1,2];

{_unit addMagazine "FlareRed_GP25"} foreach [1,2,3,4];

{_unit addMagazine "1Rnd_SMOKERED_GP25"} foreach [1,2,3,4];

_unit addWeapon "Binocular";

Edited by cobra4v320

Share this post


Link to post
Share on other sites
while {true} do { //remove this

waitUntil {alive player};

_unit = player;

removeAllWeapons _unit;

{_unit addMagazine "30Rnd_545x39_AK"} foreach [1,2,3,4,5,6,7,8];

_unit addWeapon "AK_107_GL_Kobra";

{_unit addMagazine "8Rnd_9x18_Makarov"} foreach [1,2];

_unit addWeapon "Makarov";

{_unit addMagazine "HandGrenade_East"} foreach [1,2];

{_unit addMagazine "SmokeShellRed"} foreach [1,2];

{_unit addMagazine "FlareRed_GP25"} foreach [1,2,3,4];

{_unit addMagazine "1Rnd_SMOKERED_GP25"} foreach [1,2,3,4];

_unit addWeapon "Binocular";

}; //remove this

Bad idea. It will continually add the gear to the unit. Remove the while loop.

Share this post


Link to post
Share on other sites

so what do i actually put in my script,

waitUntil {alive player}; ? is it sqs or ?

Share this post


Link to post
Share on other sites

That's SQF. With possible exception of camera scripts, most everything you code should probably be in SQF.

Share this post


Link to post
Share on other sites

im quite new to all this scripting stuff, so i will convert all my load-out scripts to use SQF (not SQS). and then what, what do i add in to make it so the player always re-spawns with these weapons, or will SQF do that automatically?

ty BTW

Share this post


Link to post
Share on other sites

You just have to add the command to wait for the player to be alive again after he died so it will wait to give the player unit the weapons until the new entitiy is created, i.e. the player respawned. I think on sqs format this is done by

@(alive player),

on sqf format it is done by WaitUntil{alive player};

Thus this script is executed by a "killed" eventhandler you can be sure the unit is dead already when the script starts, all what's left is

to add the wait command to the appropriate line in your script:

; Get the unit parameter given
_unit = _this select 0
@(alive _unit)

That's it.

But: it really is a good idea to learn sqf and not use sqs anymore. Do yourself a favour and write all your future scripts in sqf format.

Edited by Bon

Share this post


Link to post
Share on other sites

SQF is just a syntax for the coding, it doesn't do anything on it's own. Just a way for you to tell the system to do something. :)

To convert your first posted script to SQF is very simple. Just replace all the comment semi-colons with // then just add a semi-colon to the end of every line ;

As far as getting what you want done, use the code Cobra posted above in your init.sqf:

waitUntil {alive player};

_unit = player;

removeAllWeapons _unit;

{_unit addMagazine "30Rnd_545x39_AK"} foreach [1,2,3,4,5,6,7,8];
_unit addWeapon "AK_107_GL_Kobra";
{_unit addMagazine "8Rnd_9x18_Makarov"} foreach [1,2];
_unit addWeapon "Makarov";
{_unit addMagazine "HandGrenade_East"} foreach [1,2];
{_unit addMagazine "SmokeShellRed"} foreach [1,2];
{_unit addMagazine "FlareRed_GP25"} foreach [1,2,3,4];
{_unit addMagazine "1Rnd_SMOKERED_GP25"} foreach [1,2,3,4];
_unit addWeapon "Binocular";

Share this post


Link to post
Share on other sites

ahh ty m8, i will go about doing this now, ty for your help everyone, i really appreciate it.

and now im going to learn sqf :)

Edited by Grimfist

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  

×