OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: THobson on 27 Apr 2005, 19:31:54

Title: Not got a flag
Post 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.
Title: Re:Not got a flag
Post by: Terox on 27 Apr 2005, 23:20:46

try

?(flag Player == objnull):

this will return false if the unit doesnt have a flag
Title: Re:Not got a flag
Post by: THobson on 28 Apr 2005, 07:45:09
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.
Title: Re:Not got a flag
Post by: Fragorl on 28 Apr 2005, 09:58:49
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.
Title: Re:Not got a flag
Post by: THobson on 28 Apr 2005, 11:02:42
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
Title: Re:Not got a flag
Post by: Fragorl on 28 Apr 2005, 11:26:18
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 ::)
Title: Re:Not got a flag
Post by: THobson on 28 Apr 2005, 12:44:26
Wonderful.  Thanks.  I'll try it.
Title: Re:Not got a flag
Post by: THobson on 28 Apr 2005, 22:05:23
It worked.  Thanks all.  

Then I decided to do the same thing in a different way anyway!!