S-T-I-N-K-Y Posted December 27, 2018 Posted December 27, 2018 (edited) Hello forum, i was searching around and i saw on many forum's peoples selling this code for gold. (30-40 euro) rolf... That's who we are, sad... So this is one "Gift" from me for the new year. On this code you have the listed options: You can add as many zones you want. You can setup for each zone the running time. (On the current diff i have use Giran Arena and Gludin Arena). Gatekeeper command : <a action="bypass -h npc_%objectId%_pvp">Random Zone</a> The codes required more then 1 zone. Ofc you can add your own configs like "Auto Flag" "Auto Nobles" and whatever you want.. take this share like platform and work on it. DIFF is coded on aCis 381 revision - Feel free to adapt it in whatever revision or project you need. Credits : StinkyMadness Code r381: Here Edited November 18, 2020 by StinkyMadness 7 3 1
Lostre95 Posted December 27, 2018 Posted December 27, 2018 thanks... and congratulations for this share!!! Merry Christmas and Happy New Year !!
N0K3 Posted January 5, 2019 Posted January 5, 2019 Hi stinky, I really liked this change, however, by adding I'm getting this nullpointer. Could you give me some help on? https://imgur.com/FSe7h5y
S-T-I-N-K-Y Posted January 5, 2019 Author Posted January 5, 2019 6 hours ago, N0K3 said: Hi stinky, I really liked this change, however, by adding I'm getting this nullpointer. Could you give me some help on? https://imgur.com/FSe7h5y Give a close view on your RandomZone.xml you did something wrong there.
Kara Posted January 5, 2019 Posted January 5, 2019 Change this code. public void selectNextZone() + { + int nextZoneId = Rnd.get(1, getTotalZones()); + while (getZoneId() == nextZoneId) + nextZoneId = Rnd.get(1, getTotalZones()); + _zoneId = nextZoneId; + + _timer = getCurrentZone().getTime() + 10; + } You can do better
N0K3 Posted January 5, 2019 Posted January 5, 2019 (edited) 1 hour ago, StinkyMadness said: Give a close view on your RandomZone.xml you did something wrong there. What's puzzling me is that things seem to be all right there. RandomZone.xml in the zone folder and inside it contains this, just like your example. <?xml version="1.0" encoding="UTF-8"?> <list> <zone shape="Cuboid" minZ="-3752" maxZ="-352"><!-- gludin_pvp --> <stat name="id" val="1" /> <stat name="name" val="Gludin Arena" /> <stat name="time" val="30" /><!-- time in seconds --> <stat name="locs" val="-88339,141802,-3649;-87894,142231,-3649" /> <node X="-88411" Y="141732" /> <node X="-87429" Y="142708" /> </zone> <zone shape="Cuboid" minZ="-3850" maxZ="-350"><!-- giran_pvp_battle --> <stat name="id" val="2" /> <stat name="name" val="Giran Arena" /> <stat name="time" val="30" /><!-- time in seconds --> <stat name="locs" val="73306,142440,-3775;72646,142403,-3775" /> <node X="72493" Y="142263" /> <node X="73493" Y="143261" /> </zone> </list> Edited January 5, 2019 by N0K3 I was able to identify it was something with the type, because my zones had L2 prefix at the beginning and I needed to adapt RandomZone to my source, thanks for the support.
melron Posted January 5, 2019 Posted January 5, 2019 1 hour ago, Kara` said: You can do better indeed. something like that would be more clean private static void selectNextZone() { final int maxSize = getTotalZones(); _zoneId = _zoneId >= maxSize ? 1 : _zoneId++; _timer = getCurrentZone().getTime() + 10; } public static int getTotalZones() { return ZoneManager.getInstance().getAllZones(RandomZone.class).stream().filter(zone -> zone != null).collect(Collectors.toList()).size(); }
SweeTs Posted January 5, 2019 Posted January 5, 2019 20 minutes ago, melron said: something like that would be more clean I believe it's supposed to be truly random, not seemingly. But yeah, one after another is also a way. Zones count, simply: ZoneManager.getInstance().getAllZones(RandomZone.class).size();
Kara Posted January 5, 2019 Posted January 5, 2019 RandomZone selectedZone = ZoneManager.getInstance().getAllZones(RandomZone.class).stream().findAny(); 1 line code instead of 8
SweeTs Posted January 5, 2019 Posted January 5, 2019 4 minutes ago, Kara` said: RandomZone selectedZone = ZoneManager.getInstance().getAllZones(RandomZone.class).stream().findAny(); 1 line code instead of 8 With that line, I believe you can pick the same zone, right? So, it's not what you really want. You must be sute the next zone is different
Kara Posted January 5, 2019 Posted January 5, 2019 3 minutes ago, SweeTs said: With that line, I believe you can pick the same zone, right? So, it's not what you really want. You must be sute the next zone is different Didn't know we need also that check. RandomZone selectedZone = ZoneManager.getInstance().getAllZones(RandomZone.class).stream().filter(s -> s.getId() != getCurrentZone().getId()).findAny().orElse(null); In null you can add to return the same zone if no other exist. I write it in notepad++ so i cannot know if syntax is ok
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now