OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Larsen on 02 May 2004, 12:17:08
-
I want to give players in different groups different weapons to select from (sniper guns for sniper team etc.).
Is there a way to make separate weapon lists for different player groups ?
I guess it would be done in description.ext, but i don't know if it's possible.
Please help ;D
-
Seperate weapon selection during the briefing can
only be done sidewise. All groupleaders of a side will
share the same pool of available weapons.
If you want to seperate weapon selection for groups
on the same side, i would suggest to use a dialog right
after the briefing screen, when the mission itself starts.
Check out the ed-depot or de-pbo some maps like
battlefield 1958, where such dialogues are used.
~S~ CD
-
Ok, thanks for help.
Now i know how to create dialogues.
I created a dialogue with combo-box, and i want to add weapon names to the list (selecting a name should add a weapon and ammo), but ... i don't know how to do it correctly.
I looked into few missions, but the scripts there were too complicated for me.
Can anyone help me?
-
Well, here's one where i passed an array, containing
strings to a script:
let's say:
["option 1","option 2","option 3"] exec "scriptname.sqs"
_ok = createDialog "DIALOG1"
?(!_ok): hint "Fehler!"; exit
_array = _this
_max = count _array
_i = 0
#loop
_option = _array select _i
_item = format ["Item" + "%1",_i]
_index = lbAdd [104, _option]
lbSetData [104, _index, _item]
_i = _i + 1
?(_i < _max): goto "loop"
lbSetCurSel [104, 0]
how it work:
_array = _this select 0
that means: _array = ["option 1","option 2","option 3"]
_max = count _array
that means: _max = 3 (as _array consists of 3 strings)
_i = 0
#loop
nothing to add here
now the main part - building the combo contents:
_option = _array select _i
that means: _option = _array select 0 (as _i is 0 atm)
ergo: _option = "option 1"
_item = format ["Item" + "%1",_i]
that means: _item = "Item" + 0 = "Item0" (note: _i is still 0)
_index = lbAdd [104, _option]
lbSetData [104, _index, _item]
this will make "option 1" become the first option of the combo box
:note - my combo box is idc: 104
first line assigns "option 1" for idc 104, second line
makes it to be the first entry of the combo box
_i = _i + 1
?(_i < _max): goto "loop"
that means: _i = 0 + 1 (= 1)
and if _i (1) < _max (3) then goto "loop"
This will make the combo box look like:
option 1
option 2
option 3
and the last line:
lbSetCurSel [104, 0]
will make entry 0 ("option 1") to be selected in the combo box
by default
:note lbSetCurSel [104, 1] would select "option 2" to be default.
hope this helps instead of confuses ;D
~S~ CD
-
Ok, thanks again mate.
Now i have a list of ... let's say weapon names.
I still don't know what to do next - how to turn list values into adding a weapon?
And - what about changing the selected object from list?
-
Well, i'm very short on time at the moment, as i've only got 4 hours left to sleep until having to go to work, so here's a first
start (will come back to tell you more later):
_selector = lbcursel 104
would assign _selector to the string, being selected from the
combo box
that means: if player selects option 2, then:
_selector = "option 2"
You would have to make a loop which would end, once the player
hits cancel/exit/ok (or however you named the button to leave
the dialog - except escape-key)
OkieDokie - gonna get some sleep now
~S~ CD
-
Ok, everything is up and running :-)
Now i'm looking for smart way to add this dialogue to every human player in mission (this dialogue should appeare only once - at start of the mission)
I need to run script a bit differently for every player
player1 - ["option 1"] exec "scriptname.sqs"
player2 - ["option 8"] exec "scriptname.sqs"
etc., but when i'm adding the script to initialisation field of a unit dialogue pops at briefing, not at the start of the mission.
How to deal with that ?