Home   Help Search Login Register  

Author Topic: geting ww2 players to respwan with the right weapons.  (Read 3859 times)

0 Members and 2 Guests are viewing this topic.

DoomedSoldier

  • Guest
well im still not geting anything to work.  i get this

'"u1"|#|= call format["","u1"]': error unknown operator.
and im using this thing

~(random 0.3)
requiredVersion "1.85"
"u1" = _this select 0
_method = _this select 1
_hasrifle = false
"u1"= call format["%1","u1"]
?_method == 0:_return = "checklocal";goto "guncheck"

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

#respawnloop
@!alive "u1"
#checkmethod
?_method == 1:_return = "waitforlife";goto "guncheck"

#waitforlife
@alive call format["%1","u1"]
"u1" = call format["%1","u1"]
"u1" removemagazine (magazines "u1" select 0)
"u1" removeweapon (weapons "u1" select 0)
""u1" addmagazine _x" foreach _mags
?_hasrifle:_guns = _guns - [_prigun];_guncount = count _guns
_c = 0
while "_c <= (_magcount - 1)" do {"u1" addmagazine (_mags select _c); _c = _c + 1}
_c = 0
while "_c <= (_guncount - 1)" do {"u1" addweapon (_guns select _c); _c = _c + 1}
?_hasrifle:"u1" addweapon _prigun;_gun = _guns + [_prigun]
;//If unit has a rifle select it
?_hasrifle:goto "selectrifle"

;//No rifle - if unit has a pistol, select it
?"u1" hasweapon ((weapons "u1" - [secondaryweapon "u1","Binocular","NVGoggles"]) select 0):"u1" selectweapon ((weapons "u1" - [secondaryweapon "u1","Binocular","NVGoggles"]) select 0);goto "respawnloop"

;//No rifle or pistol, select secondary weapon
"u1" selectweapon secondaryweapon "u1"
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.
"u1" selectweapon _prigun
?_prigun == "M16GrenadeLauncher":"u1" selectweapon "M16Muzzle"
?_prigun == "Ak74GrenadeLauncher":"u1" selectweapon "AK74Muzzle"
?_prigun == "Ak47GrenadeLauncher": "u1"selectweapon "AK47Muzzle"
goto "respawnloop"


#guncheck
_guns = weapons "u1"
_mags = magazines "u1"
~(random 0.5)
_guncount = count _guns
_magcount = count _mags
?"u1" hasweapon (primaryweapon "u1"):_hasrifle = true;_prigun = primaryweapon "u1";goto _return
_hasrifle = false
goto _return

again plz help.
Doomedsoldier

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:geting ww2 players to respwan with the right weapons.
« Reply #1 on: 02 Apr 2003, 03:26:28 »
'"u1"|#|= call format["","u1"]': error unknown operator.


It's one of these three things...

You're inisialising the script wrong
Don't have 1.85 or above
I uploaded a bugged script.

I'll get back to you on the third one.

"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:geting ww2 players to respwan with the right weapons.
« Reply #2 on: 02 Apr 2003, 03:31:04 »
BTW...you didn't modify the script did you? Modifying the script renders the  warrantee invalid.  :P
"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:geting ww2 players to respwan with the right weapons.
« Reply #3 on: 02 Apr 2003, 04:12:57 »
I downloaded it and tested it just to make sure...it works fine.

Either you are using it wrong, or you don't have version 1.85 or above.

If you have 1.85, then look at the comments at the top of the script and follow the directions. If you still have trouble then....
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #4 on: 02 Apr 2003, 05:25:14 »
i have 1.91v and i think i put it in wrong.  i read how to do it all its doing is confusing me.

