Overheat system for HL Goldsource Created 7 years ago2017-01-28 22:58:02 UTC by abbadon abbadon

Created 7 years ago2017-01-28 22:58:02 UTC by abbadon abbadon

Posted 7 years ago2017-01-28 23:01:24 UTC Post #333214
Hi. I was doing an Overheat system for weapons for Goldsource Half-Life that is, well, more or less successful.

The weapons overheat and stop firing, BUT, there are some glitches.

-Heat NOT increases if you keep the FIRE and ALT FIRE button pressed, it only raises EACH time you press those buttons.
-Heat NOT decreases if you release the FIRE and ALT FIRE buttons.

Here´s a picture of it "working"
User posted image
The code is this:

Input.cpp

Replace the original functions:

[quote]
void IN_AttackDown(void)
{
KeyDown( &in_attack );
gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK );
}

void IN_AttackUp(void)
{
KeyUp( &in_attack );
in_cancel = 0;
}
[/quote]

With:

[quote]

void IN_AttackDown(void)
{
if(gHUD.g_iHeat < 100)//Heat must be less than 100
{//ZWC OVERHEAT
	KeyDown(&in_attack);
	gHUD.g_iHeat += gHUD.m_flTimeDelta * 300;
}//ZWC OVERHEAT

if (gHUD.g_iHeat > 100)

{
	gHUD.g_iHeat	 = 100;// Avoid amounts over 100
in_attack.state &=  ~1;// Release ATTACK button
}

gHUD.m_Spectator.HandleButtonsDown( IN_ATTACK );
}

void IN_AttackUp(void)
{
KeyUp( &in_attack );
gHUD.g_iHeat -= gHUD.m_flTimeDelta * 100; //ZWC OVERHEAT.Cooldown
if (gHUD.g_iHeat  < 0 ) gHUD.g_iHeat = 0; //Heat not under 0
in_cancel = 0;
}
[/quote]

health.cpp

Under:
FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);
Put:
FillRGBA(w/2.46 , h/1.1,(2.4 * gHUD.g_iHeat),5,255,0,0,255);
hud_redraw.cpp

Under:
#include "vgui_TeamFortressViewport.h"
Put:
int g_iHeat;//ZWC OVERHEAT
hud.h

Under:
[quote]
float GetSensitivity();
[/quote]
Put:
[quote]
int g_iHeat;//ZWC OVERHEAT
[/quote]

It´s not much what I´ve done, even the little modifications I did to the original tut.

Any ideas on what is failing?. This code is quite old, i have just cleaned it a bit and make the status bar look better (it was bigger the first time).
Posted 7 years ago2017-01-29 00:39:48 UTC Post #333217
What basically you have done is that you created your overheat system client-side which is completely wrong. Let me explain you the roles of "client" and "server" in games.

The client is the part of the game responsible for "telling" to the player what is happening and sometimes share that information to other clients through the server. In other words, it's the HUD, effects, renderer, input processing...

The server part is responsible for handling how your game behave and tell that to all clients. This includes weapons, NPCs, entities, game rules...

So the logic of your overheat system has to be done server side and telling how much your weapon is overheating should be done client side.

What you could do is add a variable to your weapon's class (that int m_iHeat; is fine). Every time you fire your weapon, you would increment that variable by one (or two, three, four, I leave the choice to you). If you are not using "idle" animations in the same style as Half-Life (in other words: guns moving), you can use the weapon's WeaponIdle method and decrement your m_iHeat variable. In the case you are using "idle" animations in the same style of Half-Life, you don't want to interfere with those animations, in that situation you will have to add another variable such as m_flNextHeatDecrement that would act like m_fl?extPrimaryNextAttack, m_flNextSecondaryAttack or m_flTimeWeaponIdle.

