Aller au contenu

Photo

Hit Point Bars - Love or Loathe? (See Image Within) - LINKS UPDATED


  • Veuillez vous connecter pour répondre
99 réponses à ce sujet

#51
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

manageri wrote...

I'm trying to make this work for the OC but I'm having some trouble. I'm not sure whether I'm doing something wrong within the scripts or what as I haven't really fiddled with creature event scripts before. Most standard creatures seem to be using nw_c2_default6 (or a script that executes that one) as their on damaged script. I added your script as an include, and these lines to it:

SetGlobalInt("HPBARSSTATE", 1);
UpdateHPBars(OBJECT_SELF, 1);

Nothing happens in game though. I have the updated script and all of your stuff in my override.


Hi Manageri,

I owe you an apology ... sorry ... you do need to have the global int set as I had forgotten I checked that within the function. Alternatively, if you are not using the switching system, then you can do what KevL says above, and comment out the check in the function.

Again, my apologies for misleading you.

Lance.

#52
manageri

manageri
  • Members
  • 394 messages
Thanks Lance and KevL. Mine propably didn't work because of that Tony K duplicate. I didn't even think to look for it because I figured any duplicates would show up when I do a script search in the toolset, but of course that only finds NSS files, which Tony K's didn't have. I'll update and see how it goes.

Edit: It works, thanks guys. Now all that's left is finding any potential creatures that don't use the default script to make this fully OC-functional.

Modifié par manageri, 16 octobre 2013 - 10:10 .


#53
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

manageri wrote...

Thanks Lance and KevL. Mine propably didn't work because of that Tony K duplicate. I didn't even think to look for it because I figured any duplicates would show up when I do a script search in the toolset, but of course that only finds NSS files, which Tony K's didn't have. I'll update and see how it goes.

Edit: It works, thanks guys. Now all that's left is finding any potential creatures that don't use the default script to make this fully OC-functional.


Great News!

All the best finding any strays.

Lance.

#54
kevL

kevL
  • Members
  • 4 056 messages

manageri wrote...

Mine propably didn't work because of that Tony K duplicate. I didn't even think to look for it because I figured any duplicates would show up when I do a script search in the toolset, but of course that only finds NSS files, which Tony K's didn't have.


you'll find TonyK's source for all scripts in the .zip at the Vault. yes we can use his advanced stuff with this!

#55
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

manageri wrote...

Mine propably didn't work because of that Tony K duplicate. I didn't even think to look for it because I figured any duplicates would show up when I do a script search in the toolset, but of course that only finds NSS files, which Tony K's didn't have.


you'll find TonyK's source for all scripts in the .zip at the Vault. yes we can use his advanced stuff with this!


KevL,

Just a quick intercept ... Did you see my comment on the previous page? You may need to do a "death" check for your extra line to work OK. I tested it otherwise as you will see in my last post.

Cheers, Lance.

#56
manageri

manageri
  • Members
  • 394 messages
The "compmonai2.2.zip"? I only get a few NSS files with that, which are pretty much empty.

#57
kevL

kevL
  • Members
  • 4 056 messages
inside erfsource2.2.zip, then inside compmonai.erf...

#58
kevL

kevL
  • Members
  • 4 056 messages
Lance,

i'm going to go with:

else
{
  // just in case this thing gets back up again
  DeleteLocalString(oCreature, "LASTHPBAR");

  RemoveSEFFromObject(oCreature, "alb_hp_100");
  RemoveSEFFromObject(oCreature, "alb_hp_90");
  RemoveSEFFromObject(oCreature, "alb_hp_80");
  RemoveSEFFromObject(oCreature, "alb_hp_70");
  RemoveSEFFromObject(oCreature, "alb_hp_60");
  RemoveSEFFromObject(oCreature, "alb_hp_50");
  RemoveSEFFromObject(oCreature, "alb_hp_40");
  RemoveSEFFromObject(oCreature, "alb_hp_30");
  RemoveSEFFromObject(oCreature, "alb_hp_20");
  RemoveSEFFromObject(oCreature, "alb_hp_10");

  return; // <- good point.
}

for now, because well uhm, idk 0hp is d.e.a.d. (and that GetIsDead(bIgnoreDying) parameter always screws me up :)

#59
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

Lance,

i'm going to go with:

else
{
  // just in case this thing gets back up again
  DeleteLocalString(oCreature, "LASTHPBAR");

  RemoveSEFFromObject(oCreature, "alb_hp_100");
  RemoveSEFFromObject(oCreature, "alb_hp_90");
  RemoveSEFFromObject(oCreature, "alb_hp_80");
  RemoveSEFFromObject(oCreature, "alb_hp_70");
  RemoveSEFFromObject(oCreature, "alb_hp_60");
  RemoveSEFFromObject(oCreature, "alb_hp_50");
  RemoveSEFFromObject(oCreature, "alb_hp_40");
  RemoveSEFFromObject(oCreature, "alb_hp_30");
  RemoveSEFFromObject(oCreature, "alb_hp_20");
  RemoveSEFFromObject(oCreature, "alb_hp_10");

  return; // <- good point.
}