this is messing me over. (intialize like this: ["unitname",0]

also
 (; * "unitname" = The name of the player the script runs on (must be enclosed by quotes!)

so you are saying everywhere it has '_name' i change it to what i have the name of the player. like bob or something. plus i was wondering because i dont see any thing in there that says unitname. there is _unit or _name.
there are a few places where i see it, its at the beginning.

this also messed me over lol.

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

so i have to put w1 or w2, or if the units name is Bob i put Bob everytime i see _units
thanks for your time. im so new at this. and God bless ya bro.

Tactician

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #5 on: 02 Apr 2003, 06:11:55 »
Here's the problem.

The error code is: '"u1"|#|= call format["","u1"]': error unknown operator.  This is because you can't use a string where an object goes.  In other words, you can't declare "myName" = "Matt" because "myName" is not a variable.  You would have to use myName = "Matt", as myName is a valid variable name.  But this is all sort of besides the point.

Trash the modified script you made.  Now redownload the universal weapons respawn script and place it in your mission folder like the last one.  The important part is that you don't need to modify the script at all.  Instead, the script takes "u1" as a "parameter" and assigns it to the variable _name, which can be referred to later in the script.

You want the soldier named u1 to respawn with weapons, right?  Make an init.sqs (if you don't already have one) and add this line:

Code: [Select]
["u1",0] exec "weapons_respawn.xsqs"
This will send "u1" to the script as it's activated, so the script will see "u1" every time _name is used.

Now if, for example, you have three soldiers needing the script named u1, u2, and u3, you could do something like this:

Code: [Select]
_units = ["u1","u2","u3"]
{[_x,0] exec "weapons_respawn.xsqs"} forEach _units

And you just add more names to the _units array to suit all the soldiers that need the script active.

I hope that helps you understand how portable scripts work.  Let us know if you need more instruction :)
« Last Edit: 02 Apr 2003, 06:13:13 by Tactician »

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #6 on: 03 Apr 2003, 01:39:16 »
i got something saying it cant find this

weapons_respawn.xsqs

and thanks for helping me.

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #7 on: 03 Apr 2003, 01:49:13 »
what does this mean

'scalar |#|bool arry string oxfcffffef':error unknown operator bool

Tactician

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #8 on: 03 Apr 2003, 03:21:03 »
If it can't find weapons_respawn.xsqs, then it's named incorrectly or you didn't put it in the right place.  You want it in OperationFlashpoint/Users/YourName/Missions/MissionName.isle.  I promise it will work if you put it in the right place.

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #9 on: 03 Apr 2003, 03:23:47 »
;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
;
;

_units = ["w1","w2","w3","w4","w5","w6","w7","w8","w9"]
{[_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

that is what i have in my thing.

Tactician

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #10 on: 03 Apr 2003, 03:25:26 »
Code: [Select]
_units = ["w1","w2","w3","w4","w5","w6","w7","w8","w9"]
{[_x,0] exec "weapons_respawn.xsqs"} forEach _units

Remove those lines and put them in init.sqs, as originally instructed, and it will work.  As I said you don't need to modify toad's script at all.
« Last Edit: 03 Apr 2003, 03:25:54 by Tactician »

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #11 on: 03 Apr 2003, 03:32:28 »
what is init. and what do i name the script

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #12 on: 03 Apr 2003, 03:33:47 »
can we talk over a messager like msn or aol or yahoo or something.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:geting ww2 players to respwan with the right weapons.
« Reply #13 on: 03 Apr 2003, 04:47:12 »
OI!!! :-X :-X :-X :-\ :-\ :-\
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #14 on: 03 Apr 2003, 04:50:45 »
im new to scripting lol. and i have icq also.  ok can you tell me how to make init.sqs. so i can get this darn thing to work. you tell me not to add anything to the toadlifes script. then how do i get to work. YES IM A NEWB at this. :o

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:geting ww2 players to respwan with the right weapons.
« Reply #15 on: 03 Apr 2003, 05:44:11 »
The init.sqs file is a plain old OFP script file that the game automatically executes when a mission is loaded.

To make an init.sqs file, open your text editor add whatever lines you want and save it in your mission directory as "init.sqs". When you save the file, put quotes around the name of the file, or notepad might save it as "init.sqs.txt".

Check out here for some simple tutorials. Snypir's "intro to snippets" is a good one for you.

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

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #16 on: 03 Apr 2003, 05:45:51 »
can you give me the steps on what to do after downloading it. all im geting is confused lol. do i save it to notepad or what.  i have this one thing called
Chris's OFP Script Editor.  then what do i name it after i save it.  also how do i init.sqs the thing because i have no clue.   :'(  :'(  :'(

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #17 on: 03 Apr 2003, 06:44:55 »
hey i gots it lol thanks all that helped me. now how do i get the tanks to respawn.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:geting ww2 players to respwan with the right weapons.
« Reply #18 on: 03 Apr 2003, 09:10:51 »
There are vehicle respawn scripts in the ed depot
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

DoomedSoldier

  • Guest
Re:geting ww2 players to respwan with the right weapons.
« Reply #19 on: 04 Apr 2003, 07:20:36 »
do you have a specific on that makes world war 2 tanks respawned and stuff. i havnt really been able to find anything. but im going to try and add like anti-tanks guns the flak 88 guns if i can and have them respawn. once i get it done i hope it will be a cool map. to play. thanks again so much for you help i hope you can still help me with my newb questions  ;D