Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2017
K
Kyrone Offline OP
stranger
OP Offline
stranger
K
Joined: Sep 2017
Is there a way to iterate through the characters within a trigger. There is a similar function that iterates through all the items in a trigger and sets ownership, but I want to do it for characters.

I want Osiris to be able to reference the characters within the block. Not just call an event, as the trigger has info that needs to be exchanged with the character. Not just players, but NPCs as well.


Joined: Dec 2016
Location: United States
member
Offline
member
Joined: Dec 2016
Location: United States
I'm not sure there is a simple call for this, I may be mistaken. If not:

For an object script, you could use IterateCharactersNear() to iterate characters within radius of the trigger, and check with CharacterIsInTrigger() to ensure that they are actually within the trigger bounds.

Through story code, you could store/remove characters that enter/leave the trigger bounds, with CharacterEnteredTrigger() and CharacterLeftTrigger(), to a DB. You could then iterate through the DB.

Last edited by Ameranth; 05/10/17 11:47 PM.
Joined: Dec 2016
Location: United States
member
Offline
member
Joined: Dec 2016
Location: United States
Actually, for story code, TriggerLaunchIterator iterates through all characters within the given trigger's bounds.

Last edited by Ameranth; 05/10/17 11:48 PM.
Joined: Sep 2017
K
Kyrone Offline OP
stranger
OP Offline
stranger
K
Joined: Sep 2017
Originally Posted by Ameranth
Actually, for story code, TriggerLaunchIterator iterates through all characters within the given trigger's bounds.


Yeah at first I used it but then I realized it doesn't pass along the trigger. I ended up using it though pairing an event name with each trigger in the database. Then I use that to pass the trigger along with the event. So I have a reference to both character and trigger in the story in the same context. Tricky stuff.


Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
Another possible approach is to use an event trigger. Event triggers are automatically registered for all characters. The shared mod has a rule that that catches all Entered/LeftTrigger events and maintains a DB_InRegion(_Char,_Trigger) database based on these events.

So if you use an event trigger, you can just use "IF DB_InRegion(_Char,TRIGGERGUID_MyTrigger_UUID) THEN ..." to iterate all characters currently in that trigger.

Last edited by Tinkerer; 13/10/17 05:51 PM.

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5