Author Topic: [SOLVED] set_traversable_by issue  (Read 1343 times)

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
[SOLVED] set_traversable_by issue
« on: October 16, 2015, 12:59:00 am »
Hello

I'm facing a issue with a basic custom entity (rewriting the chests), in on_created, i do follow the instructions by adding

Code: (lua) [Select]
  self:set_can_traverse("hero", false)
  self:set_traversable_by("hero", false)
  self:set_traversable_by("hookshot", false)
  self:set_traversable_by("arrow", false)
  self:set_traversable_by("destructible", false)

the thing is, the hero cannot traverse the door, except if he has a certain item, but the hookshot,arrow and destructible don't work, they go through the entity, even if set_traversable_by is false.

I'm using Christopho's LUAs'd hookshot and bow scripts, that might be the issue, but I don't understand why it don't work for the destructible

Oh by the way, do you know a way to disable menu access during a cutscene ? hero:freeze() still allow to access the pause menu  ???

thanks for the answer
« Last Edit: October 16, 2015, 01:14:44 pm by Username »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1177
    • View Profile
Re: set_traversable_by issue
« Reply #1 on: October 16, 2015, 01:49:45 am »
- The scripted hookshot and arrows are custom entities, they are not entities of built-in type "hookshot" or "arrow". So you need self:set_traversable_by("custom_entity", function() ........ end), passing a callback that decides.
- There might be a bug if destructibles can traverse your entity. However, it is not usual to move destructibles (recall that destructibles are bushes/pots/skulls).
- There is a function game:set_pause_allowed (see the doc).

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: set_traversable_by issue
« Reply #2 on: October 16, 2015, 01:13:40 pm »
- The scripted hookshot and arrows are custom entities, they are not entities of built-in type "hookshot" or "arrow". So you need self:set_traversable_by("custom_entity", function() ........ end), passing a callback that decides.
- There might be a bug if destructibles can traverse your entity. However, it is not usual to move destructibles (recall that destructibles are bushes/pots/skulls).
- There is a function game:set_pause_allowed (see the doc).

Ah, everything works great now, thanks  ;)