I want get all entities of class actor touching the trigger
Moderator: Moderators
I want get all entities of class actor touching the trigger
Ahhh another my topic... so, i want get as local every allied soldier, with variable .var == 1, who touch the trigger... they have diffrent targetnames, so i cant use simply for... i think about parm.other, but i dont know what is exacly parm. or other, maybe ill try it but first i wait for reply - no time for miss tests.
Btw can entity have 2 targetnames? Or add every allied soldier to level.allies, then use "for" for level.allies ?
Btw can entity have 2 targetnames? Or add every allied soldier to level.allies, then use "for" for level.allies ?
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Normal triggers are only for players (depending on the definition). You must use special spawnflag triggers for bots. Luckily for you that's what I'm best at
so I know you need to use spawnflags 12 to accomplish that.
Then use this in your setthread:
You can also use a normal trigger without spawnflags and then use this in the setthread:
In either case, local.ent is the bot who triggered the trigger. If you only want the Actors with a certain variable activating the trigger then set an if statement right after the local.ent definition.
2 targetnames? Nope, but 2 or more entities can have the same targetname.
Code: Select all
local.t = spawn trigger_use "spawnflags" "12"Code: Select all
local.ent = parm.otherCode: Select all
while(1)
{
self waittill trigger
local.ent = self.other
//your script
}
end2 targetnames? Nope, but 2 or more entities can have the same targetname.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
Code: Select all
self.other...? You mean parm.other ? Bots can trigger trigger USE with spawnflags??
Or normal trigger (multiple?) without spawnflags? I should set flag MONSTERS, because normal trigger (use) is only for players?? Btw how can i test is actor american?
And about targetnames... i its possible to add x entities with different targetnames to level.soldiers, then use for local.i;level.soldiers.size'local.i++ and get each of them? How it looks like?
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
No, if you don't use spawnflags 12, parm.other will identify players then self.other will define other entities. With spawnflags 12, parm.other will be actors because it's impossible for a player to activate that kind of trigger because spawnflags 12 equals these 2 flags: NOT_PLAYERS & MONSTERS and 8 + 4 = 12 
I recommend you use the spawnflag method, I use the self.other method for triggers set in .bot files with bdbodger's botmapper and jv's botscripts. I was just showing that there are more than 2 possibilities for bots to trigger triggers.
Yes they can trigger almost any kind of trigger with spawnflags 12.
As for the targetnames; yes but you'll have to do it all manually
level.soldiers[1] = $actor_siegfried
level.soldiers[2] = $actor_johnson
level.soldiers[3] = $badguy_connor
etc...
You should've used a targetname array... Name all allied AI $goodguy and all axis AI $badguy or something and then use a for statement.
I recommend you use the spawnflag method, I use the self.other method for triggers set in .bot files with bdbodger's botmapper and jv's botscripts. I was just showing that there are more than 2 possibilities for bots to trigger triggers.
Yes they can trigger almost any kind of trigger with spawnflags 12.
As for the targetnames; yes but you'll have to do it all manually
level.soldiers[1] = $actor_siegfried
level.soldiers[2] = $actor_johnson
level.soldiers[3] = $badguy_connor
etc...
You should've used a targetname array... Name all allied AI $goodguy and all axis AI $badguy or something and then use a for statement.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
Alright... i actually have some diffrent targetnames, cappy, startingsoldier etc, but ill change theyre targetnames to $allied... btw will it work?$oldier Of Ra wrote: You should've used a targetname array... Name all allied AI $goodguy and all axis AI $badguy or something and then use a for statement.
Code: Select all
level.cappy = $cappy
$cappy.targetname = allied
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Those were examples 
Well this won't be an array unless there are more than 1 entities with the targetname $cappy.
I don't think that will work. That entity already has a targetname $cappy, you cannot change it again or add a new one.
Code: Select all
level.cappy = $cappyCode: Select all
$cappy.targetname = allied Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
Really? ...! I know.
It works, i just tested it.$oldier Of Ra wrote:I don't think that will work. That entity already has a targetname $cappy, you cannot change it again or add a new one.Code: Select all
$cappy.targetname = allied
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Then the engine is less logical than I thought.
But why would you want to do that anyways? You're making it very hard on yourself when it can be done so easily, just targetname every allied AI with the same name and every axis AI with the same name. Then just use a for statement. By using all these loopholes and tricks just to get a for statement working is going to make your script so complicated, you won't even understand it in the end.
If you're doing this because you're scripts are working with individual AI, then I still suggest you give them the same targetname and give those AI also a tag.
But why would you want to do that anyways? You're making it very hard on yourself when it can be done so easily, just targetname every allied AI with the same name and every axis AI with the same name. Then just use a for statement. By using all these loopholes and tricks just to get a for statement working is going to make your script so complicated, you won't even understand it in the end.
If you're doing this because you're scripts are working with individual AI, then I still suggest you give them the same targetname and give those AI also a tag.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.