Aide ennemie mur capteur

Started by Delltus, December 18, 2017, 05:33:46 PM

Previous topic - Next topic
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

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."

December 18, 2017, 09:04:14 PM #2 Last Edit: December 18, 2017, 09:11:34 PM by PhoenixII54
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)

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 ?

Quote from: Delltus 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 ?

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."

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) Select

separator:set_transition(transition_style) -- Transition types: "immediate", "fade", "scrolling", etc.
separator:get_transition()

separator:set_visible_neighbor_regions(boolean) -- To show (or not) neighbor regions.
separator:get_visible_neighbor_regions()
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

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