OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: johan_d2 on 20 Jan 2006, 16:55:21
-
Hi,
I searched, but couldnt find..
When I name a gamelogic like WP1, how in a script can I get that name in a variable?
The NAME command gives random names, very strange.
Johan
-
WP1 is the variable. If you name something WP1, then you can use that in a script. For example:-
WP1 setPos getPos WP2
-
Hi,
Well, I have a trigger covering an area, to harvest all the logics. They are in an array.
If I check the names of the logics, against another array, the WPx names dont show up, but instead I have things like Bravo Black.
_convldr = _this select 0
_logics = List LogicList
_lognam = ["wp1","wp2","wp3","wp4"]
_cl = (count _logics)
#loop
_rndom = random _cl
_rndom = _rndom - (_rndom mod 1)
_rndomLogic = _logics select _rndom
_c = 0
#checkwp
_b = _lognam select _c
_a = _rndomlogic
hint format ["%1 namelog %2 namelognam", _a, _b]
~1
? _a == _b: goto "moveass"
_c = _c + 1
? _c == _cl:hint "error, no WPx found"; exit
goto "checkwp"
#moveass
_convldr move getpos (_rndomLogic)
#loop1
_c = _convldr distance _rndomlogic
hint format ["%1 distance %2 ", _rndom,_c]
?((_convldr distance _rndomLogic) < 10):goto "loop"
~10
Goto "loop1"
-
Logics are treat similarly to units, they have group names and have unit names
if you try to return the name logic, it will give you the group/unit assignment name, eg alpha black 2
in your _lognam array, you place speech marks around each logic variable name, this is incorrect, it should read
_lognam = [wp1,wp2,wp3,wp4]
only marker variablenames, or strings need speech marks around them
-
If you give a GameLogic (or any other object for that matter) a name, then the way to refer to it in a script is to use the name you gave it.
So if you give a name to a GameLogic GL1 (by puttiing it the name in the Name field) then in a script you refer to that game logic by writing GL1 NB NOT "GL1" and certainly not name GL1
-
@terox
the _logname is the array of checkup, not the actual logics
@thobson
Well, the _logics is filled array from LIST triggername.
So all the logics from the map are in this array, _logics.
Now, when I randomly select one logic from the _logics array, and move the
group to there works well. no problem here, but;
I want to compare the logic to another array, so the names are only
used for this script if in _lognam.
This prevents groups getting a logic like the famous 'server' logic as waypoint.
So the main question is: how on earth do I compare them?
-
Instead of:
_lognam = ["wp1","wp2","wp3","wp4"]have you tried:
_lognam = [wp1,wp2,wp3,wp4]???
The names are variables not srtings
-
IT DID THE TRICK!
Sorry @terox
I was thinking of the exact name, but its a strange thing.
Altough a logic is named WP1 for example, its internally referred to ita alpha black etc.. very frustrating!
Thanks a million!.
Johan