Hit Point Bars - Love or Loathe? (See Image Within) - LINKS UPDATED
#26
Posté 04 septembre 2013 - 06:15
all in all, i s'pose more like the bars than not.
a worthy effort - thanks for sharing Lance
#27
Posté 04 septembre 2013 - 07:10
Morbane wrote...
i wish i could code xml like that - the way you attached it to a feat toggle is very cool.
all in all, i s'pose more like the bars than not.
a worthy effort - thanks for sharing Lance
Hi Morbane,
Actually, this does not use XML coding ... but adds a new effect. The hardest thing was creating the VFX which I use to attach to the creature in question. Drawing all the bars at different percentages etc.
With respect to XML, all my XML coding is self-taught. It's not too difficult to gets to grips with as long as you have a reasonable understanding of script and have my tutorial to hand ... which I still refer to myself.
I have found that most "issues" can be solved with some thinking "outside the box" as it were. And most of my methods avoid any great feats of coding.
I will try to package this into something more manageable in the future, but am working on my module at the moment. Although, if I get my module out, then the code will be available to everyone anyway.
Thanks,
Lance.
#28
Posté 05 septembre 2013 - 12:33
i remember reading that you used vfx for this - didnt think about it at the time, but not knowing any better I just figured you used xml to make them appear or something.
#29
Posté 05 septembre 2013 - 10:02
Morbane wrote...
heh, I just figured it was xml as you are pretty much one of the few who can do it at any mentionable level.
i remember reading that you used vfx for this - didnt think about it at the time, but not knowing any better I just figured you used xml to make them appear or something.
Hi Morbane,
You are too kind.
Thanks again,
Lance.
#30
Posté 06 septembre 2013 - 01:29
I have added some information to my blog, which I welcome any more comments there. (I will answer posts here, but it is easier to keep track of on the dedicated blog.)
The Blog Post Is Here.
Many Thanks,
Lance.
#31
Posté 13 octobre 2013 - 04:31
Thank you sir! What an incredible contribution! I can't wait to use this.
#32
Posté 13 octobre 2013 - 04:39
I am going through this thread and your blog and I don't see this released anywhere yet. Have you released this code? Is it available somewhere?
#33
Posté 14 octobre 2013 - 11:59
I have not released this yet because I had not yet decided whether to accommodate it to work around some other systems, like a BOSS bar system. Furthermore, I usually like to add some instructions on how to implement my systems, but I have not been feeling up to that of late.
That said, I can release the system as it stands (which does work fine), in its "raw" state and allow builders to use the code/sefs as they currently stand, allowing them to add the code themselves.
I will upload something to the Vault later and let you know when its there. If you have any questions about implementation (that you cannot work out), then ask here, and I will answer.
Thanks for the interest. It's good to know people also like them.
UPDATE: I have put a package together, but the Vault "fails" to accept my files at present. As soon as I get the OK to update my submission, I will do so. The submission is called "LB Hit Point Bars" and will be found as an original Hak.
UPDATE2: OK, so it looks like I am a little behind the times and I now see that the Vault is no longer active as such. I will look to its sticky link for further info and come back a little later.
UPDATE 3: OK, so where is the best place to place content for download nowadays?
UPDATE 4: OK - "OFFICIAL" Download Here: http://neverwinter2....s/?id=832&pUp=1
Lance.
EDIT: I also include an "option" to turn the system on or off in my campaign, but in this basic release, I leave that for you to incorporate as required for your own setting.
Modifié par Lance Botelle, 14 octobre 2013 - 06:02 .
#34
Posté 14 octobre 2013 - 03:50
Lance Botelle wrote...
That said, I can release the system as it stands (which does work fine), in its "raw" state and allow builders to use the code/sefs as they currently stand, allowing them to add the code themselves.
Can somebody suggest a site for upload in future?
I say never let lack of documentation prevent the release of a useful system. Those most likely to use it are also those most likely to be able to figure it out without documentation, especially if the code is commented, which is what I consider real documentation.
As for uploading places:
http://neverwinter2.nexusmods.com
http://neverwintervault.org
#35
Posté 14 octobre 2013 - 04:07
Tchos wrote...
Lance Botelle wrote...
That said, I can release the system as it stands (which does work fine), in its "raw" state and allow builders to use the code/sefs as they currently stand, allowing them to add the code themselves.
Can somebody suggest a site for upload in future?
I say never let lack of documentation prevent the release of a useful system. Those most likely to use it are also those most likely to be able to figure it out without documentation, especially if the code is commented, which is what I consider real documentation.
As for uploading places:
http://neverwinter2.nexusmods.com
http://neverwintervault.org
Hi Tchos,
Lack of Documentation ... I'm just a little fussy about that kind of thing.
I went to the neverwinter vault link (as I did before) and I still cannot find how to upload material .... Where are the instructions/documentation?
Maybe I can try the other one, as I believe I did upload something else with them once, now you recall me to them.
EDIT: OK, Hopefully this is OK: http://neverwinter2....s/?id=832&pUp=1
Thanks.
Lance.
Modifié par Lance Botelle, 14 octobre 2013 - 04:25 .
#36
Posté 14 octobre 2013 - 04:36
I'm looking forward to implementing these right away and seeing how they work. Good job mate. Thank you for posting!
#37
Posté 14 octobre 2013 - 05:07
Heh, yes, I see what you mean about documentation. I can't say, not yet having uploaded something there, but I know there are some others around here who have.Lance Botelle wrote...
I went to the neverwinter vault link (as I did before) and I still cannot find how to upload material .... Where are the instructions/documentation?
Both downloads worked for me. Thank you.
#38
Posté 14 octobre 2013 - 06:03
No problem ... Please do ask questions here if you have any difficulty ... or even just to let me know that you have it working OK!
Hi Tchos,
Good to hear they worked OK. I have now left just the "official" download in place.
Thanks All,
Lance.
#39
Posté 15 octobre 2013 - 01:04
I imagine one wants this someplace centrally, but I am having a difficult time determining where the appropriate hook point is.
Thanks!
#40
Posté 15 octobre 2013 - 10:55
ColorsFade wrote...
So Lance, this looks pretty straight forward. I only have one question: From where are you calling this script to update HP bars?
I imagine one wants this someplace centrally, but I am having a difficult time determining where the appropriate hook point is.
Thanks!
Hi ColorsFade,
OK ... Let me explain some things so that you gain more knowledge than me simply answering that directly.
The ReadMe.txt gives the information you need (but you may have missed that), and the relevant points read as follows .... (I have highlighted the points I will expand upon):-
The "LB_HPBars" script is an include file (with some example code remmed beneath) including functions you need to call to make the HP Bars work (1 is essential and 2 are optional):
UpdateHPBars (Essential).... Is the main function to call to update the hitpoint bars, whether to display for the first time on an encounter or when the creature is damaged.
Right, note the following ...
1) The script I included was an amalgamation of 3 functions that I use in my own code, which I have put into one include script. An include script is simply a script that contains functions that other scripts make reference to. So, if you need to use any of these functions (which you do), then you need to be sure that any scripts where you call the functions must have this script called at the top of it as an include, like this:-
#include "alb_lb_hpbars"
Alternatively, you can copy each function as required and place it into the scripts individually, and call from within the same script. Using the "include" method is the better way though.
2) Now, I left it to the builder as to when HP Bars should appear for the first time, but I will give my own campaign design as an example of when to use the UpdateHPBars function for the "first" time. To cut a long method short, I call ....
UpdateHPBars(oCreature, 1);
... when a hostile creature perceives the PC for the first time only. This is the most logical time to start the HP Bars in my opinion. After all, I did not want HP Bars to appear on all creatures all the time. NB: I have additional code surrounding this function call to ensure that the function is NOT called on every perception after the first time.
3) Now that the HP Bars should be visible on the creature (once perceived), we need now only update the bars when the creature is damaged in any way. Therefore, you can now probably guess where the functions needs to be called from, but to refer you to my own usage in my own campaign, I call the following usage of function ....
UpdateHPBars(oCreature, 0);
.... from the creatures, "OnDamaged", "OnSpellCastAt" and "OnAttacked". Strictly speaking, one could probably get away with it only being placed on the creatures "OnDamaged" hook, but I have another function which is called from these three hooks that all refer to the same update HP bar function.
CONCLUSION
=========
The bottom line is to think about the answer logically ... What do HP bars represent? They represent the remaining HPs after a creature has been damaged. Therefore, the answer to use the function to Update the HP Bars must come on the hook when the creature is damaged.
Key points to understand are:-
1) The script I have provided is an include script, which should be used as an include script ... or have the functions copied and used in the individual scripts.
2) The main function that starts/updates all the displaying is the UpdateHPBars function.
3) Functions are called via "Hook Points". There are only a limited number of hook points and so the builder must try to recognise which of these points makes most logical sense to call any function needed. E.g. If we wanted to give a creature a spell effect when they enter the game (spawn into the game), then the best "hook point" to use would be the "OnSpawn" hook point.
I hope that helps to explain not just the immediate question, but also give you some background and information on how to apply functions in future add-ons.
Please feel free to ask any more questions, and I will answer as clearly as I can.
Many Thanks,
Lance.
Modifié par Lance Botelle, 15 octobre 2013 - 11:10 .
#41
Posté 15 octobre 2013 - 02:38
#42
Posté 15 octobre 2013 - 03:26
manageri wrote...
Thanks for posting this. Does anyone have any idea how big a job it would be to get this working for, say, the OC? I probably know enough scripting to update the on damaged scripts correctly, but would that mean going through tons of creatures' different scripts, or do they mostly just use the same one?
Hi manageri,
That would be something you would have to check and see I'm afraid, unless somebody has already checked that kind of thing. I imagine "most" creatures would share the same scripts, but there will be a few that may use a couple of different ones.
In theory, it should not be that difficult and require only a few script changes ... I imagine.
Let me know if you succeed.
By the way, you would need to recompile the scripts you use my include with.
Cheers,
Lance.
#43
Posté 15 octobre 2013 - 05:22
I just wasn't sure where you were hooking, whether it was on the creature' script or somewhere globally.
I ended up creating a user defined script for my creatures and then calling the HP bar UPDATE method when the perceived, attack and damage events occur for the creature. This ended up working fine.
I'm going to add one more item, which is a deathscript to perform the cleanup. The HP bars eventually cleanup, but they can linger on screen while the creature is dead, and it's immediate if you use a deathscript to clear the effect.
Good job on the effect mate. It looks good. Just what I was hoping for.
Pretty easy to use. With a user-defined script and variable set, it only takes a minute to update my creature blueprints.
One thing I did to was to *not* use the ForceUpdateHPBars() method. Since I trigger on the creature's PERCEIVE event (using UPDATE, FORCE=TRUE), this causes the HP bar to only appear once the creature perceives and turns hostile (as opposed to cycling through all the nearby creatures close to the PC). I like the way this works; creature HP bars pop up independent of each other as their perceptions fire, and it's nice, immediate feedback for determining who is really hostile.
As for using in the OC, as someone above asked: I was hoping there was a way to just hook it globally, but doing so lacks the immediacy of the creature scripts.
One can use a hook in the module's OnHeartbeat script with a combination of GetIsInCombat(PC) and then cycling through perceived targets with GetIsEnemy(CREATURE) to determine who is hostile and thus who deserves to have a HP bar on them. This would allow you to apply it to all hostile creatures when the PC is in combat.
However, this method lacks immediacy. The update can only happen on module heartbeat, which is not as immediate as the creature's scripts for perception, attack, damage and death. It's much better, in one has the ability, to code this into a creature's default behavior with a user-defined script and an on-death script.
That said, I might have to try a global incarnation just to see how it performs in the OC...
Thanks again Lance!
Modifié par ColorsFade, 15 octobre 2013 - 05:23 .
#44
Posté 15 octobre 2013 - 06:05
ColorsFade wrote...
Thanks Lance for the notes.
I just wasn't sure where you were hooking, whether it was on the creature' script or somewhere globally.
I ended up creating a user defined script for my creatures and then calling the HP bar UPDATE method when the perceived, attack and damage events occur for the creature. This ended up working fine.
I'm going to add one more item, which is a deathscript to perform the cleanup. The HP bars eventually cleanup, but they can linger on screen while the creature is dead, and it's immediate if you use a deathscript to clear the effect.
Hi ColorsFade,
Yes, I have a cleanup script in use to do this I believe as well. Just cannot recall how I implemented it at the moment.
Good job on the effect mate. It looks good. Just what I was hoping for.
Pretty easy to use. With a user-defined script and variable set, it only takes a minute to update my creature blueprints.
Glad you like it. I like the info as well.
One thing I did to was to *not* use the ForceUpdateHPBars() method. Since I trigger on the creature's PERCEIVE event (using UPDATE, FORCE=TRUE), this causes the HP bar to only appear once the creature perceives and turns hostile (as opposed to cycling through all the nearby creatures close to the PC). I like the way this works; creature HP bars pop up independent of each other as their perceptions fire, and it's nice, immediate feedback for determining who is really hostile.
That's why I left the option to force or not in, so builders could choose this or not. As I was testing it, I just preferred to have them all "hostiles" update when activated.
As for using in the OC, as someone above asked: I was hoping there was a way to just hook it globally, but doing so lacks the immediacy of the creature scripts.
One can use a hook in the module's OnHeartbeat script with a combination of GetIsInCombat(PC) and then cycling through perceived targets with GetIsEnemy(CREATURE) to determine who is hostile and thus who deserves to have a HP bar on them. This would allow you to apply it to all hostile creatures when the PC is in combat.
However, this method lacks immediacy. The update can only happen on module heartbeat, which is not as immediate as the creature's scripts for perception, attack, damage and death. It's much better, in one has the ability, to code this into a creature's default behavior with a user-defined script and an on-death script.
That said, I might have to try a global incarnation just to see how it performs in the OC...
Thanks again Lance!
You are welcome!
Lance.
#45
Posté 15 octobre 2013 - 08:19
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.
#46
Posté 15 octobre 2013 - 10:28
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,
I have not looked at any of the OC scripts, but I can tell you four things:-
1) You do not need the SetGlobalInt("HPBARSSTATE", 1); part. (That's a switch that you have to implement.)
2) You need to call the UpdateHPBars(OBJECT_SELF, 1); ONCE from the creatures OnPerceived to start the bars.
3) You need to call the UpdateHPBars(OBJECT_SELF, 0); from the creatures OnDamaged to update the bars.
4) You need to recompile all scripts that call my include.
A closer look at the OC scripts may also be required ... Do you know anybody who may be interested to do this like you with a little more scripting knowledge?
All the best,
Lance.
#47
Posté 16 octobre 2013 - 05:58
#48
Posté 16 octobre 2013 - 08:51
manageri wrote...
If I'm ok with the bars only showing up once the creature has been damaged, then I don't have to change other scripts than the on damaged one though (with ForceUpdate as 0), correct? Or is there something special about the onperceived event? If that global int isn't necessary then really all I should have to add is UpdateHPBars(OBJECT_SELF, 0); to the ondamaged script to make this work in theory, yes?
Hi manageri,
EDIT: I owe you an apology - You do need the global int set, or you can edit it out as KevL says in the post below. I have also posted you separately to be sure you got this info OK.
Yes, that is
Don't forget to add these lines to the creature's OnDeath though:-
// REMOVE ANY BARS ANYWAY (ALSO COVERS DIRECT TO DEATH BYPASS DAMAGE)
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_100");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_90");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_80");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_70");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_60");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_50");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_40");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_30");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_20");
RemoveSEFFromObject(OBJECT_SELF, "alb_hp_10");
Cheers,
Lance.
EDIT: I think I might update the readme to remind people of this. It would not always affect your situation, as you do not intend to show the bars unless damaged in the first place. However, these lines also remove the effect when the creature dies that may have had them to start with.
Modifié par Lance Botelle, 16 octobre 2013 - 10:04 .
#49
Posté 16 octobre 2013 - 09:14
I got it in the OC using
nw_c2_default2 -> onPerceived
nw_c2_default6 -> onDamaged
as override scripts. Make sure only 1 of each (or just one onDamaged, if you want..) is in override. ( nb. They should already be in TonyK's ai )
At first I placed Lance's call to UpdateHPBars() within the GetIsEnemy() scope in onPerceived, but this could be problematic with the way perceptions happen. ie, They generally happen only once each for entering sight range/leaving, and entering hearing range/leaving. So for testing i put the call just inside main(), for both ai-scripts.
I also commented out the check for the global, right in Lance's #include.
Using only the onDamaged should work fine. I've done some minor alterations to UpdateHPBars() and never have to ForceUpdate or Clear. And am not so sure you'd really need ForceUpdate for our purposes anyway... as long as a creature's "LASTHPBAR" var is empty, the sHPBAR string should kick in,
Ps. thanks Lance !
- am considering making green bars for friendlies, and blue bars for neutrals; maybe have them change color as reputation alters.
@Lance,
i created a new case for 0 hp or less and copied all the removeSEF calls into it, so far this works for Clearing the bars. As in
// ...
else if (iPERCENT > 0 && iPERCENT < 11) {sHPBAR = "alb_hp_10"; }
else
{
RemoveSEFFromObject(oCreature, "alb_hp_100");
// etc.
// ...It means guys lying on the floor don't have bars over their heads...
#50
Posté 16 octobre 2013 - 09:59
kevL wrote...
I also commented out the check for the global, right in Lance's #include.
Excellent point - I forgot I had that check in there as well. If you are not using any switching system, then this will need to be commented. I will give manageri an apology!
Using only the onDamaged should work fine. I've done some minor alterations to UpdateHPBars() and never have to ForceUpdate or Clear. And am not so sure you'd really need ForceUpdate for our purposes anyway... as long as a creature's "LASTHPBAR" var is empty, the sHPBAR string should kick in,
The "force" option is there in case you ever wanted to temporarily turn off and the turn on the HP bar. In my campaign, there are also situations where a creature may have them on for one situation, then off, and then on again.
Ps. thanks Lance !
You're welcome!
- am considering making green bars for friendlies, and blue bars for neutrals; maybe have them change color as reputation alters.
Be careful not to overload with too many bars around the place .... and don't forget us colour blind people.
@Lance,
i created a new case for 0 hp or less and copied all the removeSEF calls into it, so far this works for Clearing the bars. As in// ... else if (iPERCENT > 0 && iPERCENT < 11) {sHPBAR = "alb_hp_10"; } else { RemoveSEFFromObject(oCreature, "alb_hp_100"); // etc. // ...
It means guys lying on the floor don't have bars over their heads...
That sounds like it does similar to what I do in the creature's onDeath ... I cannot recall why I put in the OnDeath as opposed to another check in the same function, but I think it may be because it did not always work in the same function for some reason. It may have just been a glitch during testing, but I seem to recall the OnDamaged may not have *fired* if the creature goes from HPs to death without anything in between. However, I also have a lot of other things going on that may have interfered with this check at the time and maybe it is good to go.
Just try testing a creature with 1 HP and killing it. Does the function pick this up still?
Also, what happens with a creature that takes 1 HP damage, but still has > 91% remaining. Need a "death" check?
Cheers,
Lance.
EDIT:-
I am going to test this again in my own scripts:-
else if(GetIsDead(oCreature))
{
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;
}
UPDATE:- I just tested this alteration and it does work .... so I will revert to this method myself. Obviously, there must have been something else at the time that gave me issues. However, I do think you will need the "death" check to be sure not to remove bars from creatures with many HPs and little damage.
Modifié par Lance Botelle, 16 octobre 2013 - 10:22 .





Retour en haut







