Jump to content
Sign in to follow this  
Igor Q.

Active item of Player

Recommended Posts

Hi
 

It would be really great and make life easier if

1) We can assign and lock the active items onto a player (Or give them a 1-slot item bar)

2) If using the "get active item of player" and the player does not have an active item to return None (Entity) instead of giving us an error.

3) Disable players from using "i" to see their inventory when their hud is disabled.

Thanks!

Share this post


Link to post
Share on other sites

Hi,

1) we also think about that feature

2) it should work as you are mentioning. It returns None(null). What error you are getting and what snippet of code are you using?

3) When you disable inventory for a player you are unable to use i. (same as in our game Playlands)

  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/1/2019 at 10:46 AM, Houp said:

Hi,

1) we also think about that feature

2) it should work as you are mentioning. It returns None(null). What error you are getting and what snippet of code are you using?

3) When you disable inventory for a player you are unable to use i. (same as in our game Playlands)

@Houp @Adam Snellgrove i'm getting the error still , and we are at 13/04/2020 and this post is from 2019.
So, if the player doesn't have any active item, we get an error None…

I'm trying to help a new person. So, should I say this is a ylands bug? :(

I tried to use a
IF (get active item player (trigger entity) = NONE) 
console write ("no item in hands")

Still getting the same bug, but if I hold another kind of item, the bug doesn't show up (or --> console write "you don't have the required item")

 

 

triggerzone_script.png

tigger_activeITEM-error.png

Edited by jchob

Share this post


Link to post
Share on other sites

Have you tried checking (IsEntity (Get Active Item)) first, then check if it's the right one?

Share this post


Link to post
Share on other sites
6 minutes ago, Indomitus said:

Have you tried checking (IsEntity (Get Active Item)) first, then check if it's the right one?

the code I have works that is --> holding in hands (active item that is the paper).
But if the player isn't holding anything (no active item), you get the error. 
But if i hold other item, the error doesnt show anymore.

Try it for yourself :)

Edited by jchob

Share this post


Link to post
Share on other sites

@Indomitus Can you test it? i've been stupid and tired the last days. But maybe it's my fault again...

Share this post


Link to post
Share on other sites

Try something like this:

Ylands_200412_233121.thumb.png.7ca0cf09abbcae229dba1691606f4633.png

I used a "Magic Easter Egg" as the item it checks for, but it could be anything.

 

Ylands_200412_233155.thumb.png.d35c33477a040bf4929fb0b7f8a8d449.png

Ylands_200412_233212.thumb.png.5441c777ced82d60e3bf7ccb5effc645.png

Ylands_200412_233230.thumb.png.9a6ea448b35505fc3bad31e47ce25359.png

Share this post


Link to post
Share on other sites

@Indomitus yeah right, that works. But it doesn't make any sense in my opinion.
 

You shouldn't be forced to check IS ENTITY  if you are not just holding anything, the error shouldn't show up.
Just a IF to check if you are holding the right item would enough, in my opinion.

Because, a trigger zone is triggered by a player character, and the character is NOT a entity (it returns false if you use the IS ENTITY on the player). But you can still use GET NAME entity, GET POSITION Entity, etc etc for the player. That doesn't make any sense.

Maybe i've been "out" for long time and maybe i'm too tired to think.
I guess i should unninstall this game then.

Thanks anyway :)

 

Edited by jchob

Share this post


Link to post
Share on other sites

Another exemple: 
ON TRIGGER enter
If Get name entity = JCHOBS
console write ("ok, jchobs spotted),

But if another player enters the trigger, i don't get that error. That error only shows up for Entities? (Like I said before, player is not na entity but you can still uset the ENTITY tiles for the player? No sense at all)

Do you understand what I mean?

P.S. I learnt today that player is not an Entity? oof, really oof

Edited by jchob

Share this post


Link to post
Share on other sites

1.  This kind of checking is what IS ENTITY exists for.  Error handling is a common concern across all programming languages.  In Ylands, that means checking your data types and values up front.

2.  Of course a player is an entity.  If they weren't then tiles like GET NAME, GET POSITION, or GET ROTATION wouldn't work, and Entity Labels or Entity Storage wouldn't work on them.

Share this post


Link to post
Share on other sites
4 hours ago, Indomitus said:

1.  This kind of checking is what IS ENTITY exists for.  Error handling is a common concern across all programming languages.  In Ylands, that means checking your data types and values up front.

2.  Of course a player is an entity.  If they weren't then tiles like GET NAME, GET POSITION, or GET ROTATION wouldn't work, and Entity Labels or Entity Storage wouldn't work on them.

Oof I got confused. I'm not thinking right these last days.
Why did I say it returns false as an Entity? omg, i'm feeling so ashamed right know (maybe I should stop using forum while I drink). So sorry man.. geez

Anyway, I never thought that I should use the IS ENTITY for this case, but it really makes sense for error handling. Thanks

Edited by jchob

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
Sign in to follow this  

×