Jump to content
  • 0

Modifying this source need some help,.


PewN

Question


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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
Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

From what I've understood on your post, it should be this way

md->faction_id = pc_readglobalreg( sd, "pvpteam" );
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Yes, do what I said above.

 

http://upaste.me/raw/b741537463091140

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

Yes, do what I said above.

 

http://upaste.me/raw/b741537463091140

 

hmm.. im a little bit confused

how can i set the faction of the monster? 

From what I've understood on your post, it should be this way

md->faction_id = pc_readglobalreg( sd, "pvpteam" );

sir clydelion

how can i set the faction of the monster? 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

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);

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

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: <,,,>

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

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?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

Thank's for help. Topic Solved!..

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