Author Topic: Aide ennemie mur capteur  (Read 324 times)

Delltus

  • Newbie
  • *
  • Posts: 15
    • View Profile
Aide ennemie mur capteur
« on: December 18, 2017, 05:33:46 pm »
Bonsoir,
mon problème est que les monstre ce colle direct à la porte de haut pour m'attendre xD..
je souhaiterais faire un mur non franchissable part les ennemies et une fois que j'ai passer le capteur de la porte le mur disparaît
mais je sais pas comment faire ça coter code je vous remercie d'avance

Diarandor

  • Hero Member
  • *****
  • Posts: 935
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Aide ennemie mur capteur
« Reply #1 on: December 18, 2017, 08:07:11 pm »
I don't remember if walls allow enough customization to allow being traversed by the hero and not by enemies. Check that just in case.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

PhoenixII54

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Aide ennemie mur capteur
« Reply #2 on: December 18, 2017, 09:04:14 pm »
EN :They actully do have seperate behaviors for hero, enemies and destructibles (and other that i don't recall by head so yeah it will work).

FR : Petit indice : utilise l'evenement <nom du capteur>:on_activated() dans ton script de map, et dans la fonction, il suffit d'appeler map:set_doors_open(<nom de tes portes>,true/false).

D'autre part, l'objet "wall" permet de choisir ce qui peut ou non les traverser (héros, ennemis, objets destructibles, etc)
« Last Edit: December 18, 2017, 09:11:34 pm by PhoenixII54 »

Delltus

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Aide ennemie mur capteur
« Reply #3 on: December 19, 2017, 02:05:30 pm »
Merci pour vos réponses, ce que je souhaiterais c'est que tant que j'ai pas passer le capteur les monstres reste à leur places je sais pas si tu avais bien compris ça ?

Diarandor

  • Hero Member
  • *****
  • Posts: 935
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Aide ennemie mur capteur
« Reply #4 on: December 19, 2017, 03:50:18 pm »
Merci pour vos réponses, ce que je souhaiterais c'est que tant que j'ai pas passer le capteur les monstres reste à leur places je sais pas si tu avais bien compris ça ?

There is an easy way to code that if you use separators. Check
http://www.solarus-games.org/doc/1.6/lua_api_entity.html#lua_api_entity_is_in_same_region
However, if you are not using separators, that will not work.
I suggest you to use separators to keep this simple.
Note that you would need some code for the behavior of the enemy, depending on if its region coincides or not with the region of the hero.

If you don't want to use separators, you would need to make some custom code to determine which are the different custom rooms/regions in your map and get the custom room/region of each entity. Since the rooms may have an irregular shape, this can be quite complex. Some ways to do it:
1) You could give to the script some particular info of your map.
2) You can use sensors to indicate that the region of the hero has changed and in which one the hero is.
3) You can code a very complex (but general) algorithm that checks the ground types on each 8x8 tile and compute somehow which are the custom regions of your map (and get in which region is each entity).

I don't have much free time so I will not do it for you. Sorry.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Diarandor

  • Hero Member
  • *****
  • Posts: 935
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Aide ennemie mur capteur
« Reply #5 on: December 19, 2017, 03:58:45 pm »
PS: If you want separators that show the neighboring regions, you can open a pull request in the Solarus repo:
https://github.com/solarus-games/solarus/issues
and if Chris agrees to code the feature, we may have it someday. Some new properties for separators could be given by new functions:
Code: Lua
  1. separator:set_transition(transition_style) -- Transition types: "immediate", "fade", "scrolling", etc.
  2. separator:get_transition()
  3.  
  4. separator:set_visible_neighbor_regions(boolean) -- To show (or not) neighbor regions.
  5. separator:get_visible_neighbor_regions()
  6.  
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

MetalZelda

  • Hero Member
  • *****
  • Posts: 544
    • View Profile
Re: Aide ennemie mur capteur
« Reply #6 on: December 23, 2017, 12:15:28 am »
Isn't this feature used in ROTH SE ? I remember that enemies reset position when separators has been activated
Else, you might have to deal with distance to trigger ennemies but i'm pretty sure that what you're searching exists in ROTH SE

check for separator_manager.lua or something like this