Jump to content

Sign in to follow this  
Priest

MP Respawn - respawn with Steyr

Recommended Posts

Comrades

How do you change the default respawn weapon in MP games?

Example: all WEST units respawn with an M16, the EAST with an AK74, resistance with AK47.  I want the WEST player to respawn with a STEYR in his hand. I do not want any stray M16's or renegade AK74's polluting my map.

I have looked back through 35 days worth of topics in this forum and 10 different fan-sites, but cannot find any answers.

I am trying to make a simple Aussie vs Kiwi CTF MP map. Both sides are armed with Steyrs (as both countries in fact are).

I have made a simple pbo file that starts the EAST player (the Kiwis) with a Steyr weapon instead of an AK74.

However, after the first kill, both sides players respawn with the "default" weapon (or default setting) for their side - the Australians with M16's and the Kiwis with AK74's.

I don't want that to occur. I want them to both respawn with Steyrs in hand. This way, both sides have a "reasonably" equal footing.

Any information or guidance will result in my first born being named after you.

Unless your name is Dwayne, Bruce, Scott, Chad, Brad, Marc, Julian, Justin, Barney, Thadeous, Maximillian, Trevor, Gus, Hugh, Gazza, Bazza, Barry, Larry, Jon, Stephen, or another name that I do not like. Then you will get a Xmas card instead. But since I am a communist that will be highly unlikely as well. I might build a bronze statue in your (vague) likeness after the revolution, so it may be worth your while.

Tally ho.

biggrin.gif

Share this post


Link to post
Share on other sites

I think there is a script name OnPlayerRespawn.sqs (look through contents of \dta\scripts.pbo )

Using this you can also assign a loadout from inside that script.

Share this post


Link to post
Share on other sites

Just to make it clear, if you include a script by that name

(it might not be exactly what I posted, depbo the dta\scripts file to find the correct name)

in the mission directory, it will change the respawn effects.

You can use the original (man to man, as opposed to man to seagull) just changing the weapons.

Share this post


Link to post
Share on other sites

Thanks dude.

Will have a play. I guess it is a matter of trial and error and a lot of paitence.

I will post up how I did it if I can ever sort it out.

Cheers

Share this post


Link to post
Share on other sites

Wow! I had no idea that was possible. Keep bumping this thread!

Share this post


Link to post
Share on other sites

Or you can just do triggers for all the soldiers with "not alive unitname" in the condition, and "removeallweapons unitname;unitname addmagazine "steyrmag";unitname addweapon "steyr";" and set the countdown time to the respawn time. Where you of course replace all "unitname"´s with actual names of the units. Also set it to repeating so it will work more than once.

Share this post


Link to post
Share on other sites

Kegs method will work as well, however, when doing such repetetive tasks, we humans tend to introduce errors. This would be a bitch to debug too. Depends on how many soldiers there are.

If it's a total of 8, the keg method is recommended (much smaller workload).

If it's 24, I'd not recommend it.

Plus, if you're often adding/removing soldiers, his method will also be a real bitch.

But in theory both work and it's your choice which you'll use.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (MaHuJa @ Feb. 11 2002,17:07)</td></tr><tr><td id="QUOTE">Kegs method will work as well, however, when doing such repetetive tasks, we humans tend to introduce errors. This would be a bitch to debug too. Depends on how many soldiers there are.

If it's a total of 8, the keg method is recommended (much smaller workload).

If it's 24, I'd not recommend it.

Plus, if you're often adding/removing soldiers, his method will also be a real bitch.

But in theory both work and it's your choice which you'll use.<span id='postcolor'>

Its rather easy & fast actually to just copy 24 copies of the trigger and then use a text editor to edit the unitnames from the mission.sqm smile.gif

Share this post


Link to post
Share on other sites

toadlife I dont wanna hurt feelings, but this issue has been handled many times here. So there was no need to dig out an antic thread.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Kegetys @ Feb. 11 2002,11:28)</td></tr><tr><td id="QUOTE">Or you can just do triggers for all the soldiers with "not alive unitname" in the condition, and "removeallweapons unitname;unitname addmagazine "steyrmag";unitname addweapon "steyr";" and set the countdown time to the respawn time. Where you of course replace all "unitname"´s with actual names of the units. Also set it to repeating so it will work more than once.<span id='postcolor'>

That's how I do mine, but I never made one with more than 10 players. Point is, it's fast and reliable. I usually put the activation of the trigger to a weapons script.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Balschoiw @ Nov. 24 2002,19:49)</td></tr><tr><td id="QUOTE">toadlife I dont wanna hurt feelings, but this issue has been handled many times here. So there was no need to dig out an antic thread.<span id='postcolor'>

Actually, someone referenced this thread from another forum. I decided to post it here because the script I wrote is easier to implement (less chance of annoying typos), has no need for triggers, and has more possibilities than all of the solutions I have seen posted.

Using triggers:

-------------

make a trigger

Copy it 24 times

Edit each trigger with the players name

hope you didnt make a typo

Using my script:

--------------------

["soldier1",0] exec "myscript.sqs"

["soldier2",0] exec "myscript.sqs"

["soldier3",0] exec "myscript.sqs"

["soldier4",0] exec "myscript.sqs"

["soldier5",0] exec "myscript.sqs"

["soldier6",0] exec "myscript.sqs"

["soldier7",0] exec "myscript.sqs"

["soldier8",0] exec "myscript.sqs"

Share this post


Link to post
Share on other sites

Question:

Does the script for each unit run all the time looped or only in case dammage >= 1 ?

Cause basically even looped scripts tend to cause lag and

client <-> server problems.

Share this post


Link to post
Share on other sites

neither.

It detects when the player dies by doing.

@!alive _unit

Even though the @ command is slightly less efficient that a trigger condition (a trigger checks it condition every half second according to Suma, while the @ command checks much more frequently), it only checks for the units condition if the unit is local. Triggers run on every persons machine no matter what the condition.

While every instance of the script does run on everyone's machine, the script only activates the respawn code when the player becomes local. An example would be when a player disconnects and the server or Group leader takes over control of the unit.

The script checks to see if the unit is local with a very slow loop - something like this:

_name = _this select 0

#checklocal

~((random 4) + 1)

?local call format["%1",_name]:goto "respawnloop"

goto "checklocal"

** the "call format" code is required because once a unit dies in MP, the only way you can reference the new player is via his literal name. Simple doing "_unit = soldier1" at the beggining of the script would never work because once he dies, "_unit" doesn't exist anymore.

Once the unit becomes local, then the script kicks into respawn mode.

OH btw, I said the script has "more possibilities" - it really doesn't. tounge.gif I was just getting a little overzealous there. It's just easier to use and more efficient.

It does come with two included functions that allow the unit to either respawn with the exact weapon loadout they started the mission with or the same loadout they had when they were killed.

Share this post


Link to post
Share on other sites

It works with both player and AI. Even if a player diconnects from the game and the server takes control of the player's unit, the server will take over the respawn duties, and it will still work.

Share this post


Link to post
Share on other sites

<span style='color:blue'>Doolittle's Player Weapon Respawn script</span>

Add to init.sqs file these two lines:

playerweapons = weapons player

playermagazines = magazines player

Place a trigger on the map with these settings:

Repeating

Condition = not alive player and local player

OnActivation =

(Nothing needed for OnActivation)

OnDeactivation = [] exec "player.sqs"

Make a file named player.sqs with this in it:

player removeMagazine "M16"

player removeWeapon "M16"

"player addMagazine _x" forEach playermagazines

"player addWeapon _x" forEach playerweapons

player selectWeapon (playerweapons select 0)

The great thing about this: one trigger, no looping or @ script, and no need to name units.  The trigger stops when the player (client) is alive again, this is when we run the player.sqs script.  We load the player up with whatever was "saved" in our global variables playermagazines & playerweapons which is their starting gear.

This does not rearm AI controlled players in MP though! sad.gif

Doolittle

P.S. MaHuJa I tried OnPlayerRespawn.sqs stuff & that doesn't work.  Maybe I did something wrong, like wrong filename?

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  

×