OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: StealthAssassin 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
-
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
-
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"
_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
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
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
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
-
Terox, you should look at my respawn script. It's much more powerfull (a WAAAAAY smaller ;)) than that one by DeadMeat.
-
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!!
-
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 ;)
-
Wüstenfuchs made a flag pack (http://ftp://www.gamezone.cz/ofpd/unofaddons/WF_Flagpack1.0.zip) 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
-
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?
-
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"
...
...
...
-
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
-
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
-
Fight fight fight.... :o
Nah, but seriously.. Take it to the IM guys.. :-X
I'm sure you both have equal sized cocks ;) :D
-
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
-
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?
-
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.
-
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.
-
this is the version I am using..i'm not sure if it is the latest or not..
;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"
-
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