Jump to content

Detect current hit points in spell


Recommended Posts

I haven't test this, but can't you use opcode 82 (Set AI script) to set a temporary script to the target's AREA script slot? The script can be used to execute code based on current HP. Using the AREA slot should minimize interference with existing scripts. There is most likely a slight delay between spell hitting target and target executing script though.

Example:

 

IF
  HPPercentLT(Myself,25)
THEN
  RESPONSE #100
    ChangeAIScript("",AREA)
    ApplySpellRES("MYSPELL1",Myself)
END

IF
  HPPercentLT(Myself,50)
THEN
  RESPONSE #100
    ChangeAIScript("",AREA)
    ApplySpellRES("MYSPELL2",Myself)
END

IF
  True()
THEN
  RESPONSE #100
    ChangeAIScript("",AREA)
    ApplySpellRES("MYSPELL3",Myself)
END

 

 

Link to comment

Using scripts in spells...

Yeah.

 

This particular issue involves my particular implementation of psionics: I use the psion's max hp to power his/her abilities. So you use Id Insinuation on somebody and your max hp drops by 4, before slowly being restored over the next 8 rounds. Idea being psionics is not magical, you are literally using your life energy as fuel to power your abilities.

 

Problem is, if you are injured, say with 5/10 hp, and you use a psionics power that costs 6 max hp, then you drop to -1/4 hp. At this point your portrait goes gray, you can still run around but you die the next time you take damage, and all processes stop running on you - the max hp regeneration doesn't happen, you never get back to normal. (I think even ctrl-R doesn't fix it.)

 

I've gotten around it by having dual effects: first, you take 6 stunning (nonlethal) damage, then 1 second later your max hp drop by 6 with param2 set to 3 so it doesn't effect your current hp. Then both current hp and max hp regenerate in tandem (simultaneous opcode 18, and opcode 17 with param2 = 3).

 

Finally, I put a 324 effect at the beginning to prevent the max hp loss of your max hp are below the cost of the ability. So if you use too many powers and burn through all your life energy too quickly, the last one you use just does the stunning damage, which will knock you unconscious. Which I think is an appropriate penalty.

 

I've got the dual effects working well for regular powers now, but the next step is to apply them to maintainable powers. That will be more complicated since they separate the initial hp loss from the regeneration; the latter goes into an innate ability called 'Cancel [Power].' Idea being, if your 10/10 hp psion uses a 6 hp power, like inertial Barrier, then you end up with 4/4 hp until you use the 'cancel' ability.

 

Issue is, on this case what to do if a 4/10 hp psion tries to initiate Inertial Barrier? You'll fall unconscious but does the power work? If so, you could wake up and have the barrier without any max hp loss, only a current hp loss (which could be cured with a potion).

 

I could make the ability fizzle completely... that would be a real penalty for using to many powers! And in this case I'd probably want to treat the one-shot powers the same way. (Should be possible... though non-self-targeted powers might be tricky.)

 

Alternatively I'll scrap maintainable powers and just make every power have a set duration, like 1 turn or something. Powers targeting enemies already work like that - trying to create a maintainable Hold or Domination that triggers a max hp regeneration when the enemy dies or throws off the effect was just too difficult.

 

Eh, anyway, one way or another I think I have a solution in sight.

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.

Guest
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...