Venture Posted September 28, 2013 Posted September 28, 2013 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; } Quote
Emistry Posted September 28, 2013 Posted September 28, 2013 - 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 1 Quote
1 Venture Posted September 28, 2013 Author Posted September 28, 2013 It seems like what I have been missing is the last line of the code! prontera mapflag loadevent Thanks Everyone! Its working fine now! Quote
GmOcean Posted September 28, 2013 Posted September 28, 2013 *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; 1 Quote
Venture Posted September 28, 2013 Author Posted September 28, 2013 Thank you very much! This is very helpful!. This opens up millions of possibilities for me *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 Quote
Patskie Posted September 28, 2013 Posted September 28, 2013 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 Quote
Emistry Posted September 28, 2013 Posted September 28, 2013 certain town might not have the "Town" mapflag ... especially custom maps .... npc/mapflag/town.txt Quote
Venture Posted September 28, 2013 Author Posted September 28, 2013 (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 September 28, 2013 by gekigengar Quote
Question
Venture
I wanted a certain variable to be set to 0 when player enters town.
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.