Naruto
New member
- Messages
- 174
- Points
- 0
Hi im trying to develop some advance monster commands/conditions
Having issues... i think linking the sub protocol with the primary function ?
But It works fine when i replace it completely in the src
mob.c
static int mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
{
int cond1,cond2;
struct mob_data **fr = NULL, *md = NULL, *mmd = NULL;
int flag=0;
nullpo_ret(bl);
Assert_ret(bl->type == BL_MOB);
md = BL_UCAST(BL_MOB, bl);
nullpo_ret(mmd=va_arg(ap,struct mob_data *));
if( mmd->bl.id == bl->id && !(battle_config.mob_ai&0x10) )
return 0;
if (battle->check_target(&mmd->bl,bl,BCT_ENEMY)>0)
return 0;
cond1=va_arg(ap,int);
cond2=va_arg(ap,int);
fr=va_arg(ap,struct mob_data **);
if( cond2==-1 ){
int j;
for(j=SC_COMMON_MIN;j<=SC_MAX && !flag;j++){
if ((flag=(md->sc.data[j] != NULL))) //Once an effect was found, break out. [Skotlex]
break;
}
}else
flag=( md->sc.data[cond2] != NULL );
if( flag^( cond1==MSC_FRIENDSTATUSOFF ) )
(*fr)=md;
return 0;
}
Lets go over the code together
if( mmd->bl.id == bl->id && !(battle_config.mob_ai&0x10) )
return 0;
if (battle->check_target(&mmd->bl,bl,BCT_ENEMY)>0)
return 0;
This is what limits it to friends
static int mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
{
int cond1,cond2;
struct mob_data **fr = NULL, *md = NULL, *mmd = NULL;
int flag=0;
nullpo_ret(bl);
Assert_ret(bl->type == BL_MOB);
md = BL_UCAST(BL_MOB, bl);
nullpo_ret(mmd=va_arg(ap,struct mob_data *));
cond1=va_arg(ap,int);
cond2=va_arg(ap,int);
fr=va_arg(ap,struct mob_data **);
if( cond2==-1 ){
int j;
for(j=SC_COMMON_MIN;j<=SC_COMMON_MAX && !flag;j++){
if ((flag=(md->sc.data[j] != NULL))) //Once an effect was found, break out. [Skotlex]
break;
}
}else
flag=( md->sc.data[cond2] != NULL );
if( flag^( cond1==MSC_FRIENDSTATUSOFF ) )
(*fr)=md;
return 0;
}
so now in your mob skill db
nanobot:
{
NPC_SELFDESTRUCTION: {
SkillState: "MSS_ANY"
SkillLevel: 1
Rate: 10000
Delay: 0
Cancelable: false
SkillTarget: "MST_SELF"
CastCondition: "MSC_FRIENDSTATUSON"
ConditionData: "SC_BERSERK"
}
}
so now we should trigger skills on monster status
Now im having an issue with using my CUSTOM status as triggers though...
Ive tried adding them to my constants file...
Ill let you know if i figure out more
BTW: the rest wont bother you.... and i plan on replacing onfriendstatusoff with the old onfriendstatuson . . .
Having issues... i think linking the sub protocol with the primary function ?
But It works fine when i replace it completely in the src
mob.c
static int mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
{
int cond1,cond2;
struct mob_data **fr = NULL, *md = NULL, *mmd = NULL;
int flag=0;
nullpo_ret(bl);
Assert_ret(bl->type == BL_MOB);
md = BL_UCAST(BL_MOB, bl);
nullpo_ret(mmd=va_arg(ap,struct mob_data *));
if( mmd->bl.id == bl->id && !(battle_config.mob_ai&0x10) )
return 0;
if (battle->check_target(&mmd->bl,bl,BCT_ENEMY)>0)
return 0;
cond1=va_arg(ap,int);
cond2=va_arg(ap,int);
fr=va_arg(ap,struct mob_data **);
if( cond2==-1 ){
int j;
for(j=SC_COMMON_MIN;j<=SC_MAX && !flag;j++){
if ((flag=(md->sc.data[j] != NULL))) //Once an effect was found, break out. [Skotlex]
break;
}
}else
flag=( md->sc.data[cond2] != NULL );
if( flag^( cond1==MSC_FRIENDSTATUSOFF ) )
(*fr)=md;
return 0;
}
Lets go over the code together
if( mmd->bl.id == bl->id && !(battle_config.mob_ai&0x10) )
return 0;
Not positive what the first part is about but its not important to my release so lets just delete this entire thing... thinking about it i need to test if it effects themselves without it... really easy to spot though so lets leave it be// 0x010: If set, mob skills defined for friends will also trigger on themselves.
if (battle->check_target(&mmd->bl,bl,BCT_ENEMY)>0)
return 0;
This is what limits it to friends
static int mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
{
int cond1,cond2;
struct mob_data **fr = NULL, *md = NULL, *mmd = NULL;
int flag=0;
nullpo_ret(bl);
Assert_ret(bl->type == BL_MOB);
md = BL_UCAST(BL_MOB, bl);
nullpo_ret(mmd=va_arg(ap,struct mob_data *));
cond1=va_arg(ap,int);
cond2=va_arg(ap,int);
fr=va_arg(ap,struct mob_data **);
if( cond2==-1 ){
int j;
for(j=SC_COMMON_MIN;j<=SC_COMMON_MAX && !flag;j++){
if ((flag=(md->sc.data[j] != NULL))) //Once an effect was found, break out. [Skotlex]
break;
}
}else
flag=( md->sc.data[cond2] != NULL );
if( flag^( cond1==MSC_FRIENDSTATUSOFF ) )
(*fr)=md;
return 0;
}
so now in your mob skill db
nanobot:
{
NPC_SELFDESTRUCTION: {
SkillState: "MSS_ANY"
SkillLevel: 1
Rate: 10000
Delay: 0
Cancelable: false
SkillTarget: "MST_SELF"
CastCondition: "MSC_FRIENDSTATUSON"
ConditionData: "SC_BERSERK"
}
}
so now we should trigger skills on monster status
Now im having an issue with using my CUSTOM status as triggers though...
Ive tried adding them to my constants file...
Ill let you know if i figure out more
BTW: the rest wont bother you.... and i plan on replacing onfriendstatusoff with the old onfriendstatuson . . .
Last edited by a moderator: