Jump to content

Activating a script upon taking damage


Abesh

Recommended Posts

Hi, I have a scripting question - I want to create an effect whereby for the duration damage comes off of stamina instead of health. I think I could do it by checking health at the beginning of the effect and whenever health changes somehow get the amount changed and subtract it from stamina and re-add the same amount to health until the effect wears off. The main question is, how would I be able to track when health changes? And once I figure that out, how do I track the amount lost? Any thoughts?
Link to comment
Share on other sites

Hmmm. It is tough to see what you are trying to talk about. I don't do well with run on sentences. It bugs my mind seeing a sentence with more than ten words. Maybe I'm stupid. I've been told such lol.

 

If you know about scripting, you should look at thislist. Most of the functions are obse, but for vanilla, check out thislist. A good place to start is here. If you don't want to learn how to do the work yourself, I would suggest trying something that isn't a broken cheat. Or make your request more specific. Such as how to make a spell (Greater Power) that does it once per day. I need to get my Mtg cards in the mail, then I would be able to test a script for you and help. For now, I live up to my name.

 

theuseless

Link to comment
Share on other sites

Hmmm. It is tough to see what you are trying to talk about. I don't do well with run on sentences. It bugs my mind seeing a sentence with more than ten words. Maybe I'm stupid. I've been told such lol.

 

If you know about scripting, you should look at thislist. Most of the functions are obse, but for vanilla, check out thislist. A good place to start is here. If you don't want to learn how to do the work yourself, I would suggest trying something that isn't a broken cheat. Or make your request more specific. Such as how to make a spell (Greater Power) that does it once per day. I need to get my Mtg cards in the mail, then I would be able to test a script for you and help. For now, I live up to my name.

 

theuseless

 

That's... pretty unhelpful. I'm very familiar with scripting, I just don't know how to do this specific thing.

Link to comment
Share on other sites

Other than that, setting a script with an OnHit block on the player themselves would be the only way to detect when he has just been hit without OBSE.

 

Not true :psyduck:

 

I try to refrain from arguing respected members, but I've done it before without using OBSE, so am quite sure it is possible.

 

It's actually quite simple;

-Set a tempvar to GetAV health

-Ask 'if tempvar != memvar'

-it true, set memvar to tempvar && hitflag to 1 (&& any counter you may wish) (hit)

-if not true, return (unhit)

 

A DoOnce at the beginning with 'set memvar to GetAV health' would eliminate a "starter"bug.

 

You say you are very familiar with scripting, I will therefore assume you know what I'm talking about. If not, say so and I will elaborate.

Link to comment
Share on other sites

Other than that, setting a script with an OnHit block on the player themselves would be the only way to detect when he has just been hit without OBSE.

 

Not true :psyduck:

 

I try to refrain from arguing respected members, but I've done it before without using OBSE, so am quite sure it is possible.

 

It's actually quite simple;

-Set a tempvar to GetAV health

-Ask 'if tempvar != memvar'

-it true, set memvar to tempvar && hitflag to 1 (&& any counter you may wish) (hit)

-if not true, return (unhit)

 

A DoOnce at the beginning with 'set memvar to GetAV health' would eliminate a "starter"bug.

 

You say you are very familiar with scripting, I will therefore assume you know what I'm talking about. If not, say so and I will elaborate.

 

 

Yeah, that makes sense to me, I guess I just want to know what Block type to put it under. I guess I could put it in like GameMode somehow and just check whether it's changed? Is there any less memory intensive ways of doing it?

Link to comment
Share on other sites

I try to refrain from arguing respected members, but I've done it before without using OBSE, so am quite sure it is possible.

 

Respected member? It would seem I've come a long way - thanks :)

Besides, this isn't an arguement, it's a discussion. ;)

 

It's actually quite simple;

-Set a tempvar to GetAV health

-Ask 'if tempvar != memvar'

-it true, set memvar to tempvar && hitflag to 1 (&& any counter you may wish) (hit)

-if not true, return (unhit)

 

Theoretically, this would work. The one thing that comes to mind is that if you drop below 0 health, you die anyway.

Seen as Abesh seems to be asking how to make a spell effect with a duration, then people may cast that spell when near death. Obviously you can see where this is going - if the player only has 1 health, then the next hit will kill them before their health can be added back. A one hit kill will always be possible, even with a vigilant quest script.

 

The only script I know of that can save a player after his player drops below 0, but before he dies, is an "OnHealthDamage Event script". Regular ScriptEffect blocks, GameMode blocks or OnHit blocks probably would not work in time.

 

It's unbelievable how many things are easier with OBSE, but even with OBSE it is rarely possible to make the engine jump through hoops. 70% of the time you just have to trick people into thinking you did ;)

Therefore, my suggestion is to add an insanely powerful Fortify Health effect onto the character. It will instantly add health to your character, preventing the 1hp remaining scenario, and make any one hit kill improbable. Then simply use the method described by GreatLucifer to ensure that the player has health remaining after the effect wears off.

Link to comment
Share on other sites

Respected member? It would seem I've come a long way - thanks :)

You're welcome ;)

 

Theoretically, this would work. The one thing that comes to mind is that if you drop below 0 health, you die anyway.

Seen as Abesh seems to be asking how to make a spell effect with a duration, then people may cast that spell when near death. Obviously you can see where this is going - if the player only has 1 health, then the next hit will kill them before their health can be added back. A one hit kill will always be possible, even with a vigilant quest script.

Indeed, very true. One of the few things that keeps bothering me... I can't reliably intercept 'death'. It seems to work on occassion, but always bugs out sooner or later. Quite a shame... :facepalm:

 

For reliable 'death'-interception, I can therefore say very little. I'm one of those people who doesn't (and can't) use OBSE. Yes, we still exist :ninja:

Edited by GreatLucifer
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...