06 September 2007

Jasspere's AI Spawn In

Been working on JAI(Jasspere's AI) today in leaps and bounds Most notably, the spawn in event.

Ya see, way back when I tried to do some additional options all tied into the onspawn and checking for variables on the creature being spawned. This met with as much success as someone trying to convince Bill Clinton to try celibacy and I never figured out why it wouldn't work. Sure I had an idea, but testing it would take time, and still be 'hit or miss'.

And on the fourth day, Mask tested...

Long story short, I don't know that my theory was right, but the possible solution I cooked up seems to work so.. Who cares if my theory was right, wrong, or neon purple. It works now, that's what matters.

Essentially, my best guess was that the onspawn script was firing before the creature was considered a "Valid Object" either for terms of checking flags, or in terms of setting flags. Doesn't matter.

What I did was to make a new spawn in script which is so simple, even an untrained monkey could work it.
void main()
{ DelayCommand(1.0f, ExecuteScript("j_ai_onspawn", OBJECT_SELF)); }

j_ai_onspawn of course being the AI script that use to fire instantly. I delayed it a second, a massive change. Or so I'd like you to think....

At any rate with this now reading variables set on the creature, I've gone about adding in first.. my own custom spawn in flags.


Variable If unset Whatssit do.

SS_ATK_COUNT No Modification 1-6 Force set's attacks per round
SS_VFX N/M Allows creater to set a VFX to be applied to the NPC(This will be removed when NPC dies.)

The following all share a similiar implementation:
If: Variable is Greater Than or Equal To 1d100
Effect stated is applied So setting variables as:
101 = ALWAYS apply 0 = NEVER apply
SS_VS_KD N/M Allows creater to set a probability chance of Creature being Knockdown immune.
SS_VS_FEAR N/M See above, but with fear Immunity
SS_VS_CRIT N/M See above, but with Critical Hit Immunity
SS_VS_SNEAK N/M See above, but with Sneak Attack Immunity
SS_VS_DEATH N/M See above, but with Death Magic Immunity
SS_VS_ULTRA N/M % chance as above. Adds Ultravision to the NPC
SS_VS_S_INVIS N/M % chance as above. Adds See Invisibility to the NPC
SS_VS_ETHER N/M Spawns NPC under the effect of Greater Sanctuary until NPC takes hostile action.
SS_VS_REGEN N/M Regenerates 1 HP per second.
SS_VS_FAST N/M 50% speed increase.
SS_VS_CONCEAL N/M 50% concealment applied to creature.
SS_LOOTCHANCE Use creature HitDice Probability Vs 1d100 of a custom weapon being made for this creature.
DEATH_VFX N/M Set VFX shortly after NPC dies (I.E. Mantain illusion created by skining VFX)


I may or may not add more tonight, but if I do, this list will be updated.

The theory behind this, is I want, as much as possible, to make Combat in NWN more tactical. Less
"Build my PC and hope she/he rolls good"
and more
"OK, this isn't working against this monster, let me try something else.."

By making it so creatures can have % chance's of random boosts, I think its going to make it a lot less "Oh look, another orc, let me acid arrow it".. even more so once I finish writing up damage immunity, and resistance bits.


Edit: Above got done

Variable   If unset    Whatssit do.
SS_VS_SLASH_R N/M Slashing resistance = NPC's (Level X 2)
SS_VS_SLASH_I N/M 100% slashing immunity
SS_VS_BLUNT_R N/M Blunt resistance = NPC's (Level X 2)
SS_VS_BLUNT_I N/M 100% Blunt immunity
SS_VS_PIERC_R N/M Piercing resistance = NPC's (Level X 2)
SS_VS_PIERC_I N/M 100% Piercing immunity
SS_VS_FIRE_R N/M Fire resistance = NPC's (Level X 2)
SS_VS_FIRE_I N/M 100% Fire immunity
SS_VS_COLD_R N/M Cold resistance = NPC's (Level X 2)
SS_VS_COLD_I N/M 100% Cold immunity
SS_VS_ELEC_R N/M Electrical resistance = NPC's (Level X 2)
SS_VS_ELEC_I N/M 100% Electrical immunity
SS_VS_ACID_R N/M Acid resistance = NPC's (Level X 2)
SS_VS_ACID_I N/M 100% Acid immunity
SS_VS_DIVI_R N/M Divine resistance = NPC's (Level X 2)
SS_VS_DIVI_I N/M 100% Divine immunity
SS_VS_POSI_R N/M Positive resistance = NPC's (Level X 2)
SS_VS_POSI_I N/M 100% Positive immunity
SS_VS_SONI_R N/M Sonic resistance = NPC's (Level X 2)
SS_VS_SONI_I N/M 100% Sonic immunity
SS_VS_NEGA_R N/M Negative resistance = NPC's (Level X 2)
SS_VS_NEGA_I N/M 100% Negative immunity

No comments: