Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Not got a flag  (Read 3106 times)

0 Members and 1 Guest are viewing this topic.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Not got a flag
« 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.
« Last Edit: 27 Apr 2005, 22:53:39 by THobson »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Not got a flag
« Reply #1 on: 27 Apr 2005, 23:20:46 »

try

?(flag Player == objnull):

this will return false if the unit doesnt have a flag
« Last Edit: 27 Apr 2005, 23:21:18 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Not got a flag
« Reply #2 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.
« Last Edit: 28 Apr 2005, 07:55:21 by THobson »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Not got a flag
« Reply #3 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.
« Last Edit: 28 Apr 2005, 09:59:25 by Fragorl »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Not got a flag
« Reply #4 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

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Not got a flag
« Reply #5 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 ::)
« Last Edit: 28 Apr 2005, 11:27:57 by Fragorl »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Not got a flag
« Reply #6 on: 28 Apr 2005, 12:44:26 »
Wonderful.  Thanks.  I'll try it.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Not got a flag
« Reply #7 on: 28 Apr 2005, 22:05:23 »
It worked.  Thanks all.  

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