I have spent the last six hours looking over various resources...
http://www.gamemaps.com/guide/21
https://developer.valvesoftware.com/wik ... endix:_HUD
And... I am just stumped... I know it is probably not that hard... But scripting is so far out of my league... and tis moments like this where it really shows...
So basically... I am remaking "Haunting Grounds - Sawrunner" from the ground up... General improvements all around...
And one such improvement I want to add is a health bar... Since how the fight is structured is going to be changing drastically...
Using something like the progress bar... I would have a math_counter pass the number I want displayed on the bar...
Again... I know this is probably baby work for someone that knows their scripting... but this old women just isn't with the times as it seems... x3
I know I could just use a bunch of screen overlay... HOWEVER... I am planning on having the fight be adjustable by ingame difficulty... So having four sets of health bars ranging from 15~50 pictures per set...
I figure this is the best way to handle it... especially if I need to make a change to the health pool...
If anyone could lend me some assistance... I would greatly appreciate it...
Also... on the subject of changing based on the difficutly... If someone could also drop that one...
I know I have seen it before... And I already know it is going to take me a while to find it again... it will just save me time if you are feeling generous... ;3
Simple script to display a health bar...
19 posts
• Page 1 of 2 • 1, 2
Re: Simple script to display a health bar...
Scratch the difficulty portion... Just found the code i was looking for there...
Re: Simple script to display a health bar...
I too am intrigued by the possibility of a boss health bar script.
You... I know you.
Re: Simple script to display a health bar...
I've still been messing around with this... Feel like I am completely blind, and patting around on the wrong side of the room... :\
However... I atleast finally got the console to acknowledge that I am trying to make a HUD appear...
I have this code running
Yes... It is just copy/paste from the guide...
http://www.gamemaps.com/guide/21
But I am trying to figure out how to even get the HUD to show up in the first place...
So I guess it is a step in the right direction... but I still have no idea what it is I need to be doing to atleast get the damn thing to show in the first place... If I can atleast see the bloody thing, I can trial and error this... But until then... I might as well still be on square one...
However... I atleast finally got the console to acknowledge that I am trying to make a HUD appear...
- Code: Select all
CRuleScriptBridge initializing...
Loaded VSLib version 3.000000
SCRIPT PERF WARNING --- "main" ran long at 21.905593ms
SCRIPT PERF WARNING --- "main" ran long at 22.334245ms
Reload Scripted HUD!
I have this code running
- Code: Select all
IncludeScript( "VSLib" );
::progress <- VSLib.HUD.Bar();
progress.AttachTo(HUD_TICKER);
progress.SetBarValue(34);
Yes... It is just copy/paste from the guide...
http://www.gamemaps.com/guide/21
But I am trying to figure out how to even get the HUD to show up in the first place...
So I guess it is a step in the right direction... but I still have no idea what it is I need to be doing to atleast get the damn thing to show in the first place... If I can atleast see the bloody thing, I can trial and error this... But until then... I might as well still be on square one...
Re: Simple script to display a health bar...
Sorry for the late response. I saw this topic when it was first made, but then it slipped my mind. Let's see if I can assist you now.
When are you including the .nut file in your map? And what is the name of your .nut file?
It is possible it isn't running in the Mutation System, so it doesn't activate all of the functions. If that is the case try renaming the file to "hg_boss_sawrunner_coop.nut" or whatever your mapname is. This should force the Mutation System to run for that map for Campaign mode.
I ran a quick test with that example code and the HUD Ticker appeared for me, so that's why I think you need to force the Mutation System.
If that helps try using the following code:
This would make the map function if you use mods like my Admin System that also use VSLib. Or else some things may break.
Let me know if you have questions.
When are you including the .nut file in your map? And what is the name of your .nut file?
It is possible it isn't running in the Mutation System, so it doesn't activate all of the functions. If that is the case try renaming the file to "hg_boss_sawrunner_coop.nut" or whatever your mapname is. This should force the Mutation System to run for that map for Campaign mode.
I ran a quick test with that example code and the HUD Ticker appeared for me, so that's why I think you need to force the Mutation System.
If that helps try using the following code:
- Code: Select all
// Include the VScript Library
if (!("VSLib" in getroottable()))
{
IncludeScript("VSLib");
::LoadHGVSLib <- {};
}
else
{
if ("LoadHGVSLib" in getroottable())
{
IncludeScript("VSLib");
}
}
::progress <- VSLib.HUD.Bar();
progress.AttachTo(HUD_TICKER);
progress.SetBarValue(34);
This would make the map function if you use mods like my Admin System that also use VSLib. Or else some things may break.
Let me know if you have questions.
Re: Simple script to display a health bar...
The name makes sense when I think about it... Custom finale scripts and level sound files have to share the same name... Why not this as well?...
So... I think my main problem right now is that I don't know how to "set it up"... or "activate it" when in game...
It is more than likely all wrong... but below is what I have done so far... Changing the name to match the map and using the code you provided...
---
So... I renamed the file to "eotl_aftermath_coop.nut" (Another map needs one of these as well... and this one is on a schedule... :\)
Map name is "eotl_aftermath"... Launching through console "map eotl_aftermath coop" to insure that it is indeed in coop
In game... "ent_fire director runscriptfile eotl_aftermath_coop.nut" gives me this...
But only the first time... After dieing... Trying a second time gives me this...
----
Obviously... Since I am essentially don't know where the power button is... It isn't showing...
So what entities am I missing... and How do I go about actually activating this?...
So... I think my main problem right now is that I don't know how to "set it up"... or "activate it" when in game...
It is more than likely all wrong... but below is what I have done so far... Changing the name to match the map and using the code you provided...
---
So... I renamed the file to "eotl_aftermath_coop.nut" (Another map needs one of these as well... and this one is on a schedule... :\)
Map name is "eotl_aftermath"... Launching through console "map eotl_aftermath coop" to insure that it is indeed in coop
In game... "ent_fire director runscriptfile eotl_aftermath_coop.nut" gives me this...
- Code: Select all
] ent_fire director runscriptfile eotl_aftermath_coop.nut
SCRIPT PERF WARNING --- "main" ran long at 13.673096ms
AN ERROR HAS OCCURED [the index 'TRACE_MASK_VISIBLE_AND_NPCS' does not exist]
CALLSTACK
*FUNCTION [main()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/scripts/vscripts/VSLib/Entity.nut line [2035]
*FUNCTION [DoIncludeScript()] NATIVE line [-1]
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/scripts/vscripts/VSLib.nut line [38]
*FUNCTION [DoIncludeScript()] NATIVE line [-1]
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/scripts/vscripts/eotl_aftermath_coop.nut line [4]
LOCALS
[vargv] ARRAY
[this] TABLE
[scope] TABLE
[name] "VSLib/Entity.nut"
[this] TABLE
[vargv] ARRAY
[this] TABLE
[scope] TABLE
[name] "VSLib"
[this] TABLE
[vargv] ARRAY
[this] TABLE
AN ERROR HAS OCCURED [Failed to include script "VSLib/Entity.nut"]
CALLSTACK
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/scripts/vscripts/VSLib.nut line [38]
*FUNCTION [DoIncludeScript()] NATIVE line [-1]
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/scripts/vscripts/eotl_aftermath_coop.nut line [4]
LOCALS
[scope] TABLE
[name] "VSLib/Entity.nut"
[this] TABLE
[vargv] ARRAY
[this] TABLE
[scope] TABLE
[name] "VSLib"
[this] TABLE
[vargv] ARRAY
[this] TABLE
SCRIPT PERF WARNING --- "main" ran long at 95.874627ms
AN ERROR HAS OCCURED [Failed to include script "VSLib"]
CALLSTACK
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/scripts/vscripts/eotl_aftermath_coop.nut line [4]
LOCALS
[scope] TABLE
[name] "VSLib"
[this] TABLE
[vargv] ARRAY
[this] TABLE
SCRIPT PERF WARNING --- "main" ran long at 120.938000ms
But only the first time... After dieing... Trying a second time gives me this...
- Code: Select all
] ent_fire director runscriptfile eotl_aftermath_coop.nut
CRuleScriptBridge initializing...
Loaded VSLib version 3.000000
SCRIPT PERF WARNING --- "main" ran long at 102.192889ms
SCRIPT PERF WARNING --- "main" ran long at 102.640578ms
Reload Scripted HUD!
----
Obviously... Since I am essentially don't know where the power button is... It isn't showing...
So what entities am I missing... and How do I go about actually activating this?...
Re: Simple script to display a health bar...
You also need a script called coop.nut for it to enable the mutation system (scripted mode). The contents of it doesn't matter, it just needs anything it considers a valid script in it, just putting a comment in there with // in front is enough.
Note that using this method of loading scripts only works with the modes you add scripts for, so for example for realism, you'd need a realism.nut and eotl_aftermath_realism.nut as well.
Note that using this method of loading scripts only works with the modes you add scripts for, so for example for realism, you'd need a realism.nut and eotl_aftermath_realism.nut as well.
Re: Simple script to display a health bar...
That did the trick... Upon creating the coop.nut file... it was just there when I loaded the map...

And it looks like it should when I disable my font mod...

But it being there on map launch... Probably not the best...
There must be a way to get it to appear once activation, right... AND deactivate if needed?... Actually I am pretty sure there is... I'm just not aware of what the function is...

And it looks like it should when I disable my font mod...

But it being there on map launch... Probably not the best...
There must be a way to get it to appear once activation, right... AND deactivate if needed?... Actually I am pretty sure there is... I'm just not aware of what the function is...
Re: Simple script to display a health bar...
Ah yes thanks Rectus, I forgot about needing the coop.nut file. Sorry about that. :/
Okay now you shouldn't have to run "ent_fire director runscriptfile eotl_aftermath_coop.nut" anymore. Since the script autoruns at map start. Here's the code you can use to enable/disable the HUD:
Then you can set up entity I/O and use "ent_fire director runscriptcode EOTLEnableHUD" and "ent_fire director runscriptcode EOTLDisableHUD" whenever you want.
Okay now you shouldn't have to run "ent_fire director runscriptfile eotl_aftermath_coop.nut" anymore. Since the script autoruns at map start. Here's the code you can use to enable/disable the HUD:
- Code: Select all
// Include the VScript Library
if (!("VSLib" in getroottable()))
{
IncludeScript("VSLib");
::LoadHGVSLib <- {};
}
else
{
if ("LoadHGVSLib" in getroottable())
{
IncludeScript("VSLib");
}
}
EOTLEnableHUD <- function ()
{
::progress <- VSLib.HUD.Bar();
progress.AttachTo(HUD_TICKER);
progress.SetBarValue(34);
}
EOTLDisableHUD <- function ()
{
HUD.Remove(HUD_TICKER);
}
Then you can set up entity I/O and use "ent_fire director runscriptcode EOTLEnableHUD" and "ent_fire director runscriptcode EOTLDisableHUD" whenever you want.
Re: Simple script to display a health bar...
Thank you both so far... really... -^w^-
However Rayman... The new code does not appear to work properly for me...
Upon loading the map... The HUD is not visible, but both of the runscriptcode commands give me a console error more or less exactly the same as the ones I have mentioned before...
I may not a scripting noob... But I can still see that what you gave me should be working just fine... So the problem must be somewhere else...
The map name and the file name are exactly the same as they were when it worked, and changing the file to the way it was shows the HUD again... So if the new code works perfectly fine for you when testing it... Then there must be some entities in the map I am lacking?...
However Rayman... The new code does not appear to work properly for me...
Upon loading the map... The HUD is not visible, but both of the runscriptcode commands give me a console error more or less exactly the same as the ones I have mentioned before...
I may not a scripting noob... But I can still see that what you gave me should be working just fine... So the problem must be somewhere else...
The map name and the file name are exactly the same as they were when it worked, and changing the file to the way it was shows the HUD again... So if the new code works perfectly fine for you when testing it... Then there must be some entities in the map I am lacking?...
19 posts
• Page 1 of 2 • 1, 2