Jump to content
  • 0

Percentheal & heal command modifaction


GmOcean

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Yea, i'm not very good with src edits at all (Complete noob)...

But what i'm requesting is fairly simple for those who do understand. I would just like the npc commands: percentheal & heal to be modified to support an optional parameter of char_id OR char_name. Also, I have no idea why they weren't coded like this to begin with, since it's kind of a hassle to attachrid's just to use these commands, if we were to use them outside of 1click healers/buffer npcs...but i dunno, just my 2cents.

percentheal <hp>,<sp>{,<"char_name">};
percentheal <hp>,<sp>{,<char_id>};
heal <hp>,<sp>{,<"char_name">};
heal <hp>,<sp>{,<char_id>};

granted i do know the same could easily be done by using atcommand <command> <char_id/name>; I'd prefer to use only script commands in a script if at all possible, since atcommands in a script (to me atleast) seem like using god-mode cheats while trying to beat a game lol. With the exception of scripts that enable/disable commands for w/e purposes.

Edited by GmOcean
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

SAMPLE

heal <hp>,<sp>{,<"char_name">};
heal <hp>,<sp>{,<char_id>};

BUILDIN_DEF(heal,"ii?"),

BUILDIN_FUNC(heal)
{
TBL_PC *sd;
int hp,sp;
struct script_data *data;

sd = script_rid2sd(st);
if (!sd) return 0;
if(script_hasdata(st,4))
{
	data=script_getdata(st,4);
	get_val(st,data);
	if( data_isstring(data) )
		sd=map_nick2sd((char *)script_getstr(st,4));
	else if( data_isint(data) )		
		sd=map_charid2sd(script_getnum(st,4));
	else
		return 1;
}
if(sd==NULL)
	return 1;
hp=script_getnum(st,2);
sp=script_getnum(st,3);
status_heal(&sd->bl, hp, sp, 1);
return 0;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Thanks for this lol. I had managed to get it to work for a players name, but for the life of me couldn't figure out how for player id lol.

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...