Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Aug 2014
M
Mag Offline OP
journeyman
OP Offline
journeyman
M
Joined: Aug 2014
Some of the functions end with (STRING)_Event). For instance:

CharacterMoveToItem(_CHARACTER,_ITEM,1,_EVENT);

I assumed it could be used to start an event. After using the function above I tried using

IF
GlobalEventSet("EVENT")
THEN
...

But the THEN part didn't fire.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Like everything else that starts with an underscore, _Event is a local variable (type String in your case). In actuality, the name could be anything.

The problem is that you either need to know what the variable is supposed to be, or use the variable itself within the function. I think you could do something like this:

IF
//First function
THEN
CharacterMoveToItem(_Character, _Item, _Event);
GlobalSetEvent("Custom event");

IF
GlobalEventSet("Custom event")
THEN
//stuff

Joined: Aug 2014
M
Mag Offline OP
journeyman
OP Offline
journeyman
M
Joined: Aug 2014
I should have been more specific. I did fill the event section with a literal but the if statement failed. I don't think it's setting a global event.

I plan on searching the Main game code for the function and then searching the event to see which function recognizes the event.

Joined: Oct 2005
T
journeyman
Offline
journeyman
T
Joined: Oct 2005
Edit: Nevermind... Read first, then post.

Last edited by Thoro; 29/09/14 02:50 PM.
Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Well, if the IF statement isn't triggering then that means one of two things
1. The event isn't being called/triggered
2. The event that is triggering is different than the one you're wanting to respond to

In the example you gave in the first post, it seems as if the event being thrown is under the variable _EVENT, while your IF statement is wanting to respond to "EVENT". This will almost never trigger the IF statement, since it is most likely for something else to be stored on the _EVENT variable.

Consider this example:
Code
IF
CharacterLeveledUp(_Char)
THEN
DB_First("LeveledUp");

IF
DB_First( (STRING)_Event )
THEN
PartyAddExperience(50);
DB_Second(_Event);

IF
DB_Second("Event")
THEN
PartyAddExperience(100);

In the above code, whenever a character levels up the party will receive one dose of 50 experience. The third If statement that depends on "Event" being passed to it will never trigger, since the actual String that is being passed is always "LeveledUp".

Edit:
It's also important to note that GlobalSetEvent and GlobalEventSet are two distinctly different functions. GlobalSetEvent basically broadcasts to the other parts of the code that some sort of Event is happening. GlobalEventSet is what actually responds to an event.

Last edited by Rhidian; 29/09/14 08:26 PM.
Joined: Aug 2014
M
Mag Offline OP
journeyman
OP Offline
journeyman
M
Joined: Aug 2014
My first post was sloppy. My real question is what type of event is being set by functions that have a secondary purpose of setting an event. I started researching via the main campaign but it isn't straight forward as setting a literal event and capturing with an if statement.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Well, let's take a look at a Story script that makes use of an Event as part of an action.


From the DAF_HiddenFamily script
Code
PROC
PROC_DAF_HiddenFamilyLeaves()
AND
DB_DAF_HiddenFamily(_FamilyMember)
THEN
CharacterSetHasDialog(_FamilyMember,0);
ProcCharacterMoveToTrigger(_FamilyMember,TRIGGER_DAF_DruidPortal_OUT,1,"DB_DAF_HiddenFamilyEscape_ReachedPortal");

IF
CharacterEvent(_FamilyMember,"DB_DAF_HiddenFamilyEscape_ReachedPortal")
THEN
CharacterTeleportToTrigger(_FamilyMember,TRIGGER_DAF_DruidPortal_IN,"DB_DAF_HiddenFamilyEscape_ReachedHouse");

IF
CharacterEvent(_FamilyMember,"DB_DAF_HiddenFamilyEscape_ReachedHouse")
THEN
ProcCharacterMoveToTrigger(_FamilyMember,TRIGGER_DAF_DruidHouse_1stFloorOUT,1,"DB_DAF_HiddenFamilyEscape_ReachedStairs");

IF
CharacterEvent(_FamilyMember,"DB_DAF_HiddenFamilyEscape_ReachedStairs")
THEN
CharacterTeleportToTrigger(_FamilyMember,TRIGGER_DAF_DruidHouse_1stFloorIN,"DB_DAF_HiddenFamilyEscape_ReachedTop");

IF
CharacterEvent(_FamilyMember,"DB_DAF_HiddenFamilyEscape_ReachedTop")
THEN
ProcCharacterMoveToTrigger(_FamilyMember,TRIGGER_WAYP_DarkForest_DruidHouse_Pos,1,"DB_DAF_HiddenFamilyEscape_ReachedWaypoint");

IF
CharacterEvent(_FamilyMember,"DB_DAF_HiddenFamilyEscape_ReachedWaypoint")
THEN
Poof(_FamilyMember);



Looking at those functions, it appears as if the Event is thrown *after* the action completes. To respond to it, you need to use something like

IF
CharacterEvent( _Char, "MyEvent")
THEN
//Stuff

Joined: Aug 2014
M
Mag Offline OP
journeyman
OP Offline
journeyman
M
Joined: Aug 2014
Gotcha, so it's setting a character event. Thanks, I'll give it a try.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Be aware that you might need to use

CharacterEvent(_Char, _Event)
ItemEvent(_Item, _Event)
CharacterItemEvent(_Char, _Item, _Event)

Depending on what's throwing the event.


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