Scripts / Health bars - or 'how did he do that?'

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Feb 2018 11:44 Edited at: 3rd Feb 2018 11:46
Well in case anyone is interested here is the script.

There are way to many 'magic numbers' in it for my liking but this was a quick and dirty script to prove the concept, the ScaleObject command is not in the current build of GG but may make it into the next public preview, basically it allows an object (note object id not entity id! - like the AI commands use) to be scaled in x, y, or z individually specified.

The script basically just works out the position of the health bar relative to the character it is going to appear on top of and sticks it there in real time. All the rest is just polishing the thingy.

The 'magic numbers' are really just to size and position the decals to look good on screen, if differently sized decals are used then obviously they would need to be altered to suit.

As it sits this script will not work with the current build (unless you comment out the ScaleObject lines - but that sort of defeats the purpose of it!) but the code may be useful for anyone thinking of doing something similar, for example you may have a quest-giver sort of game where you want to put a symbol over the characters head to indicate that they have a quest for you or a different symbol if you are already doing a quest for them.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM

Login to post a reply

Server time is: 2024-04-19 19:02:58
Your offset time is: 2024-04-19 19:02:58