OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: THobson on 27 Apr 2005, 19:31:54
-
I am not making a MP mission, but my question I am sure will be known to MP mission makers.
It simply this - How do I detect if a unit is not carring a flag without having to check that he is not the owner of every flag in the mission? I suppose I could use:
not ((flag unitname) in [flag1,flag2...])
but I am struggling to get the values for flag1, flag2 etc. I am trying to get them using
hint format ["%1",flag _flagowner]
but that just gives me: a number that is different each time#NOID Vlajkstozar
for each of the different flags in the mission.
Basically I am trying to avoid a unit being given a flag if they already have one.
-
try
?(flag Player == objnull):
this will return false if the unit doesnt have a flag
-
Unfortunately it will also return false if the unit does have a flag.
From Comref:
objNull
Type of returned value:
Object
Description:
non-existing object. This values is not equal to anything, even to itself.
It's true, I tried it. I am sorry - I should have said I had already gone this route with no success.
-
I think you will have to check against every other flag in the game.
"flagowner _x == player " count _flagsArray == 0
Where _flagsarray contains the names of all the flags (the names of the physical flagpoles added in the editor) in the game.
-
I was afraid of that. I don't want to give all the flagpoles names because of the savegame bug. I guess I will just have to do without what I wanted to do.
Thanks
-
Oh, no! Sorry, i didn't read the question properly!
Terox was on the right track - just use Isnull flag player instead of flag player == objnull
Sorry ::)
-
Wonderful. Thanks. I'll try it.
-
It worked. Thanks all.
Then I decided to do the same thing in a different way anyway!!