Now to pass the "how much heat my weapon has", you have to use a "HUD message" (those gmsgBlahblah thing). Look at the flashlight's battery to see how it's done.
Posted 7 years ago2017-01-29 01:07:17 UTC Post #333218
Oh. Again, wrong. :(

I have to work on all that. But, the HUD part is ok, or must I use it in the server-side instead?

I left this part undone for almost two years and now that I re-encounter it I am lost again.
Posted 7 years ago2017-01-29 09:08:48 UTC Post #333220
The HUD oart is good, you don't need to change "hud_redraw.cpp" neither "input.cpp"
Posted 7 years ago2017-01-29 13:38:28 UTC Post #333221
Thanks to all gods old and new. I was afraid I have to do it in other part of the code (I have the hud health bar there since 2005 and it is one thing I can modify without struggling so much).

I will try the server part putting the iHeat on weapos.h player.h ( this way heat will not restet when I change the weapon, right?) and then, as you said, the heat increasing part on fire and cooldown on idle. Wish me luck!.

BTW: why the heat is not decreasing\increasing?, You know I am no expert but I thought that the timedelta part should do the job. :/
Posted 7 years ago2017-01-29 16:40:25 UTC Post #333223
No luck. If I try to pass the heat control to the weapon in the server part the game crashes even before loading the game menu, all after a lot of "undeclared" stuff, finding ways to make the heat vary throgh gpGlobals thingy and weapontimebase shit, etc. (maybe too much for my poor skull). Then I returned to the client version and work fine except , of course, that it don't decreases/increases... for the rest it works fine :(

Btw: why should not use it on the client side?, if it is because it could be overriden by cheaters, sincerely, I don't care.

Damn!, It works!, just id does not work 100% well. :(
Posted 7 years ago2017-01-29 18:17:45 UTC Post #333226
I have made a very basic overheating system for HL's 9mmAR, the only thing you have to do is to understand it and make the code that updates your HUD.

Remember to declare the "Cooldown" method and "int m_iHeat" and "float m_flCooldownTime" variables in your weapon's class.

There is also a minor issue due to the client prediction system, if you hold the attack button, the animation/sound/shell ejection will still be done even if the weapon overheat but the shot itself isn't done (try shooting a NPC when the weapon has heated to see what I mean). To fix that, either you disable the client side prediction system (the CLIENT_WEAPONS define) or you perform all the animations/sounds on the server (this means removing the weapon event).

If anyone want to use this in a singleplayer mod, I highly recommend to add the variables in the save table for save/restore purposes.

Also abbadon, the code I just provided isn't mine. Yes you've read it right, if you have some time to spare (no worries if you don't, it's fine), I would like you to find where my "inspiration" came from. If anyone else found the answer, please don't spoil it ^^
Posted 7 years ago2017-01-29 19:39:25 UTC Post #333230
I have made a very basic overheating system for HL's 9mmAR, the only thing you have to do is to understand it and make the code that updates your HUD.
For the understanding part, well, I think I will understand it (cross fingers again), but for the "making the code", expect some major disasters here, haha!! :crowbar:

If the code is made by you, it is yours. Mine came from a Wavelenght tutorial, dashkey part 2...

http://articles.thewavelength.net/311/

I think that it must not be your inspiration because, as you see, the code I struggled to make based on this tut is 100% client side... :/

For:
To fix that, either you disable the client side prediction system (the CLIENT_WEAPONS define) or you perform all the animations/sounds on the server (this means removing the weapon event).
Do you mean the void ev_firemp5(struct event_args_s *args); part?

Or the #if defined(client_weapons) flag =fev_nohost; part?

Or the playback_event_full (etc.) part?

BTW: let me study it and make a copy, please ;) BTW, author or not you are again on credits, and, finally, I can finish the credits video!! Weeeeeeeehaaa!!!! ( ahem!, sorry for being so enthusiastic).
Posted 7 years ago2017-01-29 22:46:41 UTC Post #333235
Works flawlessly!!, I have modified a bit some numbers to fit what I need but works sooooooo fine.

For the glitch you did say I have only put 3 instead of 0.15f in the nextprimary attack, and worked OK (more than OK!! :) ). Now it´s time for the hud bar. If I add:
FillRGBA(w/2.46 , h/1.1, (2.4 * m_iHeat), 5, 255, 0, 0, 255);//ZWC OVERHEAT
in the weapon code under:
ALERT( at_console, "Heat = %d - Game time = %f - Cool down time = %2f\n", m_iHeat, gpGlobals->time, m_flCooldownTime );
In the hl workspace... there are three errors appearing.
C:\DevZWC20\Elementos\Single-Player Source\dlls\mp5.cpp(411) : error C2065: 'FillRGBA' : undeclared identifier
C:\DevZWC20\Elementos\Single-Player Source\dlls\mp5.cpp(411) : error C2065: 'w' : undeclared identifier
C:\DevZWC20\Elementos\Single-Player Source\dlls\mp5.cpp(411) : error C2065: 'h' : undeclared identifier
On the cl_dll workspace I obtained the error:
C:\DevZWC20\Elementos\Single-Player Source\cl_dll\health.cpp(312) : error C2065: 'm_iHeat' : undeclared identifier
I have declared it on hud.h, of course.

