Jump to content
  • 0

Request new script command: guildmonster...


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Would anybody be interested in coding a new script command? It would work sorta like the normal guardian command, but not be tied into any getcastledata. It will spawn a monster with the monsters normal health/strength that supports only the specified guild. The monster moves around freely and won't attack or damage guild members, but is aggressive to anybody else. Basically mod the monster command similar to the summon command to use a guildID instead of a playerID. I looked at the script src files and it didn't seem all that bad, but I don't know enough about how things work together to do this myself. It needs to have: no time limit until mob disappears, able to spawn more than one mob at a time, allow variables within in the command structure, and support event labels, allow -1 to be placed to spawn random monster, do not respawn upon being killed, and possibly show guild name/emblem on the mob (like in WoE guardian monsters).

guildmonster "<MapName>",<x>,<y>,"<GuildID>","<NameToShow>",<MobID>,<Amount>,"<NPCNAME::OnLabel>";

Basically I'm trying to merge these two commands. There also stuff in the guild src file also you have to adjust. So far every attempt results in a crash of some kind.

BUILDIN_FUNC(monster)
{
const char* mapn  = script_getstr(st,2);
int x			 = script_getnum(st,3);
int y			 = script_getnum(st,4);
const char* str   = script_getstr(st,5);
int class_		= script_getnum(st,6);
int amount		= script_getnum(st,7);
const char* event = "";
struct map_session_data* sd;
int m;
if( script_hasdata(st,8) )
{
 event = script_getstr(st,8);
 check_event(st, event);
}
if (class_ >= 0 && !mobdb_checkid(class_)) {
 ShowWarning("buildin_monster: Attempted to spawn non-existing monster class %d\n", class_);
 return 1;
}
sd = map_id2sd(st->rid);
if( sd && strcmp(mapn,"this") == 0 )
 m = sd->bl.m;
else
{
 m = map_mapname2mapid(mapn);
 if( map[m].flag.src4instance && st->instance_id )
 { // Try to redirect to the instance map, not the src map
  if( (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
  {
ShowError("buildin_monster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
return 1;
  }
 }
}
mob_once_spawn(sd,m,x,y,str,class_,amount,event);
return 0;
}


BUILDIN_FUNC(guardian)
{
int class_=0,x=0,y=0,guardian=0;
const char *str,*map,*evt="";
struct script_data *data;
bool has_index = false;
map   =script_getstr(st,2);
x   =script_getnum(st,3);
y   =script_getnum(st,4);
str   =script_getstr(st,5);
class_=script_getnum(st,6);
if( script_hasdata(st,8) )
{// "<event label>",<guardian index>
 evt=script_getstr(st,7);
 guardian=script_getnum(st,8);
 has_index = true;
} else if( script_hasdata(st,7) ){
 data=script_getdata(st,7);
 get_val(st,data);
 if( data_isstring(data) )
 {// "<event label>"
  evt=script_getstr(st,7);
 } else if( data_isint(data) )
 {// <guardian index>
  guardian=script_getnum(st,7);
  has_index = true;
 } else {
  ShowError("script:guardian: invalid data type for argument #6 (from 1)\n");
  script_reportdata(data);
  return 1;
 }
}
check_event(st, evt);
script_pushint(st, mob_spawn_guardian(map,x,y,str,class_,evt,guardian,has_index));
return 0;
}

Edited by peopleperson49
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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