Home   Help Search Login Register  

Author Topic: Weapons when respawning  (Read 3957 times)

0 Members and 1 Guest are viewing this topic.

StealthAssassin

  • Guest
Weapons when respawning
« on: 25 Feb 2003, 17:43:12 »
Hey everybody, long time no see eh? 8)

Anyways im making a WW2 multiplayer sector control map, and I have 2 problems.

1. When someone respawns after being killed, they respawn with either an M16 or AK47. I want to change this somehow, so that when someone respawns, they have the weapon they previously had e.g player 1 has an M1 Garand, and when he dies I want him to respawn with the M1 instead of with an M16.

2. Any idea how to change flags? When I take a flag under Axis side, the flag comes up as a russian one. I need to change this somehow...

Tips, links, flames, whatever will be greatly appreciated ;)

Cheers,

-StealthAssassin :P

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #1 on: 25 Feb 2003, 18:42:12 »
There is a respawn script I wrote in the ed depot. It's called the "Universal Weapons Respawn Script". This will do the trick for you.

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 Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Weapons when respawning
« Reply #2 on: 25 Feb 2003, 18:49:12 »
1). To make your players respawn, and spawn with a specific weapon loadout, you need to use something similar to the following script

This one's called "ReloadGuy" and its by "Deadmeat"

Quote
_unitid = _this select 0
_defaultid = _this select 1
_sideid = _this select 2
removeallweapons _unitid
?(_sideid == "west"):goto "WEST"
?(_sideid == "east"):goto "EAST"
hint format ["error with reload trigger for unit %1",_unitid]
exit
#WEST
?(_defaultid == "soldier"):goto "WSoldier"
?(_defaultid == "sniper"):goto "WSniper"
?(_defaultid == "BlackOp"):goto "WBlackOp"
?(_defaultid == "Officer"):goto "WOfficer"
?(_defaultid == "Medic"):goto "WMedic"
hint format ["%1 has an invalid type when running reloadguy.sqs",_unitid]
goto "EXIT"
#WSoldier
_unitid addmagazine "Pipebomb"
_unitid addmagazine "SmokeShell"
_unitid addmagazine "M4"
_unitid addmagazine "M4"
_unitid addmagazine "M4"
_unitid addmagazine "LAWLauncher"
_unitid addmagazine "LAWLauncher"
_unitid addweapon "LAWLauncher"
_unitid addweapon "XMS"
_unitid selectweapon "XMS"
_unitid addweapon "NVGoggles"
_unitid addweapon "binocular"
goto "EXIT"
#WSniper
_unitid addmagazine "SmokeShell"
_unitid addmagazine "M21"
_unitid addmagazine "M21"
_unitid addmagazine "M21"
_unitid addmagazine "LAWLauncher"
_unitid addmagazine "LAWLauncher"
_unitid addweapon "M21"
_unitid addweapon "LawLauncher"
_unitid addweapon "binocular"
_unitid addweapon "NVGoggles"
_unitid selectweapon "M21"
goto "EXIT"
#WMedic
_unitid addmagazine "SmokeShell"
_unitid addmagazine "M4"
_unitid addmagazine "M4"
_unitid addmagazine "M4"
_unitid addweapon "XMS"
_unitid selectweapon "XMS"
_unitid addweapon "binocular"
_unitid addweapon "NVGoggles"

goto "EXIT"
#WBlackOp
_unitid addweapon "NVGoggles"
_unitid addweapon "binocular"
_unitid addmagazine "Pipebomb"
_unitid addmagazine "SmokeShell"
_unitid addmagazine "M4"
_unitid addmagazine "M4"
_unitid addmagazine "M4"
_unitid addmagazine "SkorpionMag"
_unitid addmagazine "SkorpionMag"
_unitid addmagazine "SkorpionMag"
_unitid addmagazine "LawLauncher"
_unitid addmagazine "LawLauncher"
_unitid addweapon "Skorpion"
_unitid addweapon "LawLauncher"
_unitid addweapon "binocular"
_unitid addweapon "XMS"
_unitid selectweapon "XMS"
goto "EXIT"
#EAST
?(_defaultid == "soldier"):goto "ESoldier"
?(_defaultid == "AT"):goto "EAt"
?(_defaultid == "AA"):goto "EAa"
?(_defaultid == "sniper"):goto "ESniper"
?(_defaultid == "BlackOp"):goto "EBlackOp"
?(_defaultid == "Engineer"):goto "EEngineer"
?(_defaultid == "Officer"):goto "EOfficer"
exit
#ESoldier
_unitid addmagazine "SmokeShell"
_unitid addmagazine "GrenadeLauncher"
_unitid addmagazine "GrenadeLauncher"
_unitid addmagazine "GrenadeLauncher"
_unitid addmagazine "AK47"
_unitid addmagazine "AK47"
_unitid addmagazine "AK47"
_unitid addweapon "NVGoggles"
_unitid addweapon "AK47GrenadeLauncher"
_unitid selectweapon "AK47GrenadeLauncher"
goto "EXIT"
#EAt
_unitid addmagazine "SmokeShell"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "RPGLauncher"
_unitid addmagazine "RPGLauncher"
_unitid addmagazine "RPGLauncher"
_unitid addweapon "NVGoggles"
_unitid addweapon "RPGLauncher"
_unitid addweapon "Steyr"
_unitid selectweapon "Steyr"
goto "EXIT"
#EAa
_unitid addmagazine "SmokeShell"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SteyrMag"
_unitid addweapon "NVGoggles"
_unitid addmagazine "9K32Launcher"
_unitid addweapon "9K32Launcher"
_unitid addweapon "Steyr"
_unitid selectweapon "Steyr"
goto "EXIT"
#ESniper
_unitid addmagazine "SmokeShell"
_unitid addmagazine "SVDDragunov"
_unitid addmagazine "SVDDragunov"
_unitid addmagazine "SVDDragunov"
_unitid addmagazine "SVDDragunov"
_unitid addweapon "binocular"
_unitid addweapon "NVGoggles"
_unitid addweapon "SVDDragunov"
_unitid selectweapon "SVDDragunov"
goto "EXIT"
#EBlackOp
_unitid addmagazine "PipeBomb"
_unitid addmagazine "SmokeShell"
_unitid addmagazine "HandGrenade"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SteyrMag"
_unitid addmagazine "SkorpionMag"
_unitid addmagazine "SkorpionMag"
_unitid addmagazine "SkorpionMag"
_unitid addmagazine "RPGLauncher"
_unitid addweapon "Skorpion"
_unitid addweapon "RPGLauncher"
_unitid addweapon "NVGoggles"
_unitid addweapon "binocular"
_unitid addweapon "Steyr"
_unitid selectweapon "Steyr"
goto "EXIT"
#EOfficer
_unitid addmagazine "GrenadeLauncher"
_unitid addmagazine "GrenadeLauncher"
_unitid addmagazine "AK47"
_unitid addmagazine "AK47"
_unitid addmagazine "AK47"
_unitid addmagazine "FlareRed"
_unitid addmagazine "FlareRed"
_unitid addweapon "NVGoggles"
_unitid addweapon "binocular"
_unitid addweapon "AK47GrenadeLauncher"
_unitid selectweapon "AK47GrenadeLauncher"
goto "EXIT"
#EXIT
exit

For a soldier to activate the script, you need
A Trigger for each soldier
Quote
a==0
b==0
repeating

condition::>   alive A1
onActivation::>   [A1,"soldier","west"] exec "ReloadGuy.sqs"

where

 A1 is the name of the soldier unit you created
"soldier" is the "#Wsoldier" loadout in "reloadguy", and "west" is the side

You can of course customise the loadouts for each soldier type



What the script and trigger actually says is

When player A1of class "soldier" is alive, load him with the west weapons loadout for #Wsoldier
-----------------------------------------------------------------------------------------------------------------------

To change your flag. you need to change the line that states the flag texture

Quote
FlagE setflagtexture "rus_vlajka.pac"

I presume you want to show a nazi flag

so create one in jpg format and then save it in your mission folder then use the following line
Quote
FlagE setflagtexture "nazi.jpg"


the setflagtexture statement i use is within a script,  if its in a trigger it may vary slightly

My East flag i call FlagE, yours may be called something different
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #3 on: 25 Feb 2003, 19:44:34 »
Terox, you should look at my respawn script. It's much more powerfull (a WAAAAAY smaller ;)) than that one by DeadMeat.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Weapons when respawning
« Reply #4 on: 26 Feb 2003, 18:05:09 »
I checked your script out

Yes its good if you want
1) The guy to respawn with the same weapons he started with
2) The same wepons he died with


I use deadmeats to create a loadout for soldiers, with yours i would have to add every weapon and ammo to every soldier in their init field

As the maps i create are for 40 players on average, this is a big task and time consuming.

I use a similar slightly more complicated system than deadmeats and have templates for the various laddon weapon loadouts that the servers i create them for support.

If i create some maps where i dont want to use a defined loadout then i will use your script   thanks!!
« Last Edit: 26 Feb 2003, 18:13:02 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

StealthAssassin

  • Guest
Re:Weapons when respawning
« Reply #5 on: 26 Feb 2003, 21:54:09 »
Thanks for the help with the respawn guys, but can you help me out with the flags now? Im dieing to get some WW2 Flags somewhere, and to put them in-game

Cheers  ;)

Pope_Zog

  • Guest
Re:Weapons when respawning
« Reply #6 on: 27 Feb 2003, 13:15:35 »
Wüstenfuchs made a flag pack that has some WWII flags. However the Nazi flags don't portrey the swastica because German law - based on article 18 in their constitution - forbids it. (I assume Wüstenfuchs is German.) Instead the flags have got a home-made symbol. They're good though :)

Pope Zog

Akodo

  • Guest
Re:Weapons when respawning
« Reply #7 on: 03 Mar 2003, 17:11:01 »
Toadlife:

I've been using your weapon respawn script for awhile now..

single player and 2 player multi, it works fine...but as soon as we throw a couple of extra players into the mix, it doesn't like to repawn the weapons any more.

Any Tips for getting it to work with more than 2 players?


Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #8 on: 03 Mar 2003, 18:54:41 »
I dunno. I made it for a coop map of mine which has 12 player slots and have tested it with 12 players, and have never had any problems. In very rare cases extreme lag has screwed it up, but lag screws everything up.

How are you initializing each script?


The way I did it was to start them in the top of the init.sqs file like so...

["player1",1] exec "weapons_respawn.xsqs"
["player2",1] exec "weapons_respawn.xsqs"
["player3",1] exec "weapons_respawn.xsqs"
...
...
...



"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Nasty Buttler

  • Guest
Re:Weapons when respawning
« Reply #9 on: 03 Mar 2003, 23:31:03 »
also note toadlife, my script was around yonks before yours was....so cut the script some slack mate.....

by the way guys im re-working some scripts on my webpage, check them out

www.backoff.ch/ofp

its BDP
Backoff DeaDMeaT Productions
hell i sent a message to BIS about not being able to select a weapon....and guess what, they released selectweapon.....
so now that the measuring has end, your script is good toadlife, but it doesnt do what alot of people want, ie most people want to create CTF, C&H Domination, etc style maps case there isnt aa hell of a lot of depth that needs to be taken to account.....

they are equally as good as each other, dont sledge peoples work, especially when they have been around ALOT longer than yourself.....  :D

have a nice day

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #10 on: 04 Mar 2003, 00:36:45 »
also note toadlife, my script was around yonks before yours was....so cut the script some slack mate.....

by the way guys im re-working some scripts on my webpage, check them out

www.backoff.ch/ofp

its BDP
Backoff DeaDMeaT Productions
hell i sent a message to BIS about not being able to select a weapon....and guess what, they released selectweapon.....
so now that the measuring has end, your script is good toadlife, but it doesnt do what alot of people want, ie most people want to create CTF, C&H Domination, etc style maps case there isnt aa hell of a lot of depth that needs to be taken to account.....

they are equally as good as each other, dont sledge peoples work, especially when they have been around ALOT longer than yourself.....  :D

have a nice day

First of all: Whats with the hostility?

Second of all: NM. I see.

Third of all:My purpose here wasn't  to slam the script or say that it sucks, it was to convey my opinion that my script is better for StealthAssassin's particular purpose. Terox replied with reasons why he wouldn't use mine, and in case you didn't notice, I didn't start arguing with him over it, because his reasons had some merit.

And finally: What's with the irrelevant (and untrue) comment about me not being around very long? If you're looking for a pissing contest, I'm not interested.

Yours annoyed,

- toadlife
« Last Edit: 04 Mar 2003, 00:51:24 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Weapons when respawning
« Reply #11 on: 04 Mar 2003, 08:39:39 »
Fight fight fight....  :o

Nah, but seriously.. Take it to the IM guys..  :-X

I'm sure you both have equal sized cocks  ;) :D
Not all is lost.

Akodo

  • Guest
Re:Weapons when respawning
« Reply #12 on: 04 Mar 2003, 11:16:18 »
I'm placing it in the units initialization field

man1
INITILIZATION : ["man1",0] exec "weapreset.sqs

man2
INITILIZATION: ["man2",0] exec "weapreset.sqs"

man3
INITILIZATION: ["man3",0] exec "weapreset.sqs"

ect ect ect

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #13 on: 04 Mar 2003, 18:43:47 »
ok very strange thta your hvaing problems. That should work.  Wanna either post your mission or send it to me so I can have a look?
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Akodo

  • Guest
Re:Weapons when respawning
« Reply #14 on: 06 Mar 2003, 04:34:19 »
ok seems to work alright, if you call the script for each player from the init.sqs.

Only problem I am having doing it this way that is you need to either switch to your hand gun, or use your bino's before you can fire or zoom with your weapons.

I have only found this happening with BAS delta and ranger addons though...so it might be an issue with the addon, not the script.


Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #15 on: 06 Mar 2003, 05:17:20 »
Do you have the latest version of the script? The latest version makes the player select their primary weapon (rifle) after respawning.

I updated the script in the ed depot soon after I first submitted it.

If you have the latest version then, perhaps the script needs to be tweaked a little.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Akodo

  • Guest
Re:Weapons when respawning
« Reply #16 on: 06 Mar 2003, 16:06:03 »
this is the version I am using..i'm not sure if it is the latest or not..


Quote
;Universal Weapons Respawn Script v1.02 (December 4, 2002)
;Required Version: 1.85
;by toadlife and Hamdinger
;toadlife@toadlife.net
;intialize like this: ["unitname",0] exec "thisscript.sqs"
;            Or this: ["unitname",1] exec "thisscript.sqs"
;
; * "unitname" = The name of the player the script runs on (must be enclosed by quotes!)
; * 0/1 = method of repleneshing weapons
;  **if method is 0, the player gets the same weapons he stated out with every time
;  **if method is 1, the player gets the same weapons he had when he died

requiredVersion "1.85"
_name = _this select 0
_method = _this select 1

_unit = call format["%1",_name]
?(_method  == 0):_guns = weapons _unit;_mags = magazines _unit;_guncount = count weapons _unit;_magcount = count magazines _unit

#checklocal
_unit = call format["%1",_name]
?local _unit:goto "respawnloop"
~(1 + (random 3))
goto "checklocal"

#respawnloop
@!alive _unit
?(_method  == 1):_guns = weapons _unit;_mags = magazines _unit;_guncount = count weapons _unit;_magcount = count magazines _unit
@alive call format["%1",_name]
_unit = call format["%1",_name]
_unit removemagazines (magazines _unit select 0)
_unit removeweapon (weapons _unit select 0)
_c = 0
while "_c <= (_magcount - 1)" do {_unit addmagazine (_mags select _c); _c = _c + 1}
_c = 0
while "_c <= (_guncount - 1)" do {_unit addweapon (_guns select _c); _c = _c + 1}
@weapons _unit select 0 == (_guns select 0)
_unit selectweapon primaryweapon _unit
goto "respawnloop"



Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Weapons when respawning
« Reply #17 on: 06 Mar 2003, 22:55:54 »
Yeah you have the latest version. THis MAY be a bug with the BAS units. I'll check it out. I've only used it with official units.

It should work...see these lines:

;; wait until unit has his rifle
@weapons _unit select 0 == (_guns select 0)
;; make unit select his rifle.
_unit selectweapon primaryweapon _unit

primaryweapon _unit is allways a rifle, the line below should make the unit slect his rifle. I may be able improve it a bit though.

THanks for the feedback
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.