Jump to content
  • 0

Check if player enters map with mapflag "Town"


gekigengar

Question


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

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

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


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

  • 1

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

It seems like what I have been missing is the last line of the code!

 

 

prontera    mapflag    loadevent
 

Thanks Everyone!


Its working fine now!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

This special label will trigger once a player steps in a map marked with the 'loadevent' mapflag and attach its RID. The fact that this label requires a mapflag for it to work is because, otherwise, it would be server-wide and trigger every time a player would change maps.
Reference : OnPCLoadMapEvent
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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

npc/mapflag/town.txt

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  174
  • Reputation:   2
  • Joined:  08/30/13
  • Last Seen:  

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