Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#565645 21/04/15 06:44 PM
Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Hello. I've got two things that i've been having trouble with for a while now so i thought i'd post them both in the same thread.

Flags: I'm interested in being able to check if several flags has been set in story, right now i can only check for one by using GlobalEventSet("flag"), for example. In dialog it's possible to do by using several conditions but i haven't found any good functions in story.

Variables: Is it possible to make global variables that remain in the game that i can change up and down over time? Like having a variable that tracks how well liked the player is by a certain faction.

Last edited by karlgoran; 21/04/15 07:28 PM.
Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
I believe you were using the standalone template yes? If so this will be easy.

Originally Posted by karlgoran
Hello. I've got two things that i've been having trouble with for a while now so i thought i'd post them both in the same thread.

Flags: I'm interested in being able to check if several flags has been set in story, right now i can only check for one by using GlobalEventSet("flag"), for example. In dialog it's possible to do by using several conditions but i haven't found any good functions in story.


In MAIN and in the template there is this awesome little script called Greevers_Little_helpers. It has tons of useful script and if you don't have it I highly recommend getting it.

One of the more useful and really simple scripts it has is "GLOBAL EVENT MEMORY"
Code
//REGION Global Event Memory
IF
GlobalEventSet(_String)
THEN
DB_GlobalEvent(_String);

IF
GlobalEventCleared(_String)
THEN
NOT DB_GlobalEvent(_String);
//END_REGION


The above stores all global events as a database.
If you already have this in your mod you can use it right away like this:

Code
IF
GlobalEventSet("GaveFish")
AND
DB_GlobalEvent("GaveCrate")
AND
DB_GlobalEvent("Gavebasket")
AND
DB_GlobalEvent("GaveTeaQuest")
THEN
QuestUpdate("DinerFood","Update13");
QuestClose("DinerFood");


That's one of my quest close conditional statements. It checks for the global event GaveFish and then for the DB_GlobalEvent for the rest. The DB_GlobalEvent("YOUREVENT") is what the global event memory generates everytime you set a global event. It's extremely useful.

Quote

Variables: Is it possible to make global variables that remain in the game that i can change up and down over time? Like having a variable that tracks how well liked the player is by a certain faction.


This sounds like another issue for databases. I'm not too proficient at this at the moment but here are the more relevant threads on the subject:

http://www.larian.com/forums/ubbthr...ords=database&Search=true#Post549547
http://www.larian.com/forums/ubbthr...character.txt&Search=true#Post556556


Last edited by SniperHF; 21/04/15 08:18 PM.
Joined: Oct 2014
B
enthusiast
Offline
enthusiast
B
Joined: Oct 2014
I use sort of an inefficient work around for this issue, but it's simple and it works. You just need to be able to keep track of it.

Use either CHARACTER_Player1 or - to be more safe - put in a dummy character and name it something like Variables, make it global.

Then I use CharacterSetVarInteger(CHARACTER, "Variable Name", VALUE).

These variables are unlimited, permanent, and can be checked at later times with "IF CharacterGetVarInteger", unlike global events which only fire one time and then are no longer able to trigger code.

Last edited by Burgee; 21/04/15 08:54 PM.
Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Excellent, the flag thing worked well. Going to test using CharacterSetVarInteger later, thanks guys.

Burgee #565696 23/04/15 01:21 PM
Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Originally Posted by Burgee
I use sort of an inefficient work around for this issue, but it's simple and it works. You just need to be able to keep track of it.

Use either CHARACTER_Player1 or - to be more safe - put in a dummy character and name it something like Variables, make it global.

Then I use CharacterSetVarInteger(CHARACTER, "Variable Name", VALUE).

These variables are unlimited, permanent, and can be checked at later times with "IF CharacterGetVarInteger", unlike global events which only fire one time and then are no longer able to trigger code.


Is it possible to add a number to an already existing variable or is it only possible to set it to a set value? Like in normal code you might write Y += 1 to add 1 to the already existing value of Y.

Joined: Oct 2014
B
enthusiast
Offline
enthusiast
B
Joined: Oct 2014
In an efficient way, no. Not that I've found. Using conditionals as work arounds? Sure.

IF
CharacterGetVarInteger(_Player, "Number", 1)
THEN
CharacterSetVarInteger(_Player, "Number", 2);

etc.

Maybe someone else can shed some light on math operations in osiris.

Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
I see, well i'll have to simplify some stuff then. thanks.

Joined: Dec 2014
journeyman
Offline
journeyman
Joined: Dec 2014
You can use IntegerSum function.

Here's an example.

Code
IF
	TimerFinished(_TimerEvent)
AND
	DB_GaervPlayerSpiritBottomsUp(_NPC,_TimerEvent,_DisplayText,_Trigger)
AND
	DB_GaervSitCount(_Count)
AND
	IntegerSum(_Count,1,_Sum)
AND
	_Sum < 5
AND
	DB_NumberString(_Sum,_NumberAsString)
AND
	StringConcatenate(_DisplayText,_NumberAsString,_ResultingDisplayText)
THEN
	NOT DB_GaervSitCount(_Count);
	DB_GaervSitCount(_Sum);
	TimerCancel(_TimerEvent);
	CharacterDisplayText(_NPC,_ResultingDisplayText);
	TimerLaunch(_TimerEvent,6000);


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