Jump to content
  • 0

Percentheal & heal command modifaction


Question

Posted (edited)

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

2 answers to this question

Recommended Posts

Posted

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

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