Jump to content
  • 0
Oliver Hope

RESOLVED [YLD-16743] On Pick event - problem with target entity properties

Question

When using the on pick event and getting the position propertes from the target entity it returns seemingly random values not related to where the entity was.

In this particular instance:

An event listener listening to a player picking up entities in an label.

Add label ( spawn entity( get type (target object) , get pos(target object), get orintation ( target object)));

so that any entity in the label that was picked up was replaced and given the label.

 

I believe the type and orintation were correct but i can only be 100% sure about the position being wrong it was so wrong that the entity it spawned was nowhere in sight 

If you need the files then ask @Fompster_P1 

Share this post


Link to post
Share on other sites

15 replies to this bug / suggestion

Recommended Posts

  • 0

I seem to recall before, if the listener was set to trigger after, then it would return strange coordinates once the item was in the player's inventory.  Of course, now it doesn't look like it has the trigger before/after option anymore.

If your items are plants that the player is harvesting (a garden of flax, for example) then I just tried using ON COLLECTING, and it seemed to return the right coordinates.  I just had it play a particle effect for my test, but it was in the right place.  It doesn't work for picking up regular items, though.

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0

:friendly reminder:

Please check & solve this for us to be able to correct our Game, the Chef Wars.

Share this post


Link to post
Share on other sites
  • 0

things do respawn with our script:
pineapples work
watermelons works
grass work
rabits works
crabs work
spinach works
potatoes work

things do not respawn with the script:
carrots don't work
flint and stone don't work
champignons don't work
eggs don't work
grain don't work
oyster don't work
starfishes don't work

 

Share this post


Link to post
Share on other sites
  • 0
28 minutes ago, Cthulunatic said:

things do not respawn with the script:
carrots don't work
flint and stone don't work
champignons don't work
eggs don't work
grain don't work
oyster don't work
starfishes don't work

It seems to be everything on the "on pick" event although the exact same script works for the collect

 

On a related note, I have been trying to teleport players when they touch the water with the "on swim start" event listener but instead it breaks the swimming feature and I think it is also related to the wrong positioning. You can see on the map what I've been trying to do.

WATER_TEST.yland_2.zip

Share this post


Link to post
Share on other sites
  • 0

Sorry, for some reason I overlooked this issue - just added it to the system!

  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0
On 4/22/2019 at 6:57 PM, Oliver Hope said:

When using the on pick event and getting the position propertes from the target entity it returns seemingly random values not related to where the entity was.

In this particular instance:

An event listener listening to a player picking up entities in an label.

Add label ( spawn entity( get type (target object) , get pos(target object), get orintation ( target object)));

so that any entity in the label that was picked up was replaced and given the label.

 

I believe the type and orintation were correct but i can only be 100% sure about the position being wrong it was so wrong that the entity it spawned was nowhere in sight 

If you need the files then ask @Fompster_P1 

The issue here is that "target object" in this case returns the picked object when already in inventory. We will adress this issue in 0.13 by separating this event in two:

  • On Pick Start -> event when item is being picked but not yet moved to inventory -> target object = object on ground 
  • On Pick End -> event when item is picked and put in inventory -> target object = item added to inventory (new item or increased stack)

Current "On Pick" event will be renamed to "On Pick End", so for people not concerned with this issue nothing will change

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0

and as bonus note: you will get same item in On Pick Start and On Pick End for all non stackable items.

Share this post


Link to post
Share on other sites
  • 0
On 5/25/2019 at 1:20 PM, Fompster_P1 said:

It seems to be everything on the "on pick" event although the exact same script works for the collect

 

On a related note, I have been trying to teleport players when they touch the water with the "on swim start" event listener but instead it breaks the swimming feature and I think it is also related to the wrong positioning. You can see on the map what I've been trying to do.

WATER_TEST.yland_2.zip

Could you please start a new thread in "Editor technical issues" subforum, so that we can add it to issue tracker as separate entry. Thank you :)

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, Rudy.cz said:

The issue here is that "target object" in this case returns the picked object when already in inventory. We will adress this issue in 0.13 by separating this event in two:

  • On Pick Start -> event when item is being picked but not yet moved to inventory -> target object = object on ground 
  • On Pick End -> event when item is picked and put in inventory -> target object = item added to inventory (new item or increased stack)

Current "On Pick" event will be renamed to "On Pick End", so for people not concerned with this issue nothing will change

Is it returning the position of the object in the players inventory in other words the position of the player or something else? Cause I checked where the co ordinates were that it was giving me and it was really far away from the place i was picking up items

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, Rudy.cz said:

The issue here is that "target object" in this case returns the picked object when already in inventory.

How come it works for the collect event?

Share this post


Link to post
Share on other sites
  • 0
1 minute ago, Fompster_P1 said:

How come it works for the collect event?

Maybe im wrong here but on collect works for something like a pineapple, when you collect it you dont collect a pineapple plant you just collect a pineapple, I think the entity that you are refrencing is the whole plant which doesnt go into your inventory

 

Share this post


Link to post
Share on other sites
  • 0
4 minutes ago, Oliver Hope said:

Maybe im wrong here but on collect works for something like a pineapple, when you collect it you dont collect a pineapple plant you just collect a pineapple, I think the entity that you are refrencing is the whole plant which doesnt go into your inventory

I was thinking that too, but the whole plant dissapears when you collect it

2 hours ago, Rudy.cz said:

Could you please start a new thread in "Editor technical issues" subforum, so that we can add it to issue tracker as separate entry. Thank you :)

All done :)

Share this post


Link to post
Share on other sites
  • 0
Just now, Fompster_P1 said:

I was thinking that too, but the whole plant dissapears when you collect it

The instance would only be distroyed once the script has finished running

Im just guessing though ?

 

Share this post


Link to post
Share on other sites
  • 0

Hi, it returns "invalid value". Maybe in the future it will be zeroed (0, 0, 0).

However to be specific: when you pick item, it's original position remains in it's data. The problem you encounter is that when you pick stack of item type which you already have in your inventory then picked item is destroyed and it just adjust stack size of the same item in player's inventory which has still position of its original "pick place".

In 0.13 we will introduce second event "pick start" which will return stackable item before it is destroyed and "pick end" which will return "merged stack" in your inventory (as On pick does now). For nonstackable items both of the events will provide exactly same item. For stackable it will be same item only in the cases when player did not have same type of the item in his inventory.

Share this post


Link to post
Share on other sites
  • 0
On 6/4/2019 at 10:07 AM, Rudy.cz said:

The issue here is that "target object" in this case returns the picked object when already in inventory. We will adress this issue in 0.13 by separating this event in two:

  • On Pick Start -> event when item is being picked but not yet moved to inventory -> target object = object on ground 
  • On Pick End -> event when item is picked and put in inventory -> target object = item added to inventory (new item or increased stack)

Current "On Pick" event will be renamed to "On Pick End", so for people not concerned with this issue nothing will change

Can do do something similar to ON SAW at event listener? I can't stop player from using the saw on trees. I want to have a role that only that role is able to chop down trees (i can stop them from cutting with weapons, axes) but not for the iron saw because it's 2 different things, and on saw is only triggered before the player uses the saw (tge event is triggered, but the scripting will only act before the tree is down) 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×