Scripting State?
Abel
Member Posts: 785
I'm currently looking at the Whirlwind spell resource (SPCL900).
I see there's an effect that modify the scripting state. What are scripting state and what are they used for?
For this file, opcode #282 is used:
Value = 4; Scripting State = 3 in the file.
I see there's an effect that modify the scripting state. What are scripting state and what are they used for?
For this file, opcode #282 is used:
#282 (0x282) Script: Scripting State Modifier [282]What was the base value and what do we obtain once we activate Whirlwind?
Parameter #1: Value
Parameter #2: Scripting State
Description:
Modifies Scripting state to the given value. Scripting State range from 0 to 35. The scripting state can be checked via scripts (see stats.ids), subtract 156 from the stat value to get the scripting state.
This effect does not have proper bounds checking, and can therefore be used in unintended ways. For example scripting state 13 equals with the NO_CIRCLE attribute (stat=169), and scripting state 1139 ties to PICKPOCKET (stat=29).
Value = 4; Scripting State = 3 in the file.
0
Comments
In the case of innate abilities such as Whirlwind Attack, the scripting state 4 (SCRIPTINGSTATE4 in stats.ids) is set while it's active. This is also true for other abilities like Quivering Palm (SPCL820) or Power Attack (SPCL906). Another case is the spell 'Spell Immunity' which sets the scripting state WIZARD_SPELL_IMMUNITY. You can find a lot of checks for this state in mage-related combat scripts.
In the case of Whirlwind I see the value is 4 and in the case of Greater Whirlwing 5. So if I understand well, both use scripting state 3 but set it to a different value.
So I guess a same scripting state can be used for various things if you use different values.
What I don't understand is the IESDP description mentions states from 0 to 35, but I only see 1 to 6 in STATS.IDS.
Also, what has the STATE.IDS to do with anything?
Anyways, the STATS.IDS is only needed to link numeric values (which are used by the game engine internally) with symbolic names (which are shown in decompiled scripts as a programming aid). Unlisted entries in the STATS.IDS shouldn't affect the game in any way, but it makes it more difficult for the modder to keep track of the correct scripting states.
The STATE.IDS defines bitmasks over one or more hardcoded states (e.g. poisoned, stunned, hasted, under bless effect). For example, the identifier CD_STATE_NOTVALID which is commonly used in mods covers all mental and physical states that prevent a character from interacting with their environment. Those states only have on/off switches, in contrast to scripting states which can be set to arbitrary numeric values.
I don't understand what you're saying. You say that Whirlwind use the SCRIPTINGSTATE, yet that it's chosen arbitrarily?
Also, what will happen if I use the Script: Scripting State Modifier [282] to set a value for a state 100?
So, I'm looking at Spell Immunity and I don't see this opcode in the effect. Does that mean that the WIZARD_SPELL_IMMUNITY state you spoke about doesn't need to be set in that case?
A script of an enemy wizard might check for this specific state to determine whether his attack will be effective. It might look something like this: Since Symbol: Death is a conjuration spell, it will be ineffective if cast on a character that is protected by Spell Immunity: Conjuration. This script ensures that the spell will only be used on your character when he is vulnerable to it.
By the way, you seem to know a lot. Are you an old modder?