Home   Help Search Login Register  

Author Topic: addWeaponPool???  (Read 2619 times)

0 Members and 1 Guest are viewing this topic.

sgtGunneryHighway

  • Guest
addWeaponPool???
« on: 16 Oct 2002, 23:04:45 »
how that command must be use?
it is in the endmission trigger or in description file or init or what??? ???
if someone knows please post:help:
« Last Edit: 16 Oct 2002, 23:43:13 by sgtGunneryHighway »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:addWeaponPool???
« Reply #1 on: 17 Oct 2002, 00:43:07 »
From what I've heard (I've never tried this myself) it's used in a script called exit.sqs which is automatically executed at the end of any mission.

The Official Comref lists the syntax as something like:

addWeaponPool ["m16",2]

Which adds 2 m16's to your weapon pool. Just note this is only useful in a campaign, and has no use as far as single missions go.

[edit][size=0.5]
* Sui slaps the syntax round a bit[/sub][/size][/edit]
« Last Edit: 17 Oct 2002, 00:47:52 by Sui »

sgtGunneryHighway

  • Guest
Re:addWeaponPool???
« Reply #2 on: 17 Oct 2002, 00:55:11 »
yeah tnx  :D
but i wanna know one more thing
in the mission how do you know what gunz the player gonna take with him and how much magazine at the end of the mission? :noo:

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:addWeaponPool???
« Reply #3 on: 17 Oct 2002, 00:56:26 »
so - how, like in resistance, does that command check what weapons the player had at the end of the mission (the one he has in his hands)

i need this cos i have  3 part mission and i want to only let the player have the weapons he chose at the start / has picked up in the mission.

cheers.
Proud Member of the Volunteer Commando Battalion

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addWeaponPool???
« Reply #4 on: 17 Oct 2002, 03:14:29 »
Are you looking for this one?

Code: [Select]
fillWeaponsFromPool person
Operand types:
    person: Object
Compatibility:
    Version 1.75 required.
Type of returned value:
    None
Description:
    Add magazines from campaign pool to person (depending on weapons person have).

Example:
    fillWeaponsFromPool victor


 :o huh

Just seen, that you are asking for the other way.
hmm couldn't find that inside the official comref after
scrolling thru twice.
I'll have a look into Resistance campaign, when i'm back
home from work.

~S~ CD
« Last Edit: 17 Oct 2002, 03:22:01 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addWeaponPool???
« Reply #5 on: 17 Oct 2002, 05:58:49 »
OK, after examining ofp_resistance campaign (mission 03)
i found following inside exit.sqs (this script will be executed
automatically when the mission is finished).

Code: [Select]
; Player's weapons to weapon pool

_i = 0;

#LPWeap

addWeaponPool [((weapons aP) select _i), 1];
_i = _i + 1;
? _i < (count weapons aP) : goto "LPWeap"

_i = 0;

#LPMag

addMagazinePool [((magazines aP) select _i), 1];
_i = _i + 1;
? _i < (count magazines aP) : goto "LPMag"

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:addWeaponPool???
« Reply #6 on: 17 Oct 2002, 18:43:44 »
so - the first one is what you write in the init.sqs of the mission and the second one is what you write in the exit.sqs of a mission...

yeah?
Proud Member of the Volunteer Commando Battalion

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addWeaponPool???
« Reply #7 on: 17 Oct 2002, 21:37:45 »
Quote
so - the first one is what you write in the init.sqs of the mission and the second one is what you write in the exit.sqs of a mission...

yeah?

BIS is doing it this way, so i think we can say: YEAH  ;D

I haven't tried out that yet, but i think if you save the status
of your units at the end of a mission, and you load it up in init.sqs of the next mission, then the fillweaponsfrompool
recognizes automatically, what to give whom.

This is a part of an init.sqs from the resistance campaign:

Code: [Select]
#Rest

_gr = [s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10];
_h = count _gr;
_u = GLB_03b_NUMBER;
_v = 0;

#LOOP2
? _v >= _u : goto "Out";
xx = (_gr select _v) loadStatus format ["03bSold%1", (_v)];
fillWeaponsFromPool (_gr select _v)
_JN = _JN + [(_gr select _v)];
(_gr select _v) setskill ((skill (_gr select _v)) + 0.2)
_v = _v+1;
goto "LOOP2"

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

