how to customize states?
sarevok57
Member Posts: 6,002
so I've been looking at making character scripts, and there is one thing I can't figure out fully
lets say for example I want to make a script where my character casts draw upon holy might when the enemy is sighted, but I only want to have the caster cast it once ( if I have more than 1 memorized) but when it comes to checking the state to see if my character already has it cast, this is where things get a little wonky
im pretty sure in the past I just used checkstate drawuponholymight but that didn't seem to work
but then I also realized for things like armor of faith, for when it checks state it says 3,ARMORCLASS, and not armor_of_faith
and then even deathward has check state: scriptingstate2
where are all these armor class/ scripting states located? im using near infinity and I cant find them anywhere, im pretty sure, if I can just make customized scripting states ( like the deathward one for example), I can make my draw upon holy might work perfectly if I just make it a scripting state
lets say for example I want to make a script where my character casts draw upon holy might when the enemy is sighted, but I only want to have the caster cast it once ( if I have more than 1 memorized) but when it comes to checking the state to see if my character already has it cast, this is where things get a little wonky
im pretty sure in the past I just used checkstate drawuponholymight but that didn't seem to work
but then I also realized for things like armor of faith, for when it checks state it says 3,ARMORCLASS, and not armor_of_faith
and then even deathward has check state: scriptingstate2
where are all these armor class/ scripting states located? im using near infinity and I cant find them anywhere, im pretty sure, if I can just make customized scripting states ( like the deathward one for example), I can make my draw upon holy might work perfectly if I just make it a scripting state
0
Comments
For a full stat-to-spell link table, see https://github.com/Gibberlings3/SpellRevisions/blob/master/spell_rev/lib/ds.tph
Par2 is the stat's entry in corresponding IDS file (stats.ids for opcodes 233/282, splstate.ids for 328), par1 is its value. For opcode 282 add 156 to par2 get the real entry number. Sorry for the lack of better documentation
Scriptingstate2 is a proper stat for Death Ward, even though the name is hardly intuitive.
DUHM doesn't have a dedicated one, but you can use scriptingstate6<4. Otherwise, add new entry to splstate.ids and patch it into the spell.
You can also use the linked tph library to add it automatically - e.g. copy and paste the lines 377-378 and specify a custom HEY_I_JUST_ADDED_A_NEW_STATE ( ) state name which it will assign to the first unoccupied slot. Then !CheckSpellState(Myself,HEY_I_JUST_ADDED_A_NEW_STATE) in your script will work fine.
and then, I just happened to stumble upon the advanced AI script in the BCS and then all my dreams starting coming true, copy pasted some lines, deleted some global variables and voila, everything worked like a charm
even though your post really didn't help too terribly much, I still appreciate the help and input