Jump to content

Question

Posted

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/

15 answers to this question

Recommended Posts

  • 0
Posted
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
  • 0
Posted (edited)
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
  • 0
Posted
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

  • 0
Posted

@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;
  • 0
Posted (edited)
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
  • 0
Posted
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

  • 0
Posted
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;
}

 

  • 0
Posted
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

  • 0
Posted
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?

  • 0
Posted
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

  • 0
Posted
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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...