Jump to content
Sign in to follow this  
MeinHerzBrennt

Help on a couple of things please

Recommended Posts

I dont have much knowledge of scripting at all so please walk me through this step by step. I Know how to do 2 things: Respawn Player At Basewhen they die in multiplayer, and make an anti-personnel mine using camcreate. However, when someone respawns they only have their factions standard assualt rifle and one magazine (M16 or AK74) even if they were a sniper or some other specialty unit. Is there a way to fix this? Also I would appreciate it if you could tell me how to have vechiles respawn after they are destroyed.

Thanks in advance.

Share this post


Link to post
Share on other sites

Toadlife 's Universal Weapons Respawn Script 1.04 script is very good for that, i used it and had no problem.

It was on OFPEC, but they have not put back their precious and highly usefull editor depot yet.

So here is what i have :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;Universal Weapons Respawn Script v1.04 (March 31, 2003)

;Required Version: 1.85

;by toadlife

;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 started out with every time

; **if method is 1, the player gets the same weapons he had when he died

;

; Advanced example method of initializing script - put the following lines in your init.sqs,

; and replce the unit names with your own:

;_units = ["w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18"]

;{[_x,0] exec {weapons_respawn.xsqs}} foreach _units

;

;

~(random 0.3)

requiredVersion "1.85"

_name = _this select 0

_method = _this select 1

_hasrifle = false

_unit = call format["%1",_name]

?_method == 0:_return = "checklocal";goto "guncheck"

#checklocal

_unit = call format["%1",_name]

?local _unit:goto "respawnloop"

~(1 + (random 3))

goto "checklocal"

#respawnloop

@!alive _unit

#checkmethod

?_method == 1:_return = "waitforlife";goto "guncheck"

#waitforlife

@alive call format["%1",_name]

_unit = call format["%1",_name]

_unit removemagazine (magazines _unit select 0)

_unit removeweapon (weapons _unit select 0)

"_unit addmagazine _x" foreach _mags

?_hasrifle:_guns = _guns - [_prigun];_guncount = count _guns

_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}

?_hasrifle:_unit addweapon _prigun;_gun = _guns + [_prigun]

;//If unit has a rifle select it

?_hasrifle:goto "selectrifle"

;//No rifle - if unit has a pistol, select it

?_unit hasweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0):_unit selectweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0);goto "respawnloop"

;//No rifle or pistol, select secondary weapon

_unit selectweapon secondaryweapon _unit

goto "respawnloop"

#selectrifle

;// BUG WORKAROUND! - Added to compensate for selectweapon bug

;// Any gun with more than one muzzle (grenadelaunchers) cannot be selected with selectweapon!

;// Default Grenadelaunchers supported - Add your own types if you need to.

_unit selectweapon _prigun

?_prigun == "M16GrenadeLauncher":_unit selectweapon "M16Muzzle"

?_prigun == "Ak74GrenadeLauncher":_unit selectweapon "AK74Muzzle"

?_prigun == "Ak47GrenadeLauncher":_unit selectweapon "AK47Muzzle"

goto "respawnloop"

#guncheck

_guns = weapons _unit

_mags = magazines _unit

~(random 0.5)

_guncount = count _guns

_magcount = count _mags

?_unit hasweapon (primaryweapon _unit):_hasrifle = true;_prigun = primaryweapon _unit;goto _return

_hasrifle = false

goto _return

Share this post


Link to post
Share on other sites

No, it is a script

Just create a text file, copy paste what is up there inside of it.

Rename this text file , by example

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">weaponrsp.sqs

Put the weaponrsp.sqs file in the folder that is your mission.

And , in each init line of the unit that are set to "Playable" in your mission, put

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["unitname",0] exec "weaponrsp.sqs"

or

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["unitname",1] exec "weaponrsp.sqs"

according to the method you want to use (read the comment of the script to see which one you prefer)

unitname is the name of the unit for which you add this in the init line of course.

So if you have a playable unit named Bob , you will use in Bob's init line :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["Bob",1] exec "weaponrsp.sqs"

etc,etc...

Share this post


Link to post
Share on other sites

Moving to mission editing, please look around to ensure you post in the right place smile_o.gif

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  

×