Well, I know what is causing this in the server workspace (all those w , h, and FILLRGBA things are in the client part), but, how can I "connect" the int Heat with the FILLRGBA part in the client side?. :(
Posted 7 years ago2017-01-29 23:09:03 UTC Post #333236
What you tried is to mix client side elements with server side elements which is incorrect as you have noticed by yourself.

For "educational" purposes, I'm not gonna give you the code this time, however, I'm gonna give you some "pieces of code" that will guide you to the right path, if you reconstruct them properly, you will have your overheat system ready and operational.

What you need client side is a heavily modified copy/paste of "CHudHealth" to "CHudOverheat". Remember that you will need to "Init" and "VidInit" your new "HUD module".

What you need server side (3 places that need to be placed at specific locations):

int gmsgOverheat = 0;

gmsgOverheat = REG_USER_MSG( "Overheat", 1 ); // 1 byte is enough

MESSAGE_BEGIN( * Find the proper parameters * );
WRITE_BYTE( * Find the proper variable * );
MESSAGE_END();

Hint 1: for the last piece, you might have to use #ifndef CLIENT_DLL #endif so that the client project won't cry because "Can't find this".

Hint 2: if you are in doubt, look at existing "HUD modules" (CHudHealth) and existing "HUD messages" (gmsgWhatever).

Hint 3: get ready to party hard if you achieve it ^^
Posted 7 years ago2017-01-29 23:16:41 UTC Post #333237
You are very bad :crowbar: , haha!!, no, seriously, you gave me faaaar more help than I deserve, thanks, thanks, thanks. :)

I will start to do as you say. Oh!, and you must do a tutorial of this!! (except the hud bar, of course ;) ), I have seen others freaking because they´ve done something similar without giving a clue to others, this works is perfect and will serve others to make better mods, well, it´s just a suggestion ;).
Posted 7 years ago2017-01-29 23:40:26 UTC Post #333239
Just one last word... pendulum and nihilant!!!! ;) did I hit the target?
Posted 7 years ago2017-01-30 00:20:45 UTC Post #333240
Nope you haven't hit the target.

Hint: You can use it to hurt people.

As for writing a tutorial, I don't have the time for that with university, Half-Rats: Parasomnia 1.1, the next Half-Rats's game (not sure if I'm gonna be involved at 100% tho), ARRANGEMENT, a very old Unity game and my own HL1 mod. I may be "forced" to abandon TWHL World, the "HL: Reimagined" competition and some other projects because of that. Yeah I know, when it comes to time management, I'm a terrible person. Furthermore, the overheat system is nothing more than a "HUD module", a "HUD message" and some operations with the server side timer.
Posted 7 years ago2017-01-30 11:54:13 UTC Post #333243
I hope the KILLING BEES will hit that target... ;)

Anyway, I can not understand how can u do all those things at the same time!, seriously :o

For the code I am working on, I have made a clone of CHUDHealth deleting unused parts (I want only the code to draw a bar, the rest of the code related to each type of damages, damage sprite, and so on is not used at all)and obtained more than 180 errors, of course it was my first attempt and still did not try the serverside part (you warned me about it), so it is not a problem of the clientside code (still,I hope it´s not).

What I am not sure how to use it is the SPRITES part (MESAGE_BEGIN, etc.) because this block of code is used by sprites mainly (afaik), and I don´t know how to make it draw an horizontal or vertical bar, maybe with a giant sprite similar to the flashlight´s one, I must see how it is done. :/

Anyway, if I surrender I think I will study how to put the heat number in a good place to be seen (not in top left corner) and modify the HUD layer of the mod (a tga file) so it will look cool, something like 400ºF in RED and 0º in BLUE (yes, probably that´s not extensive and wise coding, but I spoke about surrenderring!!, haha ). XD

BTW: give us updates of your OWN mod (or a good link) ;)
Posted 7 years ago2017-01-30 12:49:59 UTC Post #333244
What I am not sure how to use it is the SPRITES part (MESAGE_BEGIN, etc.) because this block of code is used by sprites mainly (afaik)
MESSAGE_BEGIN is not related to sprites, it's related to "HUD messages".

I'm gonna give you another hint, server side:

MESSAGE_BEGIN( MSG_ONE, gmsgOverheat, NULL, ENT( * The player * ) );
WRITE_BYTE( * Heat variable * );
MESSAGE_END();

Translation of the code above: tell ONE client (MSG_ONE) to send the "gmsgOverheat" message, I don't care about the origin (NULL) and the message's recipient is "the player", oh and tell him that his gun has "m_iHeat" % of heat, that will be all.

Client side:

DECLARE_MESSAGE( "Overheat", Overheat ); // I can receive "Overheat" messages

int CHudOverheat::MsgFunc_Overheat( * Parameters that I can't remember * )
{
BEGIN_READ( /* Parameters that I can't remember */ ); // I received an "Overheat" message
m_iHeat = READ_BYTE(); // Oh, there is a "m_iHeat" information, I'll need that
return 1; // I'm done
}
BTW: give us updates of your OWN mod (or a good link)
Nothing to show (yet), sorry.
Posted 7 years ago2017-01-30 13:28:58 UTC Post #333245
As we say in spain: "te tienes ganado el cielo", or "You have earned go to paradise". ;)
MESSAGE_BEGIN is not related to sprites, it's related to "HUD messages".
Oh, I said taht because I did see this part of the code always with the showing-sprites part of many elements of the SDK, like the apache´s explosion when dead, the houndeye shockwaves, the bullsquid´s spit, etc. Of course, It did not occur to me to relate MESSAGES with HUD messages (It´s true, sometimes the branches won´t let me see the forest).
Nothing to show (yet), sorry.
Oh, c´mon!, there must be something!, anyway, if you need help making models or any gfx thing you only need to ask me, as you have seen I´m not bad at modelling, and I´m quite good making conceptual designs of any kind like buildings, weapons,vehicles, characters, monsters, etc. (apart of my real work I´m more a Comic drawer and designer).
Posted 7 years ago2017-01-30 17:10:37 UTC Post #333249
Oh, c´mon!, there must be something!, anyway, if you need help making models or any gfx thing you only need to ask me, as you have seen I´m not bad at modelling, and I´m quite good making conceptual designs of any kind like buildings, weapons,vehicles, characters, monsters, etc. (apart of my real work I´m more a Comic drawer and designer).
Hmm... I could use some custom animations for one of the projects I mentioned, but I have to make the PoCs (Proof of Concept) first so we make sure not to waste time.
Posted 7 years ago2017-01-30 18:11:32 UTC Post #333251
Ok. I will wait for any news you´ll post.

I have started to implement all the new code:

The overheat.h and overheat.cpp are here:

http://pastebin.com/T88pSi31

http://pastebin.com/dEKTrMxz

I declared the server side elements in player.cpp
int gmsgOverheat = 0;//ZWC OVERHEAT (c) Shepard 62700FR
gmsgOverheat = REG_USER_MSG( "Overheat", 1);//ZWC OVERHEAT (c) Shepard 72700FR
Yes, they´re (c)you. Admit no complaints about this. ;)

Tried to compile server dll (which does flawlessly) and client dll, AND, I have no troubles now with the FILLRGBA part, this part shows no problems and seemed to recognize the m_iHeat integer, BUT: I,ve found several errors... In my defense I have to say that I performed several re-writing, and checks before posting this:
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\hud.h(650) : error C2146: syntax error : missing ';' before identifier 'm_Overheat'
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\hud.h(650) : error C2501: 'CHudOverheat' : missing storage-class or type specifiers
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\hud.h(650) : error C2501: 'm_Overheat' : missing storage-class or type specifiers
Points here:

[quote]
int GetSpriteIndex( const char *SpriteName ); // gets a sprite index, for use in the m_rghSprites[] array
CHudAmmo		m_Ammo;
CHudHealth		m_Health;
CHudSpectator	m_Spectator;
CHudGeiger		m_Geiger;
CHudBattery		m_Battery;
Here--> CHudOverheat m_Overheat;//ZWC Overheat (c) Shepard62700FR
[/quote]

Then I did also receive:
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(39) : error C2039: 'm_Overheat' : is not a member of 'CHud'
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(39) : error C2228: left of '.MsgFunc_Overheat' must have class/struct/union type
And ppints here:
DECLARE_MESSAGE(m_Overheat,Overheat)
Even if it is perfectly declared on overheat.h
int MsgFunc_Overheat(const char *pszName, int iSize, void *pbuf);
The next is also extrange (at least for me):
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(45) : error C2653: 'CHudOverheat' : is not a class or namespace name
Points here:
int CHudOverheat::Init(void)
But it is on Overheat.h !
Starting going nuts after two hours of re-writing all from scratch...
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(48) : error C2065: 'm_iHeat' : undeclared identifier
Points here:
m_iHeat = 0;
Into the function int CHudOverheat::Init(void)

But, again, it is declared into overheat.h as int m_iHeat;.

as things go further I hit again with:
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(49) : error C2673: 'Init' : global functions do not have 'this' pointers
Pointing to:
[quote]
gHUD.AddHudElem(this);
[/quote]

WTF? Why there´s no problem with this then?
[quote]
int CHudRadar::Init(void)
{
HOOK_MESSAGE(Radar);
gHUD.AddHudElem(this);
return 1;
}
[/quote]
And finally I started to surrender:
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(55) : error C2065: 'm_hSprite' : undeclared identifier
That points to:
m_hSprite = 0;
But in overheat.h...

[quote]
private:
HSPRITE m_hSprite;
[/quote]

I´m a total newb, I admit, but I think I can declare things properly, and all those things are in their places. (I did re-compile for doubts sake).
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(59) : error C2653: 'CHudOverheat' : is not a class or namespace name
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(60) : error C2373: 'MsgFunc_Overheat' : redefinition; different type modifiers
Here I started to think that I am a totally moron because it points to:
int CHudOverheat:: MsgFunc_Overheat(const char *pszName, int iSize, void *pbuf )
That is the same function that CHudHealth... :(

And if you have any faith in me, here you are to bring you back to reality...
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\overheat.cpp(69) : error C2653: 'CHudOverheat' : is not a class or namespace name
That points to:
int CHudOverheat::Draw(float flTime)
Believe me, I´m sure they all are on overheat.cpp

I then quited, but not before taking note of this last:
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\hud.cpp(354) : error C2065: 'm_Overheat' : undeclared identifier
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\hud.cpp(354) : error C2228: left of '.Init' must have class/struct/union type
G:\DevZWC20\Elementos\Single-Player Source\cl_dll\hud.cpp(506) : error C2228: left of '.VidInit' must have class/struct/union type
That points to:
m_Overheat.Init();//ZWC OVERHEAT (c) Shepard 62700FR
and:
m_Overheat.VidInit();//ZWC OVERHEAT (c) Shepard 62700FR
That are already there, in overheat.h.

As you can see, I did all neccesary, except the third part of the code that is starting the drawing via MESSAGE_BEGIN, etc in the server side, but the declarations are there, if necessary.

I know that those are too much errors, believe me if I checked ALL and EVERY of them, for missing ";", for function location and misspelling, declaration of every integer and function.

I better take a time to re-study all.
Posted 7 years ago2017-01-30 18:12:45 UTC Post #333252
You are getting those errors because "CHud" don't know that "CHudOverheat" exists.

Add this magic line at the beginning of "hud.h" along with it's friends:

#include "overheat.h"
Posted 7 years ago2017-01-30 19:16:09 UTC Post #333254
:zomg:
...

Don´t hate me, please. It was an awful day at work and my head is giving me warning signs like this... :cry:

EDIT:

All compile fine if I put what is in overheat.h into hud.h, if I include it as an "h" file I obtain 55 errors... :/

Now it´s time to make the MESSAGE_BEGIN part into server side...Annnnd, 1 error only!!.

I will try all and then I´ll post again.
Posted 7 years ago2017-01-30 19:32:08 UTC Post #333255
I'm sorry, I just realized that I was wrong, if you want to keep your "CHudOverheat" class in a separate file, you have to move the #include just above the declaration of "CHud", not pretty I reckon but that's what I did for everything HUD related in Half-Rats: Parasomnia.
Posted 7 years ago2017-01-30 20:35:54 UTC Post #333256
No worries, I did a bit of trial-error searching how CHudHealth was declared and saw that it was on hud.h, so I gave it a try ;) ,no coding skills involved.

