Jump to content
Sign in to follow this  
456820

Campaign weapon pool

Recommended Posts

hey

does anyone know how to use the weapon pool in campaign's

ive looked in the com ref but it didnt really say how to use it just what it does

Share this post


Link to post
Share on other sites

You can take a look at my weaponpool tutorial; basically it takes care of saving variables and player's status and of course the weapon pool for the next mission.

My Tutorial at OFPEC

Share this post


Link to post
Share on other sites

hey vektorboson, I've been working with your tutorial for a couple weeks now, putting together an insurgency campaign. Many thanks for making it, I'd have no chance without it.

I've been having some small problems though. I think I've got the weaponpool working out (thanks to you), but my dead squadmates (sometimes) come back in the following mission. And sometimes I or one of my mates will begin a mission injured, even if we hadn't seen any combat the previous mission. Any idea why this would happen?

again, thanks for putting up that tutorial. Hopefully I'll have a campaign up sometime soon.

Share this post


Link to post
Share on other sites
but my dead squadmates (sometimes) come back in the following mission.  And sometimes I or one of my mates will begin a mission injured, even if we hadn't seen any combat the previous mission.  Any idea why this would happen?

You could post your init.sqs and exit.sqs; and then I'd need to know what the condition of presence (in the unit dialog in the mission editor) of your units is.

Basically it is possible that you load/save the wrong status/variables or a status from a previous mission.

Share this post


Link to post
Share on other sites

ok, here is the exit.sqs for mission 1, and the init.sqs for mission 2:

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

; exit.sqs

; Soldaten werden abgespeichert

_grp = group player

_units = units _grp

_count = count _units

_i = 1

#loop

_unit = _units select _i

xx = _unit saveStatus format["Soldat%1", _i]

_i = _i + 1

?(_i < _count): goto "loop"

SOLDIERS_ALIVE = _count

saveVar "SOLDIERS_ALIVE"

xx = player saveStatus "MYPLAYER"

; Waffenpool wird gefüllt

TRUCK_ALIVE = FALSE

?(alive objTruck): pickWeaponPool objTruck; clearWeaponCargo objTruck; clearMagazineCargo objTruck; TRUCK_ALIVE = TRUE; xx = objTruck saveStatus "TRUCK_STATUS"

saveVar "TRUCK_ALIVE"

and...

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

; init.sqs

titleCut ["","BLACK IN", 3]

; Soldaten wiederherstellen

knownUnits = preprocessFile "knownUnits.sqf"

findUnits = preprocessFile "findUnits.sqf"

_count = SOLDIERS_ALIVE

_soldiers = [s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10, s_11]

_yoursoldiers = []

_n = count _soldiers

_i = 0

xx = player loadStatus "MYPLAYER"

fillWeaponsFromPool player

#loop

?(_i >= SOLDIERS_ALIVE - 1): goto "EndSoldiers"

xx = (_soldiers select _i) loadStatus format ["Soldat%1", _i + 1]

fillWeaponsFromPool (_soldiers select _i)

_yoursoldiers = _yoursoldiers + [_soldiers select _i]

_i = _i + 1

goto "loop"

#EndSoldiers

?(_i >= _count): goto "pool"

deletevehicle (_soldiers select _i)

_i = _i + 1

goto "EndSoldiers"

#pool

_yoursoldiers join group player

; Sonstiges

_truckal = TRUCK_ALIVE

?(not _truckal): deleteVehicle objTruck; exit;

xx = objTruck loadStatus "TRUCK_STATUS"

from mission two on up, they're all basically the same init and exit scripts.

do I need to save status with different names for each mission?   i.e.:

mission 1 exit.sqs: saveStatus "MYPLAYER1"

mission 2 init: loadStatus "MYPLAYER1"

mission 2 exit: saveStatus "MYPLAYER2"

mission 3 init: loadStatus "MYPLAYER2"

and so on....

it looks like that's the way they did it for the Resistance campaign, I'm not sure if its relevant.

the condition of presence for the squadmates in the editor is true in all cases.

in all the missions I have the entire squad grouped to the player in the editor (with the little lines), but I see that you don't have them grouped in your second mission.  I tried doing it ungrouped, but I'd often get the "dead mates" still there on the followup mission, just not part of my group.  They weren't getting deleted apparently.

something else that might be important:  I have several "working copies" of the missions in the campaign, I save backups J.I.C.  and they all have the same basic init.sqs and exit.sqs

might that be the problem? (the variables getting transferred all over the place?)

thanks again for your help.

Share this post


Link to post
Share on other sites

I see the problem now, it's in the init.sqs:

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

#EndSoldiers

?(_i >= _count): goto "pool"

deletevehicle (_soldiers select _i)

_i = _i + 1

goto "EndSoldiers"

The problem here is, that _count is the same as SOLDIERS_ALIVE; therefore when this part is entered, _i is SOLDIERS_ALIVE-1, thus deleting only one of the dead squad mates. Change it to

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

#EndSoldiers

?(_i >= (count _soldiers) -1 ): goto "pool"

deletevehicle (_soldiers select _i)

_i = _i + 1

goto "EndSoldiers"

Hopefully this will work then!

Share this post


Link to post
Share on other sites

ok, looks like its getting closer.

First mission, I lost five (out of a squad of twelve) men.

second mission, I started with seven (including self), which is to be expected. But there was one extra guy just standing there. Seems he didn't get deleted.

The next few missions were the same. I'd start with the right amount in my squad (after some had died in previous mission) but there was always an extra man, not in my group.

Do I need to save it as SOLDIERS_ALIVE1 then SOLDIERS_ALIVE2 then SOLDIERS_ALIVE3 and so on, i.e. change it slightly for each mission, while still loading in the init.sqs the variable from the previous mission?

Now I've confused myself. sad_o.gif

Share this post


Link to post
Share on other sites

Argh, where's my head!

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

?(_i>= count _soldiers) : goto "pool"

The "-1" was false, as I'm checking at the beginning of the loop! My bad.

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  

×