Home   Help Search Login Register  

Author Topic: Dialog to control units  (Read 4020 times)

0 Members and 1 Guest are viewing this topic.

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Dialog to control units
« Reply #15 on: 17 Jun 2003, 00:55:05 »
Yeah, I'll have to ask users to input all sidearm magazine names (he intends to use in a mission) into an array for it to work correctly. Not quite user-friendly  :( It works and I got this kinda solved, but I got atleast 1 more interesting dilemma in need of solving.

I'd wan't to get an array of weapon and mags in the cargo space of a vehicle  ;D ummmm, I'm not at all sure miself tis is possible heh.
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Dialog to control units
« Reply #16 on: 25 Jan 2004, 17:13:31 »
I got this kinda solved, but I got atleast 1 more interesting dilemma in need of solving.

After half a year nothing is that interesting, what a n00b ^  ;D

Ok I am at the same spot quite much, but I've made a significant amount of little improvements, and I'm ready to release this messy monster, which really isn't about controlling units but arming them without the radio menu. More than 1 guy and 1 clip at a time  :-X all at once is the name of the game! should come handy if your experiencing the "weapon-to-ammocrate = potentially-to-insane-amounts-multiplying-weaponholders-on-the-ground" bug.

But, since I wan't to include the option of creating the selected weapons on the ground, I've hit a dead end. How do you make weaponholders visible to those players which were not local when the dialog was created (the script doesn't exit for them, just that the dialog doesn't show on them)?
Code: [Select]
_caller = _this select 0
_unit = _this select 1
? (local _unit) : createDialog "equipDialog"
jadajadajadacode...

and the creation point of the processing script (which is launched from a button, does that make it global?):
Code: [Select]
_primstr = lbData [13968, lbCurSel 13968]
...
_mag1str = lbData [139617, lbCurSel 139617]
...
if ((_primstr != "NONE") && (MIF_WQprimstock select (lbCurSel 13968) > 0)) then {_primhold = "weaponholder" createVehicle getPos _curunit; _primhold setPos getPos _curunit; _primhold addWeaponCargo [format ["%1",_primstr],1];_newPrimStock = (MIF_WQprimstock select (lbCurSel 13968));_newPrimStock = _newPrimStock - 1;MIF_WQprimstock set [(lbCurSel 13968),_newPrimStock]}
...
if ((_mag1str != "NONE") || (_mag1amo != 0)) then {_mag1hold = "weaponholder" createVehicle getPos _curunit; _mag1hold setPos getPos _curunit; _mc = 0;while "(_mc < _mag1amo) && (MIF_WQmagastock select (lbCurSel 139617) > 0)" do {_mag1hold addMagazineCargo [format ["%1",_mag1str],1];_newMagStock = (MIF_WQmagastock select (lbCurSel 139617));_newMagStock = _newMagStock - 1;MIF_WQmagastock set [(lbCurSel 139617),_newMagStock];_mc = _mc + 1}}
...
_whis = [_mag1hold,_mag2hold,_mag3hold,_mag4hold,_primhold,_sechold,_thihold,_fouhold,_fifhold]
_whi = 0
while "(whi < (count _whis))" do {if(format [{%1},isnull (_whis select _whi)] != {true}) then {publicVariable (_whis select _whi)}; _whi = _whi + 1;};
So, there you have the _primstr which is from the dialogs listbox which selections contain strings as data. For example "HK".
Then the same with _mag1str, "HK" again.
Then if the _primstr is "HK" or anything it will create a weaponholder and stuff the "HK" in it.
Then the same with _mag1str.
Lastly, I do a PV command for each of the strings that are not null.

The problem is, the weapons and mags & equipment show up only on the client who used the dialog. I don't make them exit the script anywhere...

EDIT: ofcourse the dialog is launched via used action; ofcourse the other clients are thrown out. duh. sigh
« Last Edit: 26 Jan 2004, 01:24:48 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Dialog to control units
« Reply #17 on: 26 Jan 2004, 04:04:01 »
Hi MI_Fred,

there you got one big multiplayer problem to deal with.

You can't publicVariable "strings" or arrays

In your case it's the strings, that won't become updated
by PV command.

You should try to use a technique, where you will be able
to PV numeric variables, and let the clients use these numerics
to select strings from global arrays.

Also the prob, that the script executes local only, because of
the custom action - you could make a boolean true, PV it, and
let everybody start another script upon this boolean.

~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 MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Dialog to control units
« Reply #18 on: 26 Jan 2004, 13:02:59 »
Thx for the answer.

I guess I messed that post up, you didn't notice that I was trying to PV the weaponholders which are objects? Or wouldn't that work in any case? Atleast it doesn't like I have it now there...

Agh I don't wanna write yet another script to run for others at that point... a brilliant flash of an extra gadget to that dialog flashed in my brain last night and it's more important  ;D Oh well. All so new to me this PV stuff...

There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.