Posts by angriff
Latest hotfix: 0.8.0.1 (2024-12-20)
-
-
Do a search from the G's in the Javadoc .. but try the below.
https://javadoc.rising-world.n…c.html#getHostilePlayer--
It is in the NPC so possibly the start of bandits.
-
-
Wow thanks Red.. the instanceof part was not in my vocabulary.. .. so would have struggled as I cant test without peeps.. extremely helpful. Just made my day.
-
If you want to find out which object the player is currently looking at, the raycast() method is indeed what you're looking for The method "shoots" a ray from the player camera position and checks if it collides with any solid objects. Since the raycast is performed clientside, a callback is required (if any collisions occurred, the result contains these information). You can find an example in the Javadoc.
A raycast is rather "expensive" in terms of performance (not expensive for the server, but for the particular client), however, it matters how often you actually perform it. It will only be a problem if it's performed too frequently, e.g. every tick, so using it in the PlayerChangePositionEvent or the UpdateEvent is not advisable. If you really have to perform a raycast frequently, there should be a delay of 50 or 100 ms (at least) between every raycast (per player).Thanks Red.. ya I just finished writing a test routine that works using your examples. They work great. I do have a couple of questions
- Is the normal raycast easier (the one that sends just along the x direction) on the performance than the others? I have the concept that it is only sending one ray out..
- getting the name of the npc is an interesting exercise in typing correctly but works fine but if I wanted to get a players information would it be Object obj = result.getCollisionObject(); PLAYER player = (PLAYER) obj;? So I can later get the UID and other information from the target player. I can't test this without help so was looking to save some development time for my code.
Thanks
-
Ok I guess the Raycast method is the way.. Yes?
Just what performance hit does it do?
void raycast(int collisionType, Callback<RayCastResult> callback)
-
What is the API that gets the mouse focus .. I am looking to point a player and find out their ID for interactions. Not a GUI thing.
-
Why get hung up on the word release, or on beta vs alpha for that matter? These are terms of project development without meaning to the players. What does release actually mean? Does it mean they are done and can go to another project leaving the game in a static state? Rather, I prefer continuous quality improvement.
-
I am not a vegetarian but I play one in Rising World. Just start a good sized garden and you will never need meat again. In fact, the only meat I eat is from the wild boars that often take issue with my trespassing. And then I usually end up burning it, LOL. So, should crop blight of some sort come into the game, I still have all of those critters to eat.
I am glad they are changing that . as crops will fail and need attention... the abundance of resources in the game is both a blessing and bane.
-
Not by itself. Particularly if the two plug-ins are in different packages, you have to code explicitly the first plug-in to be reachable (classes must be public, variables must be public and possibly static, and so on) and the other plug-in to look for it (using the first plug-in name with the Plugin.getPluginByName() API method) and write into the first plug-in variable explicitly.
Whether plug-ins are event-driven or not is largely irrelevant (in a sense, almost all plug-ins are event-driven); what matter are scopes and access levels; and Java does a rather good job in avoiding casual inter-package accesses.ok will these events changed the name of player and they were in different plugins. When the timer finishes player had changed and was now the new player. This same thing happens when you use onconnect. The second player is now player and the message broadcasts not the with first player in the timer but the second player. Now that example is the same plugin so it is not exactly the same. I changed the routine to onSpawn and it went away.
-
So basically the question is this. If I have a plugin that as a variable <player> and another plugin has a variable public <player> can my player be overwritten by the other plugin's player if both are event driven?
-
Eventually a server becomes a hollow space .. if the owner does not tidy up and restock.. players dig to the dungeons then leave.. the next guy gets left overs.. would be nice to have routine to reset the dungeons without a server wipe.
-
That way we can make rollercoasters
-
public void onObjectInteraction(PlayerObjectInteractionEvent tcevent)
and
public void onObjectInteraction(PlayerObjectInteractionEvent vent)
are totally equivalent.
playerreal = Player player = tcevent.getPlayer();
is non-syntactical: you would not even be able to compile it.
What you mean by "event tag"? In another plug-in? It seems hard to figure out what you are trying to do and then what might be wrong.
Some code excerpt would also help in understanding...ok well made everything private ... thanks anyway.
-
The event object is local to it's parenthesis so no need to rename it.
Well the issue is the event is in a timer and then executes at a later time. I got a different player return because the timer was not finished and a player created another event.
-
Ok I have a code that has a timer on it after an event. Problem is if someone does another event then the event tag in another plugin seems to change for event.player. Can I just make the event name unique?? That is as follows:
public void onObjectInteraction(PlayerObjectInteractionEvent tcevent)
Instead of
public void onObjectInteraction(PlayerObjectInteractionEvent vent)Or is it better to assign a different variable to the player in
playerreal = Player player = tcevent.getPlayer();
versus
Player player = event.getPlayer();or do is it best to capture the UID during the timer so it is not interfered with by another player? Looking for best safe form.. not necessarily making a big DB read/write to insure the timer executes with the correct player name
-
-
what are trying to do remove it , just get the number of items or place a certain amount in the .Quickslots? The only way I would know how would be to remove everything then return what you want to it. I guess you could get a count and just remove that amount too if you needed.
void removeItem(int slot,Inventory.SlotType slotType,int amount)
player.getInventory().removeitem(int slot,Inventory.SlotType slotType,int amount)
use the QuickslotFocus to see which one.https://javadoc.rising-world.n….html#getQuickslotFocus--
or insertNewItem.
Item insertNewItem(short itemID,int variation,int stacksize,int slot,Inventory.SlotType slotType)From the javadocExample: Insert an item (ID 12) with stacksize of 32 into the first inventory slot
1 Inventory inventory = player.getInventory(); 2 Item item = inventory.insertNewItem((short) 12, 0, 32, 0, SlotType.Quickslot); 3 if(item != null){ 4 System.out.println("Item "+item.getName()+" has been added to the inventory"); 5 } Hope that is not too general and helps ..
-
Tried to stop a soundfile music that was playing upon exiting an area that was started when on enter.
PlayerEnterAreaEvent
SoundInformation jesu = new SoundInformation(this, "/sounds/jesu.ogg");
player.playSound(soundfile);
id = player.playSound(jesu);
PlayerLeaveAreaEvent
player.stopSound(id);file was 1meg ogg format.
Got this error:
Uncaught exceptionthrown in Thread[jME3 Main,5,main]
java.lang.UnsatisfiedLinkError:de.jiw.fmod.wrapper.lowlevel.Sound.release(J)V
atde.jiw.fmod.wrapper.lowlevel.Sound.release(Native Method)
atde.jiw.fmod.wrapper.lowlevel.Sound.release(Sound.java:91)
atax.d.b(SourceFile:153)
ataK.a.a(SourceFile:2423)
atcommons.JIWApplication.update(SourceFile:299)
atcom.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
atcom.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:198)
atcom.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
atjava.lang.Thread.run(Unknown Source) -
well I thought it was a local server event and if it had the same name.. luckily I was looking at
java.util.Collection myAreas = server.getAllAreas();
int asize = myAreas.size();