Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Hello. I'm wondering if there's a way to check what a player has in a certain attribute and then trigger something because of that. Like if intelligence is over 7, display some text.

Joined: Sep 2014
Z
apprentice
Offline
apprentice
Z
Joined: Sep 2014
To get a players attribute (in story editor) you can use the query CharacterGetAttribute (or in charScript with CharacterGetStat) but this is only a request for that attribute value. The real issue here is when do you trigger the look-up. You could have it check every N seconds (have a repeating timer). It would be better though to find another event that might be the trigger. ie: ability or potion that increases the stat is used, or CharacterLeveledUp (Osiris event).

Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
The function looks pretty weird, CharacterGetAttribute([in](Character)_Character,[in](STRING)_Attribute,[out](INTEGER)_Value)

Never seen those [in] and [out] things, also what's the integer supposed to be?

Another thing i don't get is how to set up the actual code, can i do something like :

variable = CharacterGetAttribute(CHARACTER_MalePlayer_001, "Intelligence", _valee)

IF
variable > 7
THEN
code

?

Joined: Sep 2014
Z
apprentice
Offline
apprentice
Z
Joined: Sep 2014
[in] are the input values, and [out] is variable the result is output to
So you would want
Code
IF
<some Event>
AND
CharacterGetAttribute(CHARACTER_MalePlayer_001, "Intelligence", _value)
AND
_value > 7
THEN
<step 3: profit>

Btw you need an Event after the IF (before the first and) and those highlight as purple. And the following code block is only executed when the event occurs.

Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Worked great, thanks!


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