Jump to content

Can fatigue be used as a condition for a spell?

Recommended Posts

I've created a spell which executes the first effect. Is it possible for when the caster is suffering from fatigue, a second effect is cast?

Using NI, I can get the second effect to happen for other conditions using the CAST SPELL ON CONDITION parameter by calling a second spell containing the second effect but I can't find an option for the second spell to trigger with the fatigue condition so I'm wondering if this is possible.

Edited by pete_smith1229
Link to comment

You need to add a line to SPLPROT.2da checking for the value you want* in the FATIGUE stat. Fatigue is stat #30 so:


* I don't know what value constitutes "fatigued," maybe someone around here knows or you can find it on the internet? but once you know what value you want to use as your threshold, replace the three instances of "xx" in that line with your value.

Then you need to figure out the line number of SPLPROT you added. This  can be different  in everyone's install, so you need to check in Weidu:

COPY_EXISTING ~splprot.2da~ ~override~
  READ_2DA_ENTRIES_NOW rows cols
  FOR (row = 1; row < rows; ++row) BEGIN
	READ_2DA_ENTRY_FORMER rows row 0 ~stat~
	  SET fatigue_row = %row%

(Note you need the same replacement for "xx" here.)

That sets the “%fatigue_row%” variable to represent your fatigue threshold. Then you can add an effect to one spell, which conditionally casts a  second spell when fatigue is equal to or greater than your desired value:

COPY_EXISTING ~spell_1.spl~ ~override~
  LPF ADD_SPELL_EFFECT INT_VAR opcode = 326 target = 1 parameter2 = %fatigue_row% timing = 1 STR_VAR resource = ~spell_2~ END


Edited by subtledoctor
Link to comment

I don't know whether this is relevant to this idea (I don't understand a word subtledoctor posted). Just a heads up that some mods, for example my "7th party member" NPC mods use fatigue for detection of whether the group rested. I.e. they check for fatigue = 0, do their things, wait 15-20 s and then increase fatigue by 1 if no other mod didn't do so already. Just to let you know that there is mods that tinker with the fatigue value (and also need fatigue = 0 after a rest for at least 15 s).

Link to comment

Nice! And don't worry about compatibility, it won't be an issue unless you use this to detect fatigue = 0 in order to test for whether the party has rested.

Now that you've got it working, the only thing I might suggest for compatibility would be to add your modder prefix to the "FATIGUE_OVER_7" phrase at the  beginning of the line you add to SPLPROT.2da.  E.g. I would personally make it "D5_FATIGUE_OVER_7"just  to avoidany possible conflict if someone else adds a line with "FATIGUE_OVER_7." Granted the chance of that actually happening is extremely small...but adding a modder prefix makes it guaranteed safe.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...