Neverwinter Vault

Expand AllContract All -Site -My Profile -Features

Neverwinter Nights 2

-NWN2 Files -NWN2 Game Info -NWN2 Resources -NWN2 Community

Neverwinter Nights

-NWN Files -NWN Game Info -NWN Resources -NWN Community

Vault Network
RPG Vault
VN Boards
IGN Vault
Vault Wiki
· Age of Conan
· Anarchy Online
· Asheron's Call
· Dark Age of Camelot
· City of Heroes
· D&D
· EVE Online
· EverQuest
· EverQuest 2
· Final Fantasy
· Guild Wars
· Lineage 2
· Lord of the Rings Online
· Middle Earth
· Neverwinter Nights
· Pirates of the Burning Sea
· Rise of the Argonauts
· Star Wars Galaxies
· Tabula Rasa
· The Matrix Online
· The Witcher
· Titan Quest
· Two Worlds
· Vanguard
· Warhammer
· World of Warcraft

Planet Network
Planet Hub

IGN
Games
Cheats
Entertainment

The Web   The Site  



NWN SCRIPTS

- Jump to comments -
Title  UpdateHP Script System v4
Author  Magical Master
Submitted / Updated  03-13-2013 / 03-18-2013
Category  Scripting routines
Expansions  Works on all versions
Format  Module and Code
Type  Type - Hit Point Tracking
Includes  None
Description
I developed this system for my recent February Adventure Building Challenge (Link) module, Siege of the Heavens (Link) to display health percentages and increase the maximum health a creature can have. I figured other people might find it useful so I thought I'd share it. You should be able to easily integrate the health percentage half into any module (regardless if you built it) - can easily install it in any module in a few minutes at most - while the massive health pools part takes slightly more work, mainly if you want healing to work properly with it.

Installation is literally this for the health percentages:

1. Download file from vault
2. Open module in toolset
3. Import erf with the script
4. Copy/paste one line of code into the OnSpawn script
5. Copy/paste a six line block of code into the OnPerception script

Done!

----------------------------------------

Introduction:

UpdateHP is a system with two primary features - the ability to display the health percentage of creatures and to allow effective hit points far beyond what the toolset can provide by default (toolset limit is roughly 13,000 whereas this system can support a little over two billion if somehow needed) without actually appearing to do anything special. These two features are independent - you can use either or both of them as you desire. The system can also be used to defend against the default Devastating Critical - see "Immortality" under Miscellaneous Information (though using the entire script for just that purpose is somewhat overkill). The system is extremely easy to set up and configure in general, though if you use MassiveHP there are some special details you should know (regarding interaction with other scripts/effects, primarily healing and extreme burst damage).

In general, the system works by starting the script once the creature perceives an enemy or PC. It then checks the creature every second (the frequency can be adjusted as per your needs). If the creature's hit points have changed (taken damage or been healed) and the health percentage has changed, it updates the creature's health percentage. If MassiveHP is enabled and the creature's hit points have changed, it updates the creature's effective hit points. If hit points have not changed, it simply checks again in a second. The checking speeds up to every half second if the creature is using MassiveHP and is below 3000 raw hit points.

If there are no PCs in the with the creature, the script shuts down and starts back up once the creature perceives another enemy or PC. This prevents the script from using resources when it does not need to be running (it does not start until needed and stops when not needed).

If you use this system, I ask that you do not make major modifications to the script without asking me - I would prefer to be able to incorporate any significant improvements into the base system so everyone can take advantage of it (giving credit for the improvement, of course). This does not apply to the frequency at which the script runs, adjust that as you would like. There is also a function called "Special" which can be freely customized to suit your module if you need something special done every time the bulk of the script runs. And, of course, feel free to comment out either ShowHP or MassiveHP if you only care about one of the features. Thank you.

----------------------------------------

Video below is slightly out of date - the general concept is the same but the script is called in the OnPerception instead of OnSpawn and the script shuts down if no PCs are in the creature's area. See change log for v1 to v2.

Video demonstration: Link

Bioware forum thread: Link

--------------------------------------

Acknowledgements

- Thanks to FunkySwerve for information regarding speed of different functions and some general ideas on improving performance for creatures not in combat

----------------------------------------

Change Log:

v3 to v4
- Fixed bug in advanced option introduced in v3 that would call the script on any creature in the area, even those who weren't meant to have the script run on them (potentially henchmen, summons, etc). No impact if you weren't using the advanced option

v2 to v3
- Chunk of code provided in script header to place in OnEnter script for areas to avoid having an incorrect health percentage for a few seconds if a player attacks a regenerating creature and retreats (leaving the area entirely) without killing it and returns before the monster despawns (player would see an incorrect health percent for a few seconds upon returning before the script started running again)

v1 to v2
- Called with OnPerception when an enemy or PC approaches to avoid using resources until needed
- Shuts down if all PCs leave the creature's area and starts back up when approached again
- Calls itself every second by default once triggered (compared to previous 0.5 seconds), speeding up to 0.5 seconds if the creature is using MassiveHP and below 3000 raw hit points

Files

NameTypeSizeDownloads
mm_updatehp_v4.7zmm_updatehp_v4.7z
Submitted: 03-13-2013 / Last Updated: 03-18-2013
7z52.84Kb30
File containing an erf with the script, a demo module, and a ReadMe.
SCORE OUT OF 10
9.5
3 votes
View Stats
Cast Your Vote!

