Jump to content
  • 0

Check if player enters map with mapflag "Town"


Question

Posted

I wanted a certain variable to be set to 0 when player enters town.

 

 

OnInit:
@killcount = 0;

OnNpcKill:
@killcount += 1;
if (@killcount > 150) {
@killcount = 0;
sc_start SC_ITEMBOOST,60000,10;
}

OnEnterMap???: (What should I do to detect this?)
if (mapflag? = town) { (Is this even right?)
@killcount = 0;
sc_end SC_ITEMBOOST;
}
 

 

7 answers to this question

Recommended Posts

Posted


- script Sample -1,{

OnPCLoadMapEvent:

if( getmapflag( strcharinfo(3),mf_town ) ){

sc_end SC_EXPBOOST;

sc_end SC_ITEMBOOST;

@valor = 0;

@bonus = 0;

@valorlvl = 0;

message strcharinfo(0), "Valor End " + @valor + "/ " + .maxvalor[@valorlvl] + ", " + @bonus + ", " + @valorlvl + ".";

}

end;

}

prontera mapflag loadevent

  • Upvote 1
Posted
*getmapflag("<map name>",<flag>{,<type>})

This command checks the status of a given mapflag and returns the mapflag's state.
0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.

The optional parameter 'type' is used in the 'skill_damage' mapflag:
 0: if mapflag is set (default)
 1: damage against players
 2: damage against mobs
 3: damage against bosses
 4: damage against other
 5: caster type


Example:

OnPCLoadMapEvent:
if ( getmapflag( strcharinfo(3),mf_town,0 ) ){ @killcount = 0; sc_end ITEMBOOST; }
end;
  • Upvote 1
Posted

Thank you very much! This is very helpful!.

 

This opens up millions of possibilities for me :D



*getmapflag("<map name>",<flag>{,<type>})

This command checks the status of a given mapflag and returns the mapflag's state.
0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.

The optional parameter 'type' is used in the 'skill_damage' mapflag:
 0: if mapflag is set (default)
 1: damage against players
 2: damage against mobs
 3: damage against bosses
 4: damage against other
 5: caster type


Example:

OnPCLoadMapEvent:
if ( getmapflag( strcharinfo(3),mf_town,0 ) ){ @killcount = 0; sc_end ITEMBOOST; }
end;

Somehow this fails to work :(

Posted (edited)

certain town might not have the "Town" mapflag ... especially custom maps ....

npc/mapflag/town.txt

 

I am sure that is not the case, There is no custom town on my side,

I tested on Prontera and Payon :(

 

here is the line of code

 

 

 

OnPCLoadMapEvent:
    if ( getmapflag( strcharinfo(3),mf_town,0 ) ){
    sc_end SC_EXPBOOST;
    sc_end SC_ITEMBOOST;
    @valor = 0;
    @bonus = 0;
    @valorlvl = 0;
    sc_end SC_EXPBOOST;
    sc_end SC_ITEMBOOST;
    }
    //Debug Message
    message strcharinfo(0), "Valor End " + @valor + "/ " + .maxvalor[@valorlvl] + ", " + @bonus + ", " + @valorlvl + ".";
    end;
 
Edited by gekigengar

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