Venture Posted September 28, 2013 Group: Members Topic Count: 52 Topics Per Day: 0.01 Content Count: 179 Reputation: 2 Joined: 08/30/13 Last Seen: November 7, 2024 Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted September 28, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Yesterday at 05:32 PM Share 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 Link to comment Share on other sites More sharing options...
1 Venture Posted September 28, 2013 Group: Members Topic Count: 52 Topics Per Day: 0.01 Content Count: 179 Reputation: 2 Joined: 08/30/13 Last Seen: November 7, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
GmOcean Posted September 28, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share 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 Link to comment Share on other sites More sharing options...
Venture Posted September 28, 2013 Group: Members Topic Count: 52 Topics Per Day: 0.01 Content Count: 179 Reputation: 2 Joined: 08/30/13 Last Seen: November 7, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Patskie Posted September 28, 2013 Group: Members Topic Count: 50 Topics Per Day: 0.01 Content Count: 1702 Reputation: 241 Joined: 09/05/12 Last Seen: 16 minutes ago Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted September 28, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Yesterday at 05:32 PM Share Posted September 28, 2013 certain town might not have the "Town" mapflag ... especially custom maps .... npc/mapflag/town.txt Quote Link to comment Share on other sites More sharing options...
Venture Posted September 28, 2013 Group: Members Topic Count: 52 Topics Per Day: 0.01 Content Count: 179 Reputation: 2 Joined: 08/30/13 Last Seen: November 7, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Question
Venture
I wanted a certain variable to be set to 0 when player enters town.
Link to comment
Share on other sites
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.