Jump to content
  • 0

Modifying this source need some help,.


Question

Posted (edited)

i try to modify some of factionmonster script of lilith i want to be a variable like this
http://rathena.org/b...st/#entry153174


md = mob_once_spawn_sub(&sd->bl, m, x, y, str, class_, event);
if (md)
{
md->faction_id = faction; // this line
md->special_state.ai = 1;
mob_spawn(md);
clif_specialeffect(&md->bl,344,AREA);
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
}


i want to change the line to this script

md->pc_readglobalreg( sd, "pvpteam" ) = faction

 

bump? please help

 

bump bump!

Edited by TrojanWorm

11 answers to this question

Recommended Posts

Posted (edited)

here's the whole source

 

 
/**
 * Faction System [Lilith]
 * factionmonster("<map name>",<x>,<y>,"<name to show>",<mob ID>,<amount>,<faction ID>{,"<event label>"});
 **/
BUILDIN_FUNC(factionmonster)
{
    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);
    int faction       = script_getnum(st,8);
    const char* event = "";
 
    struct map_session_data* sd;
    struct mob_data *md;
    int m;
 
    if( script_hasdata(st,9) )
    {
        event = script_getstr(st,9);
        check_event(st, event);
    }
 
    if( class_ >= 0 && !mobdb_checkid(class_) )
    {
        ShowWarning("buildin_factionmonster: 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 )
        {
            if( (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
            {
                ShowError("buildin_factionmonster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
                return 1;
            }
        }
    }
 
    md = mob_once_spawn_sub(&sd->bl, m, x, y, str, class_, event);
    if (md)
    {
        pc_readglobalreg( sd, "pvpteam" ) = faction;
        md->special_state.ai = 1;
        mob_spawn(md);
        clif_specialeffect(&md->bl,344,AREA);
        sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
    }
    script_pushint(st,md->bl.id);
    return 0;
}

cuz the source have the int faction

Edited by TrojanWorm
Posted

No need to modify this code. See doc:

* factionmonster("<map name>",<x>,<y>,"<name to show>",<mob ID>,<amount>,<faction ID>{,"<event label>"});

 

Example: (if player attached)

factionmonster("prontera",155,180,"Example",1002,1,pvpteam);

Posted

No need to modify this code. See doc:

 

* factionmonster("<map name>",<x>,<y>,"<name to show>",<mob ID>,<amount>,<faction ID>{,"<event label>"});

 

Example: (if player attached)

factionmonster("prontera",155,180,"Example",1002,1,pvpteam);

 

thx i will try this lilith thx 

 

@Clydelion

 

thanks for helping me sir...

@lilith how if i set in on script cuz i want to make a faction war like dota race to destroy the Throne

Posted

You can still use 'factionmonster' with event label, but monster would be MD_PLANT(0x40) mode, for example, so this monster cant walk.

factionmonster("prt_fild08",0,0,"Red Team",2135,1,pvpteam,"NPC::OnLabel");

OnLabel: <,,,>

Posted (edited)

You can still use 'factionmonster' with event label, but monster would be MD_PLANT(0x40) mode, for example, so this monster cant walk.

factionmonster("prt_fild08",0,0,"Red Team",2135,1,pvpteam,"NPC::OnLabel");

OnLabel: <,,,>

hmm im getting error on the factionmonster source 

the pvpteam how can i do like this?

 

 
o set your script
set pvpteam, 1; // they assign to team no.1
set pvpteam, 2; // they assign to team no.2

 

here's the modified source of your faction monster

 

how can i set the faction_id as pvpteam(globalreg)

 

if the monster[pvpteam,1] will attack the other monster[pvpteam,2 ...] and the monster[pvpteam,1] will not attack the same variable..

please help

 

BUILDIN_FUNC(factionmonster)
{
    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);
    int faction = script_getnum(st,8);
    const char* event = "";
 
 
    unsigned int size    = SZ_SMALL;
    unsigned int ai        = AI_NONE;
    struct map_session_data* sd;
    struct mob_data *md;
    int m;

    if( script_hasdata(st,9) )
    {
        event = script_getstr(st,9);
        check_event(st, event);
    }

    if (class_ >= 0 && !mobdb_checkid(class_)) {
        ShowWarning("buildin_factionmonster: 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 )
       {           if( (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
            {
               ShowError("buildin_factionmonster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
                return 1;
            }
        }
    }

    md = mob_once_spawn_sub(&sd->bl, m, x, y, str, class_, event, size, ai);
    if (md) {
        md->faction_id = faction;
        md->special_state.ai=1;
       mob_spawn (md);
       clif_specialeffect(&md->bl,344,AREA);
        sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
    }
   script_pushint(st,md->bl.id);
   return 0;
}

 

is this correct?

Edited by TrojanWorm
Posted

Other question, can anyone help me with this error?

script.c: In function âbuildin_factionmonsterâ:
script.c:17680: error: too few arguments to function âmob_once_spawn_subâ
 
This is a part from:

md = mob_once_spawn_sub(&sd->bl, m, x, y, str, class_, event);

if (md)
{
md->faction_id = pc_readglobalreg( sd, "pvpteam" );
md->special_state.ai = 1;
mob_spawn(md);
clif_specialeffect(&md->bl,344,AREA);
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
}
script_pushint(st,md->bl.id);
return 0;
}

 

I tried some changes to fixed it, but I got everytime the same error.

It would be very nice, when anyone know a solution.

 

 



Has nobody a solution?

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