I'm right now smashing my head on the keyboard (nothing extrange, it happens 9 of 10 times each time I "do" code for half-life) because of
MESSAGE_BEGIN( MSG_ONE, gmsgOverheat, NULL, ENT( pPlayer );
is telling me that gmsgOverheat... well, as usual this dog's day... :(

But I will make it... I want to party hard, and if all works I will write the tutorial, you just sign it because all credit belongs to you.
Posted 7 years ago2017-01-30 20:49:41 UTC Post #333258
You forgot to close one ")".

If you got an error about "pPlayer", then try "pPlayer->pev".

If it complains about missing "gmsgOverheat", then add after the includes "extern int gmsgOverheat;".
Posted 7 years ago2017-01-30 20:55:00 UTC Post #333259
Yep!, I copy-pasted bad the quoted text. But maybe I did misplace the code... if I am sincere I think that the primaryattack and secondaryattack function of the weapon probably is not a good place to put the code in because each time I will fire the Hud will update and returns m_iHeat to zero values, right? :/
Posted 7 years ago2017-01-30 21:22:32 UTC Post #333260
The "Cooldown" method should be fine.
Posted 7 years ago2017-01-30 21:43:02 UTC Post #333261
Well. I put all my legendary skills in coding (that is, I did see another function similar searching with the mighty FindIn files tool, and then deleted that parameter) and left the function like this:
MESSAGE_BEGIN( MSG_ONE, gmsgOverheat, NULL, m_pPlayer->pev);
WRITE_BYTE( m_iHeat );
MESSAGE_END();
All compiled fine this time!!, the function seem to not "swallow" well the ENT parameter, so I tested the code in three positions (I did searched as you told me) and...

Nothing happened, no hud overheat bar... :(

-Put in the PrimaryAttack part... no luck. :\
-Put in the SecondaryAttack part... still no luck. :(
-Put in the Cooldown method... no luck again. :nervous:

Sure that I screwed the code somewhere. :crowbar:
Posted 7 years ago2017-01-30 22:05:07 UTC Post #333262
If you don't use "m_hSprite", you can remove it.

Remove the "stdio", "stdlib", "math" and "string" includes, you don't need them.

Just after "BEGIN_READ", try adding that: "m_iFlags |= HUD_ACTIVE";
Posted 7 years ago2017-01-30 22:24:29 UTC Post #333264
Yesh, tried all but no luck again. Should I post the actual code in pastebin?
Posted 7 years ago2017-01-30 22:39:06 UTC Post #333265
Yep, will be easier.
Posted 7 years ago2017-01-30 23:04:44 UTC Post #333266
overheat.cpp http://pastebin.com/VJ1QUvkm
hud.h http://pastebin.com/VatHjveW
weapon code (FULL) http://pastebin.com/13QE68eD

Don´t know what else to do. I did swap the:
//-------------------------------------------------------------------
MESSAGE_BEGIN( MSG_ONE, gmsgOverheat, NULL, m_pPlayer->pev);
WRITE_BYTE( m_iHeat );
MESSAGE_END();
//--------------------------------------------------------------------
code all over the weapon code with no luck... But, I did not add the variable on the multiplay_gamerules.cpp file... :/ (I know, it´s a desperate procedure...)
Posted 7 years ago2017-01-30 23:08:16 UTC Post #333267
Remove the "HPSRITE" and "private:" in "CHudOverheat" as well.

Remove the "sprintf" in "overheat.cpp".

Remove the "if" condition in "CHudOverheat::Draw".

Place this at the very beginning of "CHudOverheat::Draw":
// Don't show this if the health HUD is ordered to hide or we are in spectator mode
if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH || gEngfuncs.IsSpectateOnly() )
return 1;

// Don't show this if we don't have the HUD (HEV suit)
if ( !(gHUD.m_iWeaponBits & (1 << WEAPON_SUIT)) )
return 1;
Posted 7 years ago2017-01-30 23:17:23 UTC Post #333268
[quote]
int CHudOverheat::Draw(float flTime)
{

// Don't show this if the health HUD is ordered to hide or we are in spectator mode
if ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH || gEngfuncs.IsSpectateOnly() )
return 1;

// Don't show this if we don't have the HUD (HEV suit)
if ( !(gHUD.m_iWeaponBits & (1 << WEAPON_SUIT)) )
return 1;
int w = ScreenWidth;
int	h = ScreenHeight;
//=============================================================
// HUD Health Bar (c) Lord Draco .
// Code based upon the PERFECT DARK MOD Source Code
// Dibuja un rectángulo NEGRO en el borde inferior del HUD
//=============================================================
FillRGBA(w/2.46  , h/1.07, 240, 22, 0, 0, 0, 255);
//=============================================================
FillRGBA(w/2.46   , h/0.95, (2.4 * m_iHeat), 5, 255, 0, 0, 255);//ZWC OVERHEAT
return 1;

}
[/quote]

Done!...no luck,, I am sure it is my fault. I will do further test tomorrow... :(
Posted 7 years ago2017-01-31 09:44:08 UTC Post #333272
Well, I have re-written all form scratch and found myself again in the starting point. Overheat code works like a charm, but the hud bar won´t show :(

I remember something similar in the far 2003 when there were hundred of threads about the "Team system with vgui menu" tutorial from BigGuy. Even if some people just copy-pasted it, it happened that sometimes it does not work or even sometimes it even compile at all.

I was one of the lucky ones that make it work at first try even if I did some modificatios (you know, trial-error).

I feel now like all those guys in the year 2003, all seems to be ok but a part of the code does not work unexplainabily. :(
Posted 7 years ago2017-01-31 10:41:42 UTC Post #333273
I'll see what I can do when I have the time.
Posted 7 years ago2017-01-31 13:50:47 UTC Post #333274
Thanks Shepard, I know you have not much spare time so don´t be in any hurry please, first is first, ok?. ;) If you need ANY files or even the full SDK of the Mod and te mod itself just tell me. :)
Posted 7 years ago2017-01-31 17:51:22 UTC Post #333275
Posted 7 years ago2017-01-31 22:16:03 UTC Post #333277
For all gods sake, Shepard. :o I said "don't be in a hurry", not "hurry up or I'll kill you" XD. I will implement all now and make some shots.

Thanks Shepard. I can consider oficially Zion Warcry SDK finished after 13 long years. I can't believe it.

EDIT:

Works great!!, need some minor adjustments to fit the ZWC weapons and to make it work for the mod, but it Works!! :D
Posted 7 years ago2017-02-01 11:06:50 UTC Post #333283
Second EDIT: OF course it works!!. I added the new HUD for the overheat process and adapted the cooldown effect to each rate of fire.

Also I am adding the overheat effect that was present in one of the earlier beta of the mod (previous to the "shitbeta", yes , I call it htat way ), I am in doubt about making the weapon glow red or if I shall put a smoke effect, I did both options in 2006 but on that beta there was not any overheat on the weapon (for obvious reasons, that is: that was impossible for me to code ;) ), the effect just happened when ammo reached zero, so I deleted this feature from the SDK as it was stupid to see an overheat effect with no overheat behaviour at all.

I accept suggestions!!. I am sure you will be amazed of how the mod looks like now.
Posted 7 years ago2017-02-02 23:00:54 UTC Post #333304
Hope you like it... :glad:
User posted image
User posted image
Posted 7 years ago2017-02-02 23:15:58 UTC Post #333308
If it works, then I'm happy for you ^^
Posted 7 years ago2017-02-02 23:18:36 UTC Post #333309
You´re the man. No doubts about it, that´s yours Shepard!! :^_^:
You must be logged in to post a response.