Jump to content
  • 0
Sign in to follow this  
deadzero

Bug when teleporting or changing a map

Question

7 answers to this question

Recommended Posts

  • 0

May be it's server lag? What hardware your server? Use MySQL? What speed internet connection on server and client PC?

Share this post


Link to post
Share on other sites
  • 0

maybe you have NPCs script that alter the HP value ?

 

example :

OnPCLoadMapEvent:    Hp = ( Hp / 2 );    end;

check all your [wiki=OnPCLoadMapEvent] script.

Share this post


Link to post
Share on other sites
  • 0

The problem was in the script of resident evil.

 

 

Index: atcommand.c

===================================================================

--- atcommand.c (revision 15066)

+++ atcommand.c (working copy)

@@ -4432,6 +4432,8 @@

strcat(atcmd_output, "PartyLock | ");

if (map[m_id].flag.guildlock)

strcat(atcmd_output, "GuildLock | ");

+ if (map[m_id].flag.resident)

+ strcat(atcmd_output, "Resident | ");

clif_displaymessage(fd, atcmd_output);

 

switch (list) {

Index: battle.c

===================================================================

--- battle.c (revision 15066)

+++ battle.c (working copy)

@@ -1013,6 +1013,11 @@

sd = BL_CAST(BL_PC, src);

tsd = BL_CAST(BL_PC, target);

 

+ if( sd && map[sd->bl.m].flag.resident && sd->state.resident && tsd && tsd->state.resident )

+ {

+ wd.damage = 1;

+ return wd;

+ }

if(sd)

wd.blewcount += battle_blewcount_bonus(sd, skill_num);

 

@@ -3458,6 +3463,10 @@

struct map_session_data *sd = BL_CAST(BL_PC, s_bl);

if( s_bl != t_bl )

{

+ if(map[sd->bl.m].flag.resident &&

+ ((sd->state.resident == 1 ) || (sd->state.resident == 2 && ((TBL_PC*)t_bl)->state.resident == 2))

+ || (!sd->state.resident && ((TBL_PC*)t_bl)->state.resident) || (sd->state.resident && !((TBL_PC*)t_bl)->state.resident))

+ return 0;

if( sd->state.killer )

{

state |= BCT_ENEMY; // Can kill anything

@@ -3483,6 +3492,8 @@

if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )

return 0; // Disable guardians/emperium owned by Guilds on non-woe times.

 

+ if(((TBL_PC*)t_bl)->state.resident)

+ return 0;

if( !md->special_state.ai )

{ //Normal mobs.

if( t_bl->type == BL_MOB && !((TBL_MOB*)t_bl)->special_state.ai )

Index: clif.c

===================================================================

--- clif.c (revision 15066)

+++ clif.c (working copy)

@@ -9150,6 +9150,12 @@

#ifndef TXT_ONLY

mail_clear(sd);

#endif

+ status_calc_pc(sd, true);

+ if(!map[sd->bl.m].flag.resident && sd->state.resident)

+ {

+ sd->state.resident = 0;

+ pc_disguise(sd,0);

+ }

 

if(map[sd->bl.m].flag.loadevent) // Lance

npc_script_event(sd, NPCE_LOADMAP);

Index: map.h

===================================================================

--- map.h (revision 15066)

+++ map.h (working copy)

@@ -492,6 +492,8 @@

unsigned guildlock :1;

unsigned src4instance : 1; // To flag this map when it's used as a src map for instances

unsigned reset :1; // [Daegaladh]

+

+ .flag.resident :1;

} flag;

struct point save;

struct npc_data *npc[MAX_NPC_PER_MAP];

Index: npc.c

===================================================================

--- npc.c (revision 15066)

+++ npc.c (working copy)

@@ -3114,6 +3114,8 @@

map[m].flag.guildlock=state;

else if (!strcmpi(w3,"reset"))

map[m].flag.reset=state;

+ else if(!strcmpi(w3,"resident"))

+ map[m].flag.resident=state;

else

ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').n", w3, filepath, strline(buffer,start-buffer));

 

@@ -3300,6 +3302,7 @@

{"Die Event",script_config.die_event_name},

{"Kill PC Event",script_config.kill_pc_event_name},

{"Kill NPC Event",script_config.kill_mob_event_name},

+ {"Damage Event",script_config.damage_event_name},

};

 

for (i = 0; i < NPCE_MAX; i++)

Index: npc.h

===================================================================

--- npc.h (revision 15066)

+++ npc.h (working copy)

@@ -97,6 +97,7 @@

NPCE_DIE,

NPCE_KILLPC,

NPCE_KILLNPC,

+ NPCE_DAMAGE,

NPCE_MAX

};

struct view_data* npc_get_viewdata(int class_);

Index: pc.c

===================================================================

--- pc.c (revision 15066)

+++ pc.c (working copy)

@@ -5661,7 +5661,9 @@

pc_setstand(sd);