PORTFOLIO
Add this entry to your portfolio so you can track it
Manage your existing portfolios or create a new one.
SCREENS

Enemy at 100%


Enemy at 68%


Enemy at 31.7%


Enemy at 8.8%





You Must Be Logged In to Participate.
Comments (8):

Posted by simomate at 2013-03-20 23:18:19    Voted 10.00 on 03/20/13
Voted 10, I'm using this for my module, and this script works perfectly. Cheers! :D

Posted by Magical Master at 2013-03-17 23:54:23    
Added v4. Needed to fix a potential bug introduced in v3 that ONLY occurs if you use the advanced option. Specifically, the advanced option would call the script on any creature in the area, even if the script was not meant to run on the creature. New version will only run on creatures who previously had the script running on them.

- Fixed bug in advanced option introduced in v3 that would call the script on any creature in the area, even those who weren't meant to have the script run on them (potentially henchmen, summons, etc). No impact if you weren't using the advanced option

Posted by Magical Master at 2013-03-17 10:50:58    
Version 3 is up. Chunk of code provided to cover a fringe scenario. Extra work for little gain, but possible if you want to do it:

- Chunk of code provided to place in OnEnter script for areas to avoid having an incorrect health percentage for a few seconds if a player attacks a regenerating creature and retreats (leaving the area entirely) without killing it and returns before the monster despawns (player would see an incorrect health percent for a few seconds upon returning before the script started running again)

Posted by Magical Master at 2013-03-16 22:44:38    
Version 2 is up. Takes one additional (simple) step to install with the following improvements:

- Called with OnPerception when an enemy or PC approaches to avoid using resources until needed
- Shuts down if all PCs leave the creature's area and starts back up when approached again
- Calls itself every second by default once triggered (compared to previous 0.5 seconds), speeding up to 0.5 seconds if the creature is using MassiveHP and below 3000 raw hit points

Posted by Magical Master at 2013-03-15 22:41:24    
To clear: the efficiency concern is designed to avoid consuming resources on creatures not actually fighting - it's already very efficient in combat (though it'll be slightly more efficient 75% of the combat tomorrow).

Posted by Magical Master at 2013-03-15 22:40:07    
Pulled the file for now - will repost with some major efficiency improvements tomorrow.

Goals:
- Won't execute until PCs engage enemy, so you can spawn enemies up ahead without eating up any resources
- Won't execute if PCs leave the area, meaning not cleaning up creatures shouldn't be a problem.

More info tomorrow.

Posted by ShaDoOoW at 2013-03-15 07:26:47    Voted 9.00 on 03/15/13
9 for the concept, the method required to get it work is less desired, but useable for sure.
_________________________
[Boost System] [Door System] [Devastating Critical Immunity] [HIPS remake] [Circle Kick Mode] [1.69 Full 2da Source]

Posted by ffbj at 2013-03-15 06:37:39    Voted 9.50 on 03/15/13
Nice Work!

You must be Logged In to post comments in this section.

 
Most recent posts on the MMO General Boards
Analyst: Star Wars: The Old Republic Could...Analyst: Star Wars: The Old Republic Could Sell 3M: more numbers
- last reply by Acao on Aug 15, 2011 06:15 PM
which class will your first character be
- last reply by Blisteringballs on Aug 15, 2011 05:50 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 05:00 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 04:00 PM
NWN Idea Database Update
- posted by Vault_News on Aug 15, 2011 03:46 PM
Missing Votes for NWN2 Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:40 PM
Missing Votes for NWN Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:39 PM
Random Questions and game altering suggest...Random Questions and game altering suggestions!!!
- last reply by ArkadyTepes on Aug 15, 2011 03:22 PM
State of the game?
- last reply by LyricOpera on Aug 15, 2011 01:37 PM
Yesterday streaming, now demanding downloa...Yesterday streaming, now demanding download :(
- last reply by Sinane-tk on Aug 15, 2011 10:23 AM
 

   


IGN Entertainment
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2011, IGN Entertainment, Inc. | Support | Privacy Policy | User Agreement | RSS Feeds
IGN’s enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.


NWN2 Hall of Fame

HOF NWN2 Prefab Blueprints


View all Hall of Fame entries


Neverwinter Nights 2

TOP NWN2 Modules

NEW Modules

NEW Reviews

NEW INTL. Modules

TOP Hakpaks

TOP Gameworlds

TOP Tutorials

TOP Prefab:Areas

TOP Blueprints

TOP Plugins

TOP UI

TOP Other

TOP Visual Effects

TOP Scripts

TOP Tools

TOP Movies

TOP Models

TOP Characters





Hall of Fame

HOF NWN Modules


View all Hall of Fame entries


TOP NWN Modules

NEW NWN Modules

NEW Reviews

TOP Intl. Modules

TOP NWN Hakpaks

TOP NWN Gameworlds

TOP NWN Models

TOP NWN Portraits

TOP NWN Scripts

TOP NWN Prefabs

TOP NWN Other

TOP NWN Movies

TOP Sounds

TOP NWN Textures

TOP NWN Creatures

TOP NWN Characters