Home   Help Search Login Register  

Author Topic: Respawn with chosen weapon.  (Read 3787 times)

0 Members and 2 Guests are viewing this topic.

Panther

  • Guest
Respawn with chosen weapon.
« on: 12 Jul 2003, 13:12:05 »
Good day, i want to let players to choose a weapon pack in the brieffing and then in game respawn with the same weapon pack. I have no idea how to do this i only know how they can pick a weapon in brieffing. The respawn wth that weapon is the problem.

Can anyone help me :-\ ?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Respawn with chosen weapon.
« Reply #1 on: 17 Jul 2003, 21:53:33 »
In your init.sqs, typoe the following

[Player] exec "Reload.sqs"

Then create the following script
_________________________________________________________________________

;;;;Reload.sqs

?(local server):exit
@time > 1
_weapArray = weapons player
_magArray = magazines player
_primary = primaryweapon player
?(_primary == "M16GrenadeLauncher"): _primary = "M16Muzzle"
?(_primary == "Ak74GrenadeLauncher"): _primary = "AK74Muzzle"
?(_primary == "Ak47GrenadeLauncher"): _primary = "AK47Muzzle"

#START
@alive player
removeAllWeapons player
{player addMagazine _x} forEach _magArray
{player addWeapon _x} forEach _weapArray
player selectWeapon _primary
goto "START"

___________________________________________________________________

Script is untested but should work

What it does is waits till (@time > 1) more than 1 second has passed in the gam,e, then it looks at what weapons and ammunition the player is carrying.
It saves theis loadout in arrays

It then waits for the player to die and respawn   (@alive player)

It then removes the default weapon loadout that BIS gives soldiers of that particular weapon class (removeAllWeapons player), so that there is enough space to reload the player with the loadout he had at the 1 second point

You can adjust the (@time > 1) to allow players more time to take weapons from crates before the script stores their loadout


There are other ways, such as reloadguy.sqs which will load players with a specific pre designed loadout of a mapmakers choosing. (This can be found in the Editors depot)

Many options available
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Panther

  • Guest
Re:Respawn with chosen weapon.
« Reply #2 on: 18 Jul 2003, 14:25:46 »
Wel i've tryed it but there is something wrong it keeps replacing the weapons every time without respawning. ???

Scripting is not my best side.
Ido know it's something with the loop but don't know what it is.

#START
@alive player
   "
   "
goto "START"

Can anyone help me furter ??
« Last Edit: 18 Jul 2003, 21:07:37 by Panther »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Respawn with chosen weapon.
« Reply #3 on: 19 Jul 2003, 14:03:52 »
Silly me


#START
@alive player
removeAllWeapons player
{player addMagazine _x} forEach _magArray
{player addWeapon _x} forEach _weapArray
player selectWeapon _primary
@! alive player
goto "START"



modify the script with
@! alive player
as shown above
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Panther

  • Guest
Re:Respawn with chosen weapon.
« Reply #4 on: 20 Jul 2003, 12:06:10 »
thx men atlast i can complete my map   :D
and GREAT script !!!
greetzz Panther
« Last Edit: 20 Jul 2003, 19:15:54 by Panther »

Mr.BoDean

  • Guest
Re:Respawn with chosen weapon.
« Reply #5 on: 21 Jul 2003, 21:59:40 »
Can this script be adapted to allow player to respawn with weapons they had at time of death? (i.e., not necessarily what they started with)
   Also, does using [player] exec "Reload.sqs" exempt the need for having to name each actual player here? Thx.  :)

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Respawn with chosen weapon.
« Reply #6 on: 21 Jul 2003, 23:46:05 »
Can this script be adapted to allow player to respawn with weapons they had at time of death? (i.e., not necessarily what they started with)

Yes.

http://www.ofpec.com/editors/resource_view.php?id=301
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Respawn with chosen weapon.
« Reply #7 on: 21 Jul 2003, 23:57:03 »
Here is a super-simple version of my weapons respawn script that would give a player the same weapons he had when he died upon respawning. THe only problem would be that if the player had a rifle with a grenade launcher, it wouldn't be selected upon respawning - this is a bug with selectweapon. My respawn script accounts for the selectWeapon bug with grenade launcher rifles and does a bunch of other neato things, but this shoud be OK for most maps.

