|
Revan
|
 |
« on: March 09, 2012, 02:00:39 PM » |
|
for some weird reason I get double hp when buying periapth of health. chat message (+50 hp) appears but I got 200
EDIT: using latest war3source version(svn)
|
|
|
|
« Last Edit: March 09, 2012, 02:27:15 PM by Revan »
|
Logged
|
#war3source
|
|
|
|
Chuck
|
 |
« Reply #1 on: March 09, 2012, 08:54:34 PM » |
|
there is a lot bugs on latest version on hp! i spend 4 hours to update races and hp! but all races goes wild with over 300 hp! even tested one race and still does same.....
|
|
|
|
|
Logged
|
|
|
|
|
Arturius
|
 |
« Reply #2 on: March 10, 2012, 03:12:58 AM » |
|
//War3Source_Engine_BuffMaxHP.sp
new ORIGINALHP[MAXPLAYERSCUSTOM]; public OnWar3EventSpawn(client){ ORIGINALHP[client]=GetClientHealth(client); PrintToConsole(client,"ORIGINALHP: %i",ORIGINALHP[client]); //first spawn without periapth of health 100hp /respawn with periapth of health 100hp. //if(!IsFakeClient(client)) // DP("SPAWN set oroginal %d",ORIGINALHP[client]); // if(W3GetPlayerProp(client,bStatefulSpawn)){ if(mytimer[client]!=INVALID_HANDLE){ CloseHandle(mytimer[client]); } mytimer[client]=CreateTimer(0.1,CheckHP,client); //DP("TIMERCREATE"); // } } public Action:CheckHP(Handle:h,any:client){ //DP("TIMERHIT"); mytimer[client]=INVALID_HANDLE; if(ValidPlayer(client,true)){ new hpadd=W3GetBuffSumInt(client,iAdditionalMaxHealth); //if(!IsFakeClient(client)) //DP("oroginal %d, additonal %d",ORIGINALHP[client],hpadd); new curhp=GetClientHealth(client); PrintToConsole(client,"curhp: %i",curhp); //first spawn without periapth of health 100hp /respawn with periapth of health 150hp. SetEntityHealth(client,curhp+hpadd); War3_SetMaxHP_INTERNAL(client,ORIGINALHP[client]+hpadd); //if(!IsFakeClient(client)) //DP("was curhp %d, set to %d",curhp,GetClientHealth(client)); LastDamageTime[client]=GetEngineTime()-100.0; } }
|
|
|
|
|
Logged
|
|
|
|
|
Ownz
|
 |
« Reply #3 on: March 10, 2012, 03:28:02 AM » |
|
sorry guys can someone try to debug the problem ? im wayyyy to busy to do anything related until spring break, right now is the beginning of finals week
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|
Revan
|
 |
« Reply #4 on: March 10, 2012, 04:35:52 AM » |
|
//War3Source_Engine_BuffMaxHP.sp
new ORIGINALHP[MAXPLAYERSCUSTOM]; public OnWar3EventSpawn(client){ ORIGINALHP[client]=GetClientHealth(client); PrintToConsole(client,"ORIGINALHP: %i",ORIGINALHP[client]); //first spawn without periapth of health 100hp /respawn with periapth of health 100hp. //if(!IsFakeClient(client)) // DP("SPAWN set oroginal %d",ORIGINALHP[client]); // if(W3GetPlayerProp(client,bStatefulSpawn)){ if(mytimer[client]!=INVALID_HANDLE){ CloseHandle(mytimer[client]); } mytimer[client]=CreateTimer(0.1,CheckHP,client); //DP("TIMERCREATE"); // } } public Action:CheckHP(Handle:h,any:client){ //DP("TIMERHIT"); mytimer[client]=INVALID_HANDLE; if(ValidPlayer(client,true)){ new hpadd=W3GetBuffSumInt(client,iAdditionalMaxHealth); //if(!IsFakeClient(client)) //DP("oroginal %d, additonal %d",ORIGINALHP[client],hpadd); new curhp=GetClientHealth(client); PrintToConsole(client,"curhp: %i",curhp); //first spawn without periapth of health 100hp /respawn with periapth of health 150hp. SetEntityHealth(client,curhp+hpadd); War3_SetMaxHP_INTERNAL(client,ORIGINALHP[client]+hpadd); //if(!IsFakeClient(client)) //DP("was curhp %d, set to %d",curhp,GetClientHealth(client)); LastDamageTime[client]=GetEngineTime()-100.0; } }
The Problem is CheckBuffHP + CheckBuffHPChange gets called(only wearing periapth), I don't know who made thoose changes on the hp buff since it was working good before(atleast better than now lol) - I will try to fix it. EDIT: The Problem was (as already said) CheckBuffHP and CheckBuffHPChange got called, so the health was added twice because the HP buff usually changes(calling CheckBuffHPChange) on spawn. Please report errors and say if it is working(or not lol) ( Grab latest)
|
|
|
|
« Last Edit: March 10, 2012, 04:53:36 AM by Revan »
|
Logged
|
#war3source
|
|
|
|
Ownz
|
 |
« Reply #5 on: March 10, 2012, 10:27:47 AM » |
|
but if(mytimer2[client]==INVALID_HANDLE){ mytimer2[client]=CreateTimer(0.1,CheckHPBuffChange,client); } is suppose to prevent creating a new timer when there is already one that exists
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|
Revan
|
 |
« Reply #6 on: March 10, 2012, 12:58:07 PM » |
|
but if(mytimer2[client]==INVALID_HANDLE){ mytimer2[client]=CreateTimer(0.1,CheckHPBuffChange,client); } is suppose to prevent creating a new timer when there is already one that exists
arghh way tooo much commented old-code. thats not the problem since CheckHPBuffCHange don't get called twice, but CheckHPBuff AND CheckHPBuffChange get called both - giving double hp therefore
|
|
|
|
|
Logged
|
#war3source
|
|
|
|
Ownz
|
 |
« Reply #7 on: March 10, 2012, 12:59:44 PM » |
|
they all have this timer exists check somewhere
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|
Chuck
|
 |
« Reply #8 on: March 12, 2012, 05:04:37 PM » |
|
Has health been fixed? so I can do major war3 for zombie server on spring break
|
|
|
|
« Last Edit: March 12, 2012, 08:42:02 PM by Chuck »
|
Logged
|
|
|
|
_caKKa
Newbie

Posts: 31
|
 |
« Reply #9 on: March 17, 2012, 06:42:24 PM » |
|
When will fix this error?
|
|
|
|
|
Logged
|
|
|
|
|
Revan
|
 |
« Reply #10 on: March 18, 2012, 02:42:35 AM » |
|
Did you tested the newest version? It fixed that hp stuff for me
|
|
|
|
|
Logged
|
#war3source
|
|
|
|
Arturius
|
 |
« Reply #11 on: March 18, 2012, 07:00:46 AM » |
|
To find out a problem essence, I had to check up each step. public OnWar3EventSpawn(client){ PrintToConsole(client,"Start OnWar3EventSpawn..."); ORIGINALHP[client]=GetClientHealth(client); PrintToConsole(client,"Get ORIGINALHP: %i",ORIGINALHP[client]); if(mytimer[client]!=INVALID_HANDLE){ CloseHandle(mytimer[client]); } mytimer[client]=CreateTimer(0.1,CheckHP,client); PrintToConsole(client,"Start CreateTimer(0.1,CheckHP,client)..."); }
public Action:CheckHP(Handle:h,any:client){ PrintToConsole(client,"Start CheckHP..."); mytimer[client]=INVALID_HANDLE; if(ValidPlayer(client,true)){ new hpadd=W3GetBuffSumInt(client,iAdditionalMaxHealth); PrintToConsole(client,"Get hpadd in CheckHP: %i",hpadd); new curhp=GetClientHealth(client); PrintToConsole(client,"Get curhp in CheckHP: %i",curhp); SetEntityHealth(client,curhp+hpadd); PrintToConsole(client,"Set SetEntityHealth in CheckHP: %i",curhp+hpadd); War3_SetMaxHP_INTERNAL(client,ORIGINALHP[client]+hpadd); PrintToConsole(client,"Set War3_SetMaxHP_INTERNAL in CheckHP: %i",ORIGINALHP[client]+hpadd); PrintToConsole(client,"End CheckHP..."); LastDamageTime[client]=GetEngineTime()-100.0; } }
public OnWar3Event(W3EVENT:event,client){ if(event==OnBuffChanged) { if(W3GetVar(EventArg1)==iAdditionalMaxHealth&&ValidPlayer(client,true)){ PrintToConsole(client,"Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true)"); if(mytimer2[client]==INVALID_HANDLE){ PrintToConsole(client,"OnWar3Event: mytimer2[client]==INVALID_HANDLE"); mytimer2[client]=CreateTimer(0.1,CheckHPBuffChange,client); PrintToConsole(client,"Start CreateTimer(0.1,CheckHPBuffChange,client)..."); PrintToConsole(client,"OnWar3Event: mytimer2[client]!=INVALID_HANDLE"); } else { PrintToConsole(client,"End OnWar3Event: mytimer2[client]!=INVALID_HANDLE"); } } } }
public Action:CheckHPBuffChange(Handle:h,any:client){ PrintToConsole(client,"Start CheckHPBuffChange..."); if(ValidPlayer(client,true)){ mytimer2[client]=INVALID_HANDLE; PrintToConsole(client,"Set mytimer2[client]=INVALID_HANDLE"); new oldmaxhp=War3_GetMaxHP(client); PrintToConsole(client,"Get oldmaxhp in CheckHPBuffChange: %i",oldmaxhp); new hpadd=W3GetBuffSumInt(client,iAdditionalMaxHealth); PrintToConsole(client,"Get hpadd in CheckHPBuffChange: %i",hpadd); new newmaxhp=ORIGINALHP[client]+hpadd; PrintToConsole(client,"Get newmaxhp in CheckHPBuffChange: %i",newmaxhp); War3_SetMaxHP_INTERNAL(client,newmaxhp); PrintToConsole(client,"Set War3_SetMaxHP_INTERNAL in CheckHPBuffChange: %i",newmaxhp); new newhp=GetClientHealth(client)+newmaxhp-oldmaxhp; PrintToConsole(client,"Get newhp in CheckHPBuffChange: %i",newhp); if(newhp<1){ newhp=1; } SetEntityHealth(client,newhp); PrintToConsole(client,"Set SetEntityHealth in CheckHPBuffChange: %i",newhp); PrintToConsole(client,"End CheckHPBuffChange..."); } }
I have found out that CheckHPBuffChange is calculated earlier than CheckHP. Here is how it works: // Console messages // When player put in server and first spawn Start OnWar3EventSpawn... Get ORIGINALHP: 100 Start CreateTimer(0.1,CheckHP,client)... Start CheckHP... Get hpadd in CheckHP: 0 Get curhp in CheckHP: 100 Set SetEntityHealth in CheckHP: 100 Set War3_SetMaxHP_INTERNAL in CheckHP: 100 End CheckHP...
// When player spawn second time, without periapth of health Start OnWar3EventSpawn... Get ORIGINALHP: 100 Start CreateTimer(0.1,CheckHP,client)... Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) OnWar3Event: mytimer2[client]==INVALID_HANDLE Start CreateTimer(0.1,CheckHPBuffChange,client)... OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start CheckHPBuffChange... Set mytimer2[client]=INVALID_HANDLE Get oldmaxhp in CheckHPBuffChange: 100 Get hpadd in CheckHPBuffChange: 0 Get newmaxhp in CheckHPBuffChange: 100 Set War3_SetMaxHP_INTERNAL in CheckHPBuffChange: 100 Get newhp in CheckHPBuffChange: 100 Set SetEntityHealth in CheckHPBuffChange: 100 End CheckHPBuffChange... Start CheckHP... Get hpadd in CheckHP: 0 Get curhp in CheckHP: 100 Set SetEntityHealth in CheckHP: 100 Set War3_SetMaxHP_INTERNAL in CheckHP: 100 End CheckHP...
// When player buying periapth of health after spawn Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) OnWar3Event: mytimer2[client]==INVALID_HANDLE Start CreateTimer(0.1,CheckHPBuffChange,client)... OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start CheckHPBuffChange... Set mytimer2[client]=INVALID_HANDLE Get oldmaxhp in CheckHPBuffChange: 100 Get hpadd in CheckHPBuffChange: 50 Get newmaxhp in CheckHPBuffChange: 150 Set War3_SetMaxHP_INTERNAL in CheckHPBuffChange: 150 Get newhp in CheckHPBuffChange: 150 Set SetEntityHealth in CheckHPBuffChange: 150 End CheckHPBuffChange...
// When player spawn with periapth of health Start OnWar3EventSpawn... Get ORIGINALHP: 100 Start CreateTimer(0.1,CheckHP,client)... Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) OnWar3Event: mytimer2[client]==INVALID_HANDLE Start CreateTimer(0.1,CheckHPBuffChange,client)... OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) End OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start CheckHPBuffChange... Set mytimer2[client]=INVALID_HANDLE Get oldmaxhp in CheckHPBuffChange: 100 Get hpadd in CheckHPBuffChange: 50 Get newmaxhp in CheckHPBuffChange: 150 Set War3_SetMaxHP_INTERNAL in CheckHPBuffChange: 150 Get newhp in CheckHPBuffChange: 150 Set SetEntityHealth in CheckHPBuffChange: 150 End CheckHPBuffChange... Start CheckHP... Get hpadd in CheckHP: 50 Get curhp in CheckHP: 150 Set SetEntityHealth in CheckHP: 200 //wrong result Set War3_SetMaxHP_INTERNAL in CheckHP: 150 End CheckHP...
The easiest way to fix that - set smaller value of the first timer. mytimer[client]=CreateTimer(0.05,CheckHP,client); // Console messages // When player spawn with periapth of health Start OnWar3EventSpawn... Get ORIGINALHP: 100 Start CreateTimer(0.05,CheckHP,client)... Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) OnWar3Event: mytimer2[client]==INVALID_HANDLE Start CreateTimer(0.1,CheckHPBuffChange,client)... OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) End OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start CheckHP... Get hpadd in CheckHP: 50 Get curhp in CheckHP: 100 Set SetEntityHealth in CheckHP: 150 Set War3_SetMaxHP_INTERNAL in CheckHP: 150 End CheckHP... Start CheckHPBuffChange... Set mytimer2[client]=INVALID_HANDLE Get oldmaxhp in CheckHPBuffChange: 150 Get hpadd in CheckHPBuffChange: 50 Get newmaxhp in CheckHPBuffChange: 150 Set War3_SetMaxHP_INTERNAL in CheckHPBuffChange: 150 Get newhp in CheckHPBuffChange: 150 Set SetEntityHealth in CheckHPBuffChange: 150 End CheckHPBuffChange...
|
|
|
|
« Last Edit: March 18, 2012, 07:03:31 AM by Arturius »
|
Logged
|
|
|
|
|
Ownz
|
 |
« Reply #12 on: March 18, 2012, 11:05:16 AM » |
|
are you sure smaller timer values forces triggering in that order?
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|
Ownz
|
 |
« Reply #13 on: March 18, 2012, 12:12:18 PM » |
|
iv made a change on the svn http://goo.gl/eRUQx
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|
Arturius
|
 |
« Reply #14 on: March 18, 2012, 12:41:09 PM » |
|
are you sure smaller timer values forces triggering in that order?
Yes, I`m sure. Tested on my local server and on 195.98.160.3:27032. With Your latest change work fine.
|
|
|
|
|
Logged
|
|
|
|
_caKKa
Newbie

Posts: 31
|
 |
« Reply #15 on: March 18, 2012, 03:50:48 PM » |
|
Hmmmm, the buff stops working after a map change. I'm used a last update.
|
|
|
|
|
Logged
|
|
|
|
Glider⠠⠵
Global Moderator
Sr. Member
    
Posts: 413
⠠⠵
|
 |
« Reply #16 on: March 18, 2012, 05:40:26 PM » |
|
A Sourcemod timer can't go below 0.1 seconds. Even if you enter a lower value it will still only fire each 0.1 seconds.
|
|
|
|
|
Logged
|
|
|
|
|
Ownz
|
 |
« Reply #17 on: March 18, 2012, 05:42:53 PM » |
|
i have no idea why sm made that limitation we are just assuming a lower number forces an earlier trigger?
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|
Arturius
|
 |
« Reply #18 on: March 19, 2012, 02:13:03 AM » |
|
But it is really necessary to use the timer for OnWar3EventSpawn? Can make it easier? public OnWar3EventSpawn(client){ ORIGINALHP[client]=GetClientHealth(client); if(ValidPlayer(client,true)){ new hpadd=W3GetBuffSumInt(client,iAdditionalMaxHealth); SetEntityHealth(client,ORIGINALHP[client]+hpadd); War3_SetMaxHP_INTERNAL(client,ORIGINALHP[client]+hpadd); LastDamageTime[client]=GetEngineTime()-100.0; } }
I have checked up this variant. Here is how it works: // Console messages // When player spawn with periapth of health
Start OnWar3EventSpawn... Get ORIGINALHP: 100 Get hpadd: 50 Set SetEntityHealth: 150 Set War3_SetMaxHP_INTERNAL: 150 End... Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) OnWar3Event: mytimer2[client]==INVALID_HANDLE Start CreateTimer(0.1,CheckHPBuffChange,client)... OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start OnWar3Event: event==OnBuffChanged && W3GetVar(EventArg1)==iAdditionalMaxHealth && ValidPlayer(client,true) End OnWar3Event: mytimer2[client]!=INVALID_HANDLE Start CheckHPBuffChange... Set mytimer2[client]=INVALID_HANDLE Get oldmaxhp in CheckHPBuffChange: 150 Get hpadd in CheckHPBuffChange: 50 Get newmaxhp in CheckHPBuffChange: 150 Set War3_SetMaxHP_INTERNAL in CheckHPBuffChange: 150 Get newhp in CheckHPBuffChange: 150 Set SetEntityHealth in CheckHPBuffChange: 150 End CheckHPBuffChange...
|
|
|
|
« Last Edit: March 19, 2012, 02:17:01 AM by Arturius »
|
Logged
|
|
|
|
_caKKa
Newbie

Posts: 31
|
 |
« Reply #19 on: March 19, 2012, 12:01:41 PM » |
|
All is fine, but when to use sh2-fortifiedbracer , I have a bonus health +20 HP on the next round... 
|
|
|
|
« Last Edit: March 19, 2012, 12:04:11 PM by _caKKa »
|
Logged
|
|
|
|
|
Ownz
|
 |
« Reply #20 on: March 19, 2012, 03:27:12 PM » |
|
give me a test case guys, i cant replicate any of your errors
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
_caKKa
Newbie

Posts: 31
|
 |
« Reply #21 on: March 20, 2012, 04:12:31 PM » |
|
1. Start server; (first run) 2. Buy health and lifetube; (race + 50 + 10) 3. Changelevel map 4. Fist round, I have a 110 hp, if I buy a health , the effect will not be. If I stay alive, in the next round I'll get BuffMAXHP stops working after change. Maybe it's only my server 
|
|
|
|
|
Logged
|
|
|
|
|
Ownz
|
 |
« Reply #22 on: March 20, 2012, 04:30:36 PM » |
|
i added another change to the SVN. timer wasnt invalidated if player was not alive....
|
|
|
|
|
Logged
|
 DarkEnergy
|
|
|
|