Jump to content


Photo

Detect current hit points in spell


11 replies to this topic

#1 subtledoctor

subtledoctor
  • Modders
  • 2445 posts
  • Gender:Male

Posted 10 January 2018 - 10:02 AM

Stats.ids has MAXHITPOINTS so I can add that to SPLPROT.2da, but is there any way for a spell to have different effects based on the current hp of the caster?

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#2 Jarno Mikkola

Jarno Mikkola

    The Imp

  • Modders
  • 6554 posts
  • Gender:Male
  • Location:The town where the dead haven't keeled over, yet. In Finland.

Posted 10 January 2018 - 10:17 AM

Summon a contingency ... and kill with kindness. :devlook:
Welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand.
Here's how to install all the ... mods you ever really could want to Infinity Engine games. I removed the stable word from there as Roxanne began to add BS mods that are likely to break compatibility from the BWS.

#3 subtledoctor

subtledoctor
  • Modders
  • 2445 posts
  • Gender:Male

Posted 10 January 2018 - 10:36 AM

Ugh... would definitely prefer not to deal with opcode 232

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#4 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2585 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 10 January 2018 - 11:11 AM

I seem to recall Chimeric was looking for the same thing not that long ago, and came up dry as well? Unfortunately, no, I don't think it exists.


Retired from modding.


#5 subtledoctor

subtledoctor
  • Modders
  • 2445 posts
  • Gender:Male

Posted 10 January 2018 - 11:46 AM

God that's annoying.

Hmm... maybe I can set a brief min1hp effect to prevent zombification.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#6 argent77

argent77
  • Modders
  • 780 posts
  • Gender:Male

Posted 10 January 2018 - 12:45 PM

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:

Spoiler


#7 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2585 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 10 January 2018 - 01:10 PM

Using scripts in spells...


Retired from modding.


#8 subtledoctor

subtledoctor
  • Modders
  • 2445 posts
  • Gender:Male

Posted 10 January 2018 - 03:02 PM

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.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#9 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2585 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 10 January 2018 - 03:46 PM

...I think I was right then to build the neothelid encounter around its burrowing ability (not like I had much choice anyway) instead of detailed psionics implementation :D


Edited by Ardanis, 10 January 2018 - 03:47 PM.

Retired from modding.


#10 subtledoctor

subtledoctor
  • Modders
  • 2445 posts
  • Gender:Male

Posted 10 January 2018 - 10:26 PM

Oh yeah.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#11 Avenger

Avenger
  • Modders
  • 3789 posts
  • Gender:Male
  • Location:Hungary

Posted 11 January 2018 - 12:34 PM

Maybe you can use current hp targeting with projectiles. Otherwise, yeah, accessing the current hp from splprot would be a nice feature. Unhardcoding power words would be easy then



#12 Grammarsalad

Grammarsalad
  • Modders
  • 462 posts
  • Gender:Male

Posted 11 January 2018 - 01:36 PM

Maybe you can use current hp targeting with projectiles. Otherwise, yeah, accessing the current hp from splprot would be a nice feature. Unhardcoding power words would be easy then


That would totally rock the casbah



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users