Jump to content
  • 0

Custom hp bar


Takuyakii

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Good day!

 

Can someone help me, to fix this error ?

buildin_getunitdata: Error in Argument! Please give a variable to store value in

 

Script: 

Quote
payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		.@mobGID = monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		.@mid =$@mobid[.@i];
		setunitdata .@mid,UMOB_MAXHP,4000;
		setunitdata .mid,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
	.@U_MAXHP = getunitdata (.@mid, UMOB_MAXHP);
	while (.@HP_Bar != 0)
	{
		.@U_HP = getunitdata (.@mid, UMOB_HP);
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

Also the cutin are not following the hp,

refer to this link: https://board.herc.ws/topic/15975-custom-unit-hp-bar-system/

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		 monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		.mid =$@mobid;
		getunitdata .mid, .@unitdata;
		setunitdata .mid,UMOB_MAXHP,4000;
		setunitdata .mid,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
.getunitdata .mid,.@unitdata;
	.@U_MAXHP = .@unitdata[UMOB_MAXHP];
	while (.@HP_Bar != 0)
	{
		.@U_HP = .@unitdata[UMOB_HP];
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		.@mid = monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		getunitdata .@mid, .@unitdata;
		setunitdata .@mid,UMOB_MAXHP,4000;
		setunitdata .@mid,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
	.@U_MAXHP = getunitdata .@mid, UMOB_MAXHP;
	while (.@HP_Bar != 0)
	{
		.@U_HP = getunitdata .@mid, UMOB_HP;
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

Try this. i have not tested it but let me know if it worked

Edited by Pride
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

20 minutes ago, Pride said:
payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		.@mid = monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		getunitdata .@mid, .@unitdata;
		setunitdata .@mid,UMOB_MAXHP,4000;
		setunitdata .@mid,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
	.@U_MAXHP = getunitdata .@mid, UMOB_MAXHP;
	while (.@HP_Bar != 0)
	{
		.@U_HP = getunitdata .@mid, UMOB_HP;
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

Try this. i have not tested it but let me know if it worked

Tested and  put some ( ) under .@mid because of the error, then after that igot the same error buildin_getunitdata: Error in Argument! Please give a variable to store value in

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

Which Line???

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

@Pride Line 26 
Changed into this
 after that there's no error on map but when im talking to npc to summon the monster, i got this error buildin_getunitdata: Error in Argument! Please give a variable to store value in

.@U_MAXHP = getunitdata (.@mid, UMOB_MAXHP);
	while (.@HP_Bar != 0)
	{
		.@U_HP = getunitdata (.@mid, UMOB_HP);
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

28 minutes ago, Takuyakii said:

@Pride Line 26 
Changed into this
 after that there's no error on map but when im talking to npc to summon the monster, i got this error buildin_getunitdata: Error in Argument! Please give a variable to store value in

.@U_MAXHP = getunitdata (.@mid, UMOB_MAXHP);
	while (.@HP_Bar != 0)
	{
		.@U_HP = getunitdata (.@mid, UMOB_HP);
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;
OnHPBar:
.getunitdata .@mid,.@unitdata;
.U_MAXHP = .@unitdata[UMOB_MAXHP];
while (.HP_Bar != 0)
{
	.U_HP = .@unitdata[UMOB_HP];
	.P_HP = (.U_HP*100)/.U_MAXHP;

	cutin(""+.P_HP+"", 1);
	 
	sleep2 100;
}

This should solve it

Edited by Pride
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

1 minute ago, Pride said:
OnHPBar:
.getunitdata .@mid,.@unitdata;
while (.HP_Bar != 0)
{
	.U_HP = .@unitdata[UMOB_HP];
	.P_HP = (.U_HP*100)/.U_MAXHP;

	cutin(""+.P_HP+"", 1);
	 
	sleep2 100;
}

This should solve it

image.png.b66add359da03ee7c4db560528d42e13.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Just now, Takuyakii said:

image.png.b66add359da03ee7c4db560528d42e13.png

Fixed removed . on getunitdata, now there's a new error 

image.png.a8cd46925587c505073bec22b03135ec.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

Just now, Takuyakii said:

image.png.b66add359da03ee7c4db560528d42e13.png

payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		.@mobGID = monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		.@mid =$@mobid[.@i];
		setunitdata .@mobGID,UMOB_MAXHP,4000;
		setunitdata .@mobGID,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
.getunitdata .@mid,.@unitdata;
	.@U_MAXHP = .@unitdata[UMOB_MAXHP];
	while (.@HP_Bar != 0)
	{
		.@U_HP = .@unitdata[UMOB_HP];
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Just now, Pride said:
payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		.@mobGID = monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		.@mid =$@mobid[.@i];
		setunitdata .@mobGID,UMOB_MAXHP,4000;
		setunitdata .@mobGID,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
.getunitdata .@mid,.@unitdata;
	.@U_MAXHP = .@unitdata[UMOB_MAXHP];
	while (.@HP_Bar != 0)
	{
		.@U_HP = .@unitdata[UMOB_HP];
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

 

New error

image.png.a0b39c9027011dec554c9421d477cc68.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Just now, Pride said:
payon,147,229,4	script	Test#HPbar	1_F_MARIA,{


	
 	if (.@HP_Bar == 0)
	{
		.@HP_Bar = 1;
		 monster ("payon",148,226,"[T] HP Test",1031,1,strnpcinfo(0)+"::OnMobDie");
		.mid =$@mobid;
		getunitdata .mid, .@unitdata;
		setunitdata .mid,UMOB_MAXHP,4000;
		setunitdata .mid,UMOB_HP,4000;
		.@count = getmapunits(BL_PC, "payon", .@units);
		for (.@i = 0; .@i < .@count; .@i++)	
	{
			attachrid .@units[.@i];
			addtimer(0,strnpcinfo(0)+"::OnHPBar");
		}
}
	end;

OnMobDie:
	.@HP_Bar = 0;
	end;

OnHPBar:
.getunitdata .mid,.@unitdata;
	.@U_MAXHP = .@unitdata[UMOB_MAXHP];
	while (.@HP_Bar != 0)
	{
		.@U_HP = .@unitdata[UMOB_HP];
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
	cutin("0", 1);
	sleep2 5000; //Delay to hide HP Bar
	cutin("", 255);
	end;
}

 

Wow thank you it works, no error on map now!

but can i ask question why the cutin are not properly working on this script? thanks. it supposed to when i attack the monster the cutin should move by the monster hp?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

2 minutes ago, Takuyakii said:

Wow thank you it works, no error on map now!

but can i ask question why the cutin are not properly working on this script? thanks. it supposed to when i attack the monster the cutin should move by the monster hp?

Give me more details. I have not used this script xD

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Just now, Pride said:

Give me more details. I have not used this script xD

Well this idea or script are from herc. https://board.herc.ws/topic/15975-custom-unit-hp-bar-system/ this is the script or the actual.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   11
  • Joined:  11/17/20
  • Last Seen:  

Just now, Takuyakii said:

Well this idea or script are from herc. https://board.herc.ws/topic/15975-custom-unit-hp-bar-system/ this is the script or the actual.

sleep2 100; -> maybe try Playing with this 

while (.@HP_Bar != 0)
	{
		.@U_HP = .@unitdata[UMOB_HP];
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Just now, Pride said:
sleep2 100; -> maybe try Playing with this 

while (.@HP_Bar != 0)
	{
		.@U_HP = .@unitdata[UMOB_HP];
		.@P_HP = (.@U_HP*100)/.@U_MAXHP;

		cutin(.@P_HP+"", 1);

		sleep2 100;
	}

already did, it always showing like this
 image.thumb.png.b6b63d6510bc8f4e4a4d4247cb6980b0.png 

it supposed to be full hp then per hit should be reduce the hp.
anyway i dont know if this is about script or the client, but thank you for helping me, +1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...