david-p

  • Guest
Re:addWeaponPool???
« Reply #8 on: 18 Oct 2002, 00:13:56 »
u just gotta love those guys.. :-*

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:addWeaponPool???
« Reply #9 on: 18 Oct 2002, 00:40:31 »
hmmm - now that confuses me - i see how it works but could you please post the section that follows:

#out

so i can see how BIS end the init.sqs.

cheers.
Proud Member of the Volunteer Commando Battalion

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addWeaponPool???
« Reply #10 on: 18 Oct 2002, 00:57:27 »
OK, i'll post the whole init.sqs for ya, when i'm back home
from work.

Just gimmie 6 more hours and it'll be there  ;)

Also i will post the whole exit.sqs from the previous mission of
this init.sqs.

:edit

btw - i think it's more the part before this loop instead of
the #out part. The
Code: [Select]
goto "out" is just there
to exit this loop. Anyway i'll post that all - later then.

~S~ CD
« Last Edit: 18 Oct 2002, 01:02:11 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:addWeaponPool???
« Reply #11 on: 18 Oct 2002, 01:07:56 »
thats what i thought - i think the "out" just sends the script to:

Code: [Select]
#out

and thats it - as soon as it gets to the end it exits - just want to check that BIS didnt add anything else important.

cheers.
Proud Member of the Volunteer Commando Battalion

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addWeaponPool???
« Reply #12 on: 18 Oct 2002, 07:55:22 »
OK, here's the whole exit.sqs from mission03a of resistance
campaign:

Quote
; exit script

; Saving player's status
; aa = aP saveStatus "03bPlayer";
; Player will not be saved - new mission is later


; Player's weapons to weapon pool

_i = 0;

#LPWeap

addWeaponPool [((weapons aP) select _i), 1];
_i = _i + 1;
? _i < (count weapons aP) : goto "LPWeap"

_i = 0;

#LPMag

addMagazinePool [((magazines aP) select _i), 1];
_i = _i + 1;
? _i < (count magazines aP) : goto "LPMag"


; Truck alive?

xx = deleteStatus "03bTruck";
GLB_03b_TRUCK = false;
? canmove Truck : GLB_03b_TRUCK = true; xx = Truck saveStatus "03bTruck";
SaveVar "GLB_03b_TRUCK";


; Saving soldiers - player's group

GLB_03b_HOWMANY = 0;
_grp = [p1, p2, p3, p4, p5]
? count _grp == 5 : GLB_03b_HOWMANY = 1;
? count _grp < 5 : GLB_03b_HOWMANY = 2;
saveVar "GLB_03b_HOWMANY";

; Special soldiers
? alive aMed : GLB_03b_MED = true; saveVar "GLB_03b_MED"; xx = aMed saveStatus "03bMedic";


; ------- Player's group ---------

_i = count _grp;
_j = 0;
_k = 0;
_Mis = "03b";
_Out = [aMed, aP]

#LOOP
? _j >= _i : goto "Next"

? (_grp select _j) in _Out : goto "SKIP"
? alive (_grp select _j) : xx = (_grp select _j) saveStatus _Mis + (format ["Sold%1", _k]); _k = _k+1;

#SKIP
_j = _j + 1;
goto "LOOP"

#Next
GLB_03b_NUMBER = _k; saveVar "GLB_03b_NUMBER";


; ================== WEAPON POOL ====================

AddWeaponPool ["AK47CZ", 4];
AddMagazinePool ["AK47", 40];
AddMagazinePool ["HandGrenade", 20];

pickWeaponPool Truck;
clearWeaponCargo Truck;
clearMagazineCargo Truck;


; ------------- END -------------

exit
; for now ! we will try to solve problem with weapon pool by other way


; Group

_whoW = 0;

#BACKWEAP

_whatW = 0;

? _whoW == (count units group aP) : goto "EndWeap"
_man = (units group aP) select _whoW;

#INTERWEAP

? _whatW == (count weapons _man) : goto "EndInterW"


_whatW = _whatW + 1;