skill_sit(sd,0);

}

-

+ if(map[sd->bl.m].flag.resident && sd->state.resident == 1)

+ {

+ npc_script_event(sd,NPCE_DAMAGE);

+ pc_stop_attack((TBL_PC*)src);

+ }

+

if( sd->progressbar.npc_id )

clif_progressbar_abort(sd);

 

@@ -7120,6 +7122,9 @@

 

nullpo_ret(sd);

 

+ if(map[sd->bl.m].flag.resident)

+ return 0;

+

if( n < 0 || n >= MAX_INVENTORY ) {

clif_equipitemack(sd,0,0,0);

return 0;

Index: pc.h

===================================================================

--- pc.h (revision 15066)

+++ pc.h (working copy)

@@ -137,6 +137,7 @@

unsigned short autolootid; // [Zephyrus]

unsigned short autobonus; //flag to indicate if an autobonus is activated. [inkfish]

struct guild *gmaster_flag;

+ unsigned int resident :2;

} state;

struct {

unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;

Index: script.c

===================================================================

--- script.c (revision 15066)

+++ script.c (working copy)

@@ -232,6 +232,7 @@

"OnPCLoadMapEvent", //loadmap_event_name

"OnPCBaseLvUpEvent", //baselvup_event_name

"OnPCJobLvUpEvent", //joblvup_event_name

+ "OnPCDamage",

"OnTouch_", //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves)

"OnTouch", //ontouch2_name (run whenever a char walks into the OnTouch area)

};

@@ -357,7 +358,8 @@

MF_MONSTER_NOTELEPORT,

MF_PVP_NOCALCRANK, //50

MF_BATTLEGROUND,

- MF_RESET

+ MF_RESET,

+ MF_RESIDENT

};

 

const char* script_op2name(int op)

@@ -14963,7 +14965,25 @@

return 0;

}

 

+BUILDIN_FUNC(resident)

+{

+ struct map_session_data* sd;

+ int resident;

+ const char * name;

+

+ name = script_getstr(st,2);

+ sd = map_nick2sd(name);

+

+ if(sd)

+ {

+ resident = script_getnum(st,3);

+ sd->state.resident = (resident > 2?0:resident);

+ pc_disguise(sd,sd->state.resident == 2?1865:0);

+ }

+ return 0;

+}

 

+

// declarations that were supposed to be exported from npc_chat.c

#ifdef PCRE_SUPPORT

BUILDIN_FUNC(defpattern);

@@ -14976,6 +14996,8 @@

/// for an explanation on args, see add_buildin_func

struct script_function buildin_func[] = {

// NPC interaction

+ BUILDIN_DEF(resident,"si"),

+

BUILDIN_DEF(mes,"s"),

BUILDIN_DEF(next,""),

BUILDIN_DEF(close,""),

Index: script.h

===================================================================

--- script.h (revision 15066)

+++ script.h (working copy)

@@ -26,6 +26,7 @@

const char *loadmap_event_name;

const char *baselvup_event_name;

const char *joblvup_event_name;

+ const char *damage_event_name;

 

const char* ontouch_name;

const char* ontouch2_name;

Index: status.c

===================================================================

--- status.c (revision 15066)

+++ status.c (working copy)

@@ -3905,6 +3905,9 @@

speed = speed * 100 / sc->data[sC_WALKSPEED]->val1;

}

 

+ if(sd && map[sd->bl.m].flag.resident)

+ speed = 200;

+

return (short)cap_value(speed,10,USHRT_MAX);

}

 

 

 

 

Does someone knows where is the error?

Edited by deadzero

Share this post


Link to post
Share on other sites
  • 0

the problem is over here

--- clif.c (revision 15066)+++ clif.c (working copy)@@ -9150,6 +9150,12 @@#ifndef TXT_ONLYmail_clear(sd);#endif+ status_calc_pc(sd, true);+ if(!map[sd->bl.m].flag.resident && sd->state.resident)+ {+ sd->state.resident = 0;+ pc_disguise(sd,0);+ }if(map[sd->bl.m].flag.loadevent) // Lancenpc_script_event(sd, NPCE_LOADMAP);
even if I dunno what the event resident evil is,

but I understand that if the player went out from a map with mapflag 'resident' and having state resident >= 1

it has to reset the sd->state.resident as 0, and undisguise the character

however I have no idea why the status_calc_pc command is there

 

and the status_calc_pc runs with enum 'e_status_calc_opt', it accepts the value 0, 1, 2 or 3

https://github.com/HerculesWS/Hercules/blob/master/src/map/status.h#L1824

when I dubug the value of 'true', which is equal 1

which is the same value for SCO_FIRST

running status_calc_pc with SCO_FIRST should only be done when the player is respawning

 

that line should be remove since some item bonus already recalculate when changing map

https://github.com/HerculesWS/Hercules/blob/master/src/map/clif.c#L9310

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.