Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2014
M
mander Offline OP
apprentice
OP Offline
apprentice
M
Joined: Sep 2014
I've placed an EventTrigger in the region I want it to be, and I want to detect if the whole party is currently standing in it to fire an event (in GM mode).

Here is some code I wrote for this scenario:

IF CharacterEnteredTrigger(_Char,TRIGGERGUID_EventTrigger_000_eb3fe411-faec-4b7f-a1e1-641bfe3f2cb0)
AND
CharacterIsPlayer(_Char,1)
THEN
UserSetFlag(_Char,"IN_EVENT_TRIGGER",1);

IF CharacterLeftTrigger(_Char,TRIGGERGUID_EventTrigger_000_eb3fe411-faec-4b7f-a1e1-641bfe3f2cb0)
AND
CharacterIsPlayer(_Char,1)
THEN
UserSetFlag(_Char,"IN_EVENT_TRIGGER",0);

IF CharacterEnteredTrigger(_Char,TRIGGERGUID_EventTrigger_000_eb3fe411-faec-4b7f-a1e1-641bfe3f2cb0)
AND
UserGetFlag(<CHAR1_GUID>,"IN_EVENT_TRIGGER",1)
AND
UserGetFlag(<CHAR2_GUID>,"IN_EVENT_TRIGGER",1)
AND
UserGetFlag(<CHAR3_GUID>,"IN_EVENT_TRIGGER",1)
AND
UserGetFlag(<CHAR4_GUID>,"IN_EVENT_TRIGGER",1)
THEN
//Do the event


But there are a couple of issues with this:
1) I don't know how to get the GUIDs for all the characters in GM mode, since in the editor when I start the game, there is only one character creation dummy there so I can't right click the other players to get their guids.
2) This would not work in general if the game started with fewer than 4 players

Anyone know how I can fix this, or if there is another approach that would work better?

Joined: Sep 2017
K
stranger
Offline
stranger
K
Joined: Sep 2017
Just a quick thought:

Check out these functions

GetPlayerCount

IterateParty


Joined: Sep 2014
M
mander Offline OP
apprentice
OP Offline
apprentice
M
Joined: Sep 2014
Still not entirely sure how to do this. GetPlayerCount isn't recognized. I did notice I can autocomplete the GUIDs for GM mode characters in the story editor, so there is that, but the previous solution still requires exactly 4 players.

Joined: Sep 2017
K
stranger
Offline
stranger
K
Joined: Sep 2017
Quote


In the INIT put: DB_MyMod_MyTriggerCount(0);

//Assumes one Charcter per user
PROC
Proc_CheckPlayersInMyTrigger((INTEGER)_Count)
AND
GetUserCount(_UserCount)
AND
_UserCount == _Count
THEN
//Action


IF CharacterEnteredTrigger(_Char,TRIGGERGUID_EventTrigger_000_eb3fe411-faec-4b7f-a1e1-641bfe3f2cb0)
AND
CharacterIsPlayer(_Char,1)
AND
DB_MyMod_MyTriggerCount( _Count)
AND
IntegerSum(_Count,1,_NewCount)
THEN
NOT DB_MyMod_MyTriggerCount(_Count);
DB_MyMod_MyTriggerCount(_NewCount);
Proc_CheckPlayersInMyTrigger(_NewCount);

Last edited by Kyrone; 11/10/17 12:24 PM.
Joined: Sep 2014
M
mander Offline OP
apprentice
OP Offline
apprentice
M
Joined: Sep 2014
That works.

That was the first approach I tried to do, but I didn't know you could add numbers like that.

Is there a more up to date API reference than this one somewhere?
https://docs.larian.game/Category:Osiris_APIs

Joined: Dec 2013
old hand
Offline
old hand
Joined: Dec 2013
Once you have generated definitions for your story, from the story editor you can always do a File->Open Story Header. It's located in ".\Data\Mods\<mod name>\Story\RawFiles\story_header.div". That will provide you with the prototype definitions of all the available calls. Upload it to Google drive for stimulating reading when bored! smile


DOS2 Mods: Happily Emmie After and The Noisy Crypt

Steam Workshop
Nexus Mods

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