Code: [Select]
#START
@!alive player
_magArray = magazines player
_weapArray = weapons player
@alive player
removeAllWeapons player
{player addMagazine _x} forEach _magArray
{player addWeapon _x} forEach _weapArray
player selectWeapon _primary
goto "START"
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Mr.BoDean

  • Guest
Re:Respawn with chosen weapon.
« Reply #8 on: 24 Jul 2003, 23:14:15 »
Here is a super-simple version of my weapons respawn script that would give a player the same weapons he had when he died upon respawning. THe only problem would be that if the player had a rifle with a grenade launcher, it wouldn't be selected upon respawning - this is a bug with selectweapon. My respawn script accounts for the selectWeapon bug with grenade launcher rifles and does a bunch of other neato things, but this shoud be OK for most maps.

Code: [Select]
#START
@!alive player
_magArray = magazines player
_weapArray = weapons player
@alive player
removeAllWeapons player
{player addMagazine _x} forEach _magArray
{player addWeapon _x} forEach _weapArray
player selectWeapon _primary
goto "START"

Ok, thanks, Toad!  

 2 Q's :  
1.) Would this be just a solo script that would need to be called from individual triggers for each player?  i.e., 8 triggers for each of P1 thru P8 set up as follows:

Trigger
Condition: !alive P1
On Activation: P1 exec "Weap.sqs"


Or could that be condensed somehow?

2.) Since you mentioned it, if the player happens to have a grenade-launching rifle, would they get the same rifle without grenades or would they get default?

Okay, I just re-read your Universal Weapons respawn script and  realized it is for 1.85 and may not work with my V.1.46.  But I also saw how you can list the players in Init.sqs .  Hmm.
« Last Edit: 24 Jul 2003, 23:28:38 by Mr.BoDean »

Mr.BoDean

  • Guest
Re:Respawn with chosen weapon.
« Reply #9 on: 25 Jul 2003, 11:01:10 »
hmm... got errors on this one. Tried modifying with:

_player = _this

and

 player = _this

and tried changing all of the player variables to _player


All errors. Let me guess, another 1.85 or above only script?  :-\     ::)

My only Resistance to converting to RESISTANCE is knowing how many buddies on GS don't have it and some don't even have PC's that can run it!   :-X   :o

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Respawn with chosen weapon.
« Reply #10 on: 25 Jul 2003, 11:17:30 »
Sorry dude. The "weapons" and "magazines" commmands are resistance commands, so even the condensed version that I posted won't work for you. Your only respawn option is predfined weapon loadouts, like the one posted by Terox.
« Last Edit: 25 Jul 2003, 11:18:00 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Mr.BoDean

  • Guest
Re:Respawn with chosen weapon.
« Reply #11 on: 25 Jul 2003, 11:41:03 »
Sorry dude. The "weapons" and "magazines" commmands are resistance commands, so even the condensed version that I posted won't work for you. Your only respawn option is predfined weapon loadouts, like the one posted by Terox.

In your best Fat Bastard accent: "Well, ain't that just a steamin' pile o' crap!"

Okay, well, I figured as much.    :-[  Bummer. Guess all those poor bastards I leave behind with 1.46 will have to suffer with an M16 and 1 clip till they can get safe!  ;D  

Thanks, toadster.   8)

Panther

  • Guest
Re:Respawn with chosen weapon.
« Reply #12 on: 25 Jul 2003, 14:04:49 »
I've got it all working but in the brieffing only the Group leader can pick the weapon for everyone.  ::)

Can enyone tell me how or if you can set it so that every group member set pick his own weapon ?   ???

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Respawn with chosen weapon.
« Reply #13 on: 25 Jul 2003, 23:05:49 »
Can't do that in the Briefing. Only the leader of a group can pick em in the briefing..and that includes resiatance...you could try splitting all of the players up into seperate groups and then joining them whenthe mission starts.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Panther

  • Guest
Re:Respawn with chosen weapon.
« Reply #14 on: 28 Jul 2003, 14:55:19 »
Good idea men THX  :D