#ENDINTERW

_whoW = _whoW + 1;




#ENDWEAP

And here is the init.sqs of mission04:

Quote
titleCut ["","BLACK IN", 3]
;setViewDistance 1200
"2" objStatus "Hidden"


; ==================================================================

; Global variables

_JN = [];

? GLB_03b_HOWMANY == GLB_03b_HOWMANY : goto "Defined"

; NOT DEFINED
; ===========

? CheatsEnabled : Hint "DEBUG:\nNot defined - initializing"
; DESIGNER VERSION ONLY

GLB_03b_HOWMANY = random 3;
GLB_03b_MED = true;
GLB_03b_NUMBER = 4;
GLB_03b_TRUCK = true;

#Defined

; Truck
add
Truck setPos getMarkerPos "TruckPos";
? not GLB_03b_TRUCK : deleteVehicle Truck

; WEAPON POOL

addWeaponPool ["RPGLauncher", 2];
addMagazinePool ["RPGLauncher", 6];

;clearMagazineCargo Bedna;
;clearWeaponCargo Bedna;

; Special soldiers with their own variables:

_hlp = [aMed, GLB_03b_MED, "03bMedic"];
_i = count _hlp;
_j = 0;

#LOOPSpec
? _j >= _i : goto "Rest";

_man = (_hlp select _j);
? (_hlp select (_j+1)) : _JN = _JN + [_man]; xx = _man loadStatus (_hlp select (_j+2)); _man setSkill ((skill _man)+0.2); _j = _j + 3; goto "LOOPSpec";

deleteVehicle (_hlp select _j);
_j = _j + 3;
goto "LOOPSpec";


; Normal soldiers

#Rest

_gr = [s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10];
_h = count _gr;
_u = GLB_03b_NUMBER;
_v = 0;

#LOOP2
? _v >= _u : goto "Out";
xx = (_gr select _v) loadStatus format ["03bSold%1", (_v)];
fillWeaponsFromPool (_gr select _v)
_JN = _JN + [(_gr select _v)];
(_gr select _v) setskill ((skill (_gr select _v)) + 0.2)
_v = _v+1;
goto "LOOP2"

#Out
? _v >= _h : goto "Reinf";
deleteVehicle (_gr select _v);
_v = _v + 1;
goto "Out";


#Reinf

; REINFORCEMENTS
? GLB_03b_HOWMANY >= 1 : _JN = _JN + [NSol1]; goto "Sol2";

deleteVehicle NSol1;
#Sol2


? GLB_03b_HOWMANY >= 2 : _JN = _JN + [NSol2]; goto "Final";
deleteVehicle NSol2;

#Final

_JN join group aP;
"_x setdammage 0" forEach units group aP;

:note - i didn't check, if mission03 is really followed by mission04, but i think this way you can get a better
overview now.

~S~
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:addWeaponPool???
« Reply #13 on: 20 Oct 2002, 23:23:36 »
Code: [Select]
#Rest

_gr = [s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10];
_h = count _gr;
_u = GLB_03b_NUMBER;
_v = 0;

#LOOP2
? _v >= _u : goto "Out";
xx = (_gr select _v) loadStatus format ["03bSold%1", (_v)];
fillWeaponsFromPool (_gr select _v)
_JN = _JN + [(_gr select _v)];
(_gr select _v) setskill ((skill (_gr select _v)) + 0.2)
_v = _v+1;
goto "LOOP2"

added that to my init.sqs - made ofp crash...

can some1 give me a working example (without all the BIS extras that scare me) that just adds the weapons from pool

cheers.
Proud Member of the Volunteer Commando Battalion

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addWeaponPool???
« Reply #14 on: 20 Oct 2002, 23:55:19 »
Messiah,

off course i didn't post all the other files in here (description.ext, etc.) - lol tiger or wolf wouldn't have been
very apreciated about that  ;D

I'd suggest you to depbo the resistance campaign, and
examine it for yourself. This way, you will get the best
overview, instead of me posting all these files.

I think, resistance campaign is a working example (hey it's
made by BIS, and they should know what to do).  8)

I still haven't used the weapon pool by myself, so i can't really
post you all the required informations here.  :-[

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted