Larian Studios
Posted By: karlgoran Checking character attribute score - 09/03/15 08:34 PM
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.
Posted By: Zoltan Re: Checking character attribute score - 09/03/15 09:29 PM
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).
Posted By: karlgoran Re: Checking character attribute score - 09/03/15 10:19 PM
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

?
Posted By: Zoltan Re: Checking character attribute score - 09/03/15 10:34 PM
[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.
Posted By: karlgoran Re: Checking character attribute score - 10/03/15 01:36 AM
Worked great, thanks!
© Larian Studios forums