Jump to content

Recommended Posts

Posted (edited)

findAny() can't be used as a counterpart of Rnd. It only means it doesn't guarantee any order based on your Stream. You can - or can't - retrieve exactly the same order. But most likely, it will produce exactly the same content. Meaning you will never see some of your maps.

 

In a non-parallel operation, it will most likely return the first element in the Stream but there is no guarantee for this.

You have to Rnd.get(list).

Edited by Tryskell
Posted
34 minutes ago, SweeTs said:

Yep, just did some tests and it's returning first element. Yet, it can do the trick, BUT first you have to use shuffle.

 

Less costy to pick a random element than to shuffle a whole container. And your point is to pick a single element, not the whole list, so shuffling the whole list is pointless.

 

:goodsir:

Posted
2 hours ago, Kara` said:

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

 

 

did you just imply that you wrote this code right out of your mind in a simple text editor?

 

What kind of psychotic autistic lair attention whore bitch can someone be, really 

Posted (edited)

for randomness I would go with a jackpot-like random generator pool, feel free to use my code

 

https://pastebin.com/SZq07PZy

 

your jackpot weight should be an inversion of current zone hits

Edited by xdem
  • 2 months later...
Posted (edited)

Hello MXC members, maybe anyone try this zone changer? I try but I can't change zones from ZoneManager.xml 

If I change loc's not move me to other zone or maybe only can use arena type? anyone know how to fix?

Also only Cuboid can use? Because i try make NPoly and get error to console. Help to me pls.

Edited by Gezis
Posted
5 hours ago, Gezis said:

...

Code is working fine and with zone type RandomZone not with Arena
Also ofc you can use NPoly, the diff is coded on aCis 377 if you have older version or newest you have to adapt parts of code.

Posted (edited)
50 minutes ago, Gezis said:

Yes code working to me, but I say about random zone with other locs :) maybe my fault with xml idk. But I chancge only from "CuboId" to "NPoly" 


Cuboid required : 2 node locations.
NPoly required : 3+ node locations.

//Edit
Here is one good tutorial from @SweeTs Tutorial Link

Edited by StinkyMadness
Posted

Yes my bad, working with NPoly, but not move to next zone, with default zones (Arena) move.

My zones:

<?xml version="1.0" encoding="UTF-8"?>
<list>
	<!-- Random Zones -->
	<zone type="RandomZone" shape="NPoly" minZ="9080" maxZ="11080"><!-- gludin_pvp -->
		<stat name="id" val="1"/>
		<stat name="name" val="Gludin Arena"/>
		<stat name="time" val="120"/><!-- time in seconds -->
		<stat name="locs" val="114264,16280,10080;115009,15114,10080"/>
	        <node X="115736" Y="16152" />
	        <node X="116056" Y="16872" />
	        <node X="114856" Y="17768" />
	        <node X="114083" Y="17376" />
	        <node X="113140" Y="14874" />
	        <node X="114264" Y="15650" />
		<spawn X="114264" Y="16280" Z="10080" />
	</zone>
		<zone type="RandomZone" shape="NPoly" minZ="9080" maxZ="11080"><!-- gludin_pvp -->
		<stat name="id" val="2"/>
		<stat name="name" val="Arena"/>
		<stat name="time" val="120"/><!-- time in seconds -->
		<stat name="locs" val="114264,16280,10080;115009,15114,10080"/>
	        <node X="115736" Y="16152" />
	        <node X="116056" Y="16872" />
	        <node X="114856" Y="17768" />
	        <node X="114083" Y="17376" />
	        <node X="113140" Y="14874" />
	        <node X="114264" Y="15650" />
		<spawn X="114264" Y="16280" Z="10080" />
	</zone>
</list>

 

Posted (edited)
43 minutes ago, Gezis said:

....


Nice zone... its around the TOP of the Sky take a look on you minZ maxZ.... also aCis have //check_zone if there not appear "random zone" then your nodes are wrong... but on current XML the minZ maxZ looks TOTAL to much... If you are not inside zone how you will be teleport ?

Edited by StinkyMadness

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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




  • Posts

    • Lineage2Network - Interlude Reimagined   Embark on a revitalized journey through the classic Interlude era with Lineage2.Network. Our server is meticulously crafted by veteran players to deliver a seamless and engaging experience, blending the nostalgia of the Chaotic Chronicle with modern enhancements.     Server details   Chronicle: Interlude + Classic Rates: EXP x30 | Adena x10 | Drop x10 | Spoil x10     Server features   Daily Missions - complete special tasks for daily rewards Attendance Rewards - get rewards for online time Custom Events - TVT, DM, CTF NPC buffer duration - 2 hours   Mana Potions - restores 1000 MP, 10s cooldown Ring of Core additional stats: +1 STR Earring of Orfen additional stats: +1 INT Shadow Earring of Zaken - 7 days Shadow Ring of Queen Ant - 7 days   Max buff count - 24 (20 + 4 with Divine Inspiration) Noblesse, Heroic Valor, Flames of Invincibility and Celestial Shield don't take buff slot Reworked Cancel, Mage and Warrior Banes – removed buffs reappear after 30s Block Buffs - block all incoming buffs except from self/party Sweeper Festival added to Spoiler class   Subclass – retail or purchasable Noblesse – retail or purchasable up to Barakiel; collect 8 fragments for full staff 1st & 2nd class free, 3rd needs 700 Halisha Marks or is purchasable New Olympiad System: new stadiums with NPC buffer,  1 week period.     Key dates     Beta Launch: April 14, 2025 Official Launch: May 9, 2025     Check out full server details in our website And visit our discord   Join us and be part of community where classic gameplay meets innovative updates. Whether you're a solo adventurer or part of a formidable clan, Lineage2.Network offers a dynamic and balanced environment for all.  
    • Good day. Our game currency store is looking for suppliers of adena and items on a project such as L2REBORN x10. We also sell Epic jewelry and various items on this project L2REBORN x10. There are items and adena on L2REBORN x1. For all questions, write to us in discord - goddardshop
  • Topics

×
×
  • Create New...