View Full Version : count all objects within trigger
Silver Surfer
Dec 21 2006, 15:44
Hi,
I would like to count all objects within the trigger. In this case I would like to count all mines in the trigger area and set a variable to true so soon the condition is complied.
http://www.gdt-server.com/silver/pics/count.jpg
Unfortunately the version in the picture dosen´t work.
I diden´t found something useful in the wiki so please don´t link me back to it.
thanks silver
whisper
Dec 21 2006, 15:46
You've put "NOTHING" (I hope my german didn't failed me here and "KEINE" means indeed "NOTHING" http://forums.bistudio.com/oldsmileys/tounge2.gif ) on the "Activation" condition
Try with "Anything" instead
Silver Surfer
Dec 21 2006, 16:45
Arma is not taking the code. The picture is just an example to illustrate better what I am trying to do.
Big Dawg KS
Dec 21 2006, 19:19
The command object is being used wrongly here, it's only useful for finding objects pre-placed on the island. The object command doesn't even work in ArmA now I am told.
You want to use either typeOf (http://community.bistudio.com/wiki/typeOf) or isKindOf (http://community.bistudio.com/wiki/isKindOf). Also, using the count command your second parameter needs to be an array of what you are counting, in this case you need to use thislist to get the array of objects in the trigger area:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">("typeOf _x == ""Mine""" count thislist)<=6[/QUOTE]
Or
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">("_x isKindOf ""Mine""" count thislist)<=6[/QUOTE]
Silver Surfer
Dec 21 2006, 19:42
thanks for your answer Kyle.
part of my problem is that I have no idear how to script so I dont know how to put the commands into a line that works.
In both cases Arma doesn´t accept the code.
Big Dawg KS
Dec 21 2006, 21:49
thanks for your answer Kyle.
part of my problem is that I have no idear how to script so I dont know how to put the commands into a line that works.
In both cases Arma doesn´t accept the code.
Oh, my mistake, I thought the condition needed to be string like foreach, but it should be code:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({typeOf _x == "Mine"} count thislist)<=6[/QUOTE]
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({_x isKindOf "Mine"} count thislist)<=6[/QUOTE]
It would have worked in OFP. http://forums.bistudio.com/oldsmileys/tounge2.gif
Oh, my mistake, I thought the condition needed to be string like foreach, [...]
In ArmA even forEach needs code http://forums.bistudio.com/oldsmileys/wink_o.gif
Big Dawg KS
Dec 21 2006, 21:56
Oh, my mistake, I thought the condition needed to be string like foreach, [...]
In ArmA even forEach needs code http://forums.bistudio.com/oldsmileys/wink_o.gif
Well tell that to the wiki! http://forums.bistudio.com/oldsmileys/icon_rolleyes.gif
I know... I know... http://forums.bistudio.com/oldsmileys/whistle.gif
Oh, my mistake, I thought the condition needed to be string like foreach, [...]
In ArmA even forEach needs code http://forums.bistudio.com/oldsmileys/wink_o.gif
Well tell that to the wiki! http://forums.bistudio.com/oldsmileys/icon_rolleyes.gif
I know... I know... http://forums.bistudio.com/oldsmileys/whistle.gif
>http://forums.bistudio.com/oldsmileys/nener.gif < (http://community.bistudio.com/wiki/forEach#forEach-Loop) It's there! http://forums.bistudio.com/oldsmileys/wink_o.gif
Silver Surfer
Dec 21 2006, 22:50
Arma is taking the code but it dosen´t execute it http://forums.bistudio.com/oldsmileys/sad_o.gif
But maybe my idear was wrong so I better tell you what I am trying to do. The player is supposed to lay a minefield inside the trigger (the minefield have to be bigger than 6 mines) so I put this:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">({_x isKindOf "Mine"} count thislist)>=6[/QUOTE]
inside the trigger. The rest stays like shown in the picture but everytime when I lay the mines inside the trigger it dosen´t take off.
Big Dawg KS
Dec 22 2006, 00:34
Well, I'm not even sure if mines will even be detected by triggers. Actually I'm fairly certain that they won't. You might have to use nearestObject (http://community.bistudio.com/wiki/nearestObject).
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.