for now, because well uhm, idk 0hp is d.e.a.d. (and that GetIsDead(bIgnoreDying) parameter always screws me up :)


Hi KevL,

Does that work then?

I mean if you have a creature with 100 HP and you do 1 HP damage, then the code will fire, start as if the creature has "alb_hp_100". It will then fall through all the checks because its percentage remaining is > 91 and so fire your else statement, which removes its HP Bar. Yes/no?

The GetIsDead "dying" part only checks with PCs (not NPCs), and so as long as you do a PC check (if you want to use HP Bars with PCs), the dying part will not matter.

Do a check with a 1000 HP creature that takes less than 100 damage and you will probably find that it loses its HP Bar.

Let me know if I have missed something.
Cheers,
Lance.

#60
kevL

kevL
  • Members
  • 4 056 messages
now my turn for an apology....

// CALCULATE BAR POSITION
string sHPBAR;

if (iPERCENT > 90) {sHPBAR = "alb_hp_100";} // 91+
else if (iPERCENT > 80 && iPERCENT < 91) {sHPBAR = "alb_hp_80";} // 81-90


:innocent:

#61
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

now my turn for an apology....

// CALCULATE BAR POSITION
string sHPBAR;

if (iPERCENT > 90) {sHPBAR = "alb_hp_100";} // 91+
else if (iPERCENT > 80 && iPERCENT < 91) {sHPBAR = "alb_hp_80";} // 81-90


:innocent:


Ah OK!
Yes, that should do it. Image IPB

Cheers,
Lance.

EDIT: By the way, I updated the link to version 1.01 that includes the additional lines (although I use the GetIsDead function check).

Modifié par Lance Botelle, 16 octobre 2013 - 11:19 .


#62
kevL

kevL
  • Members
  • 4 056 messages
/cheers!!

#63
ColorsFade

ColorsFade
  • Members
  • 1 267 messages
@kevL: Good one on the remove check man. Saves me an extra onDeath script. I should have thought of that.

This is turning into a pretty cool thing.

#64
kevL

kevL
  • Members
  • 4 056 messages
now i'm wondering about insta-death, specifically EffectDeath()
I doubt it triggers onDamaged...

- might need that deathscript after all


[edit] ok just did a test w/

EffectDeath(TRUE, TRUE, TRUE, TRUE)

and removeSEF called from onDamaged works


ps. yeh this is lookin pretty cool.

[edit2] aah ok. The 4th param in EffectDeath() is:

- bPurgeEffects: Normally TRUE. If changed to FALSE, then the creature will not have their effects purged when they die. This might result in weird situations where a creature won't die (Due to a bonus HP effect, or somesuch), so should only be used in specific situations, such as wanting to preserve a visual effect on the dead body.



so heck, I'm gonna run with onDamaged for now.


[edit3] The good news is, a rather massive Ransack through all scripts for regex

EffectDeath\\(.*,.*,.*,.*FALSE\\)

turned up nada. So unless you put bPurgeEffects=FALSE into your module yourselves, using onDamaged to removeSEF ought be safe.

[edit4] .. for EffectDeath() at least, can't think of any others atm.

Modifié par kevL, 16 octobre 2013 - 03:56 .


#65
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

now i'm wondering about insta-death, specifically EffectDeath()
I doubt it triggers onDamaged...

- might need that deathscript after all


Hi KevL,

I have been doing some more testing with my own campaign ... and while I know my own requirements are more complicated (as there are many things I have to check in various circumstances), I have found that having the effect removed in the OnDeath script still to be the most reliable method.  i.e. While it did work 99% of the time, I occasionally had the effect remain on a corpse using the other method.

Therefore, while I will leave the current version uploaded as it is (without the reference to the OnDeath lines), you may find you need to add the lines to the OnDeath as well to cover all eventualities.

Thanks,
Lance.

Modifié par Lance Botelle, 16 octobre 2013 - 04:47 .


#66
manageri

manageri
  • Members
  • 394 messages
Regarding death effects etc: Losing CON (like after a rage) might not trigger the on damaged script either. Same thing with getting a temp hp buff dispelled perhaps, though that's such a rare cause of death (especially on enemies) that I can't remember ever seeing it.

#67
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

kevL wrote...

I got it in the OC using

nw_c2_default2 -> onPerceived
nw_c2_default6 -> onDamaged


Very cool. 

Took me a while to get these to work (some kind of compiler glitch; I had to rename these files to compile the first time, then rename them back and recompile to get them to save to my campaign folder correctly), but I finally got those two scripts to compile in my Campaign folder.

This is a much, much better way to ensure the HP Bars load for all hostile creatures in my campaign. Now I don't have to tweak every single creature blueprint with a custom User Defined script to make it work. This is exactly the solution I was hoping for: A single, global way to hook it so that every enemy ends up with the bar. 

One thing I did different: In the Perceived script, I added the call to UpdateHpBars right after the two calls to HenchDetermineCombatRound(). This ensures that the HP bars only show up for hostile enemies. The remainder of my townsfolk don't have the bars, which is is what I wanted. 

With this and the call to clear the effect when the creature's HP <= 0, it's a pretty complete package, IMO. 

Love it. Looks great. Adds a lot to the game experience, IMO. As my mod is very combat-oriented... this is something I was really looking for and didn't realize I was missing it until Lance showed up! 

Good job Lance, good job kevL!

#68
kevL

kevL
  • Members
  • 4 056 messages
thanks CF,

This is a much, much better way to ensure the HP Bars load for all hostile creatures in my campaign. Now I don't have to tweak every single creature blueprint with a custom User Defined script to make it work. This is exactly the solution I was hoping for: A single, global way to hook it so that every enemy ends up with the bar.

here's from a Player's perspective. Those ai-scripts have been and are regarded as rather sacrosanct, but when i see a global change like this I no longer hesitate to add it in (the difference being I keep mine in override and deal with any conflicts w/ local modules here -- sometimes it needs a merge but i get by...)

It's a bit leary how robust the onDamaged-removal is: 99% good, maybe a bit more? if/when they don't get removed, nw_c2_default7 is ofc the place to go.....

#69
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

kevL wrote...

here's from a Player's perspective. Those ai-scripts have been and are regarded as rather sacrosanct, but when i see a global change like this I no longer hesitate to add it in (the difference being I keep mine in override and deal with any conflicts w/ local modules here -- sometimes it needs a merge but i get by...)


I wonder if the module's user_defined script could be a valid place to do this then? 

I may have to test that just to see. 

kevL wrote...
It's a bit leary how robust the onDamaged-removal is: 99% good, maybe a bit more? if/when they don't get removed, nw_c2_default7 is ofc the place to go.....


Yeah, I think the next step is to override the death script to ensure removal of the graphic. 

#70
kevL

kevL
  • Members
  • 4 056 messages
the thing about UserDefined scripts ... i remember they were sorta touted as all-the-rage for a while. But when you think about it, or use them they're really more a kludge than a valid enhancement or extension: think of the hoops you have to jump through, reminds me of c++ *rolls eyes*

so i used them for a while, then realized just go to the source...


unless you want to regard the nw_c2* scripts as sacrosanct ;)


oh, and remember several of the nw_c2* scripts already have a call to ExecuteScript() -> rendering user-defined even more cludgy

Modifié par kevL, 16 octobre 2013 - 07:09 .


#71
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

kevL wrote...

the thing about UserDefined scripts ... i remember they were sorta touted as all-the-rage for a while. But when you think about it, or use them they're really more a kludge than a valid enhancement or extension: think of the hoops you have to jump through, reminds me of c++ *rolls eyes*


Yes, having to set the SpawnInCondition in order for a UD Event to become available is a bit of a pain. 


kevL wrote...
unless you want to regard the nw_c2* scripts as sacrosanct ;)


Yeah, that's the issue. I want to provide as minimal interference with other modules/additions as possible. 

So now the dilemma.... either I globally tweak the NW_ scripts, or I just edit those three scripts(perception, damage and death) and update all my creature blueprints (thankfully all enemies are spawned in my campaign, and grouped together in the editor, so this would be less painful than it could have been.)

Decisions decisions...

#72
kevL

kevL
  • Members
  • 4 056 messages
how does priority go again?

i forget..


Weren't you going to copy them to your campaign folder (even to your module, or perhaps into a .hak) and edit away.


I think it's
-hak
-override
-campaign
-module
-stock

#73
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi CF/KevL,

I never use the UserDefined hook either ... never felt natural in any way to use.

That said, I have rewritten near enough *every* monster/companion script for my module and so only have one or two not changed ... I renamed them they were so different! And I have a number of subscripts called from various locations that use other includes. This is why I cannot comment too much beyond the basic outline for these scripts as my experience may differ from yours.

Anyway, good to see the discussions continuing and I'm glad you find them useful to have. I have just finished playing around with them in my campaign again ... and had to alter how and when they were called again ... mainly due to the fact that a player can "stop" fighting a creature and so I needed a way of "removing" the HPBars and then (if need be) have them return again, sometimes in their previous state and other times back at full.

Cheers!
Lance.

#74
ColorsFade

ColorsFade
  • Members
  • 1 267 messages
Yeah, I think what I'm going to do is alter the perception, damage and death scripts, and then rename them, and attach them to all my creatures. Shouldn't take long and it solves the problem in a very simple, clean way.

It also happens to work the best for the HP bars.

#75
Tchos

Tchos
  • Members
  • 5 042 messages
I hope someone who makes these work for the official campaigns will post it as a downloadable mod for others to use.