Thanks, but my problem is when 2 npcs (or custom_entities in my case) go out or enter the map at the same time (and at the same place of course). I already make them leave or enter the map, and there's no problem here. But as the set_ignore_obstacles() parameter is true, they are passing through each other. And the result of this is odd.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#2
Development / custom entity and map limit
August 28, 2018, 10:06:05 AM
Hello,
I was wondering if it was another way to make custom entity go outside of the map limits. For the moment, I use movement:set_ignore_obstacles() with some positions test to make them go out and in but I wanted to know if there was another collision test with maps limit. I tried custom_entity:set_can_traverse_ground with empty ground but as I expected it doesn't work !
My problem is that I wanted that my custom entity (or npc) go outside and inside the map, but if I two of these entities walk in the same position (or if the 2 bounding box overlaps), they will be stucked if I set movement:set_ignore_obstacles() to false when they enter the map. And I can't let it to true, otherway they will not be obstacles in the map.
If someone has a solution, it would be great !
Thanks.
I was wondering if it was another way to make custom entity go outside of the map limits. For the moment, I use movement:set_ignore_obstacles() with some positions test to make them go out and in but I wanted to know if there was another collision test with maps limit. I tried custom_entity:set_can_traverse_ground with empty ground but as I expected it doesn't work !
My problem is that I wanted that my custom entity (or npc) go outside and inside the map, but if I two of these entities walk in the same position (or if the 2 bounding box overlaps), they will be stucked if I set movement:set_ignore_obstacles() to false when they enter the map. And I can't let it to true, otherway they will not be obstacles in the map.
If someone has a solution, it would be great !
Thanks.
#3
Development / Re: Is it possible to check when carried object hits ground
August 24, 2018, 08:51:17 AM
Hello, I did something to create a "non destructible objet" using the metatable of destructible. When the carried object stop its movement, a new destructible is created instead, at the "landing"position. It's like the object can be carried and thrown again and again.
In your case, you have to test the position with the ground's one and if it's a hole, change the animation with the falling one. (and of course, not create the new object !!)
For one time I am not asking for help, I'm glad to help someone else !
Code Select
function destructible_meta:on_lifting()
local map = self:get_map()
local hero = self:get_map():get_hero()
local sprite = self:get_sprite():get_animation_set()
local name = self:get_name()
local entity_state = nil
if name ~= nil then
sol.timer.start(map, 10, function()
if hero:get_state() == "lifting" then
entity_state = hero:get_state()
end
if entity_state == "lifting" and hero:get_state() == "carrying" then
entity_state = hero:get_state()
end
if entity_state == "carrying" and hero:get_state() == "free" then
entity_state = hero:get_state()
for entity in map:get_entities_by_type("carried_object") do
function entity:on_movement_changed(movement)
local x,y,layer = entity:get_position()
if not map:has_entities(name) then
if name:match("^non_destructible") then
map:create_destructible{name = name, layer = layer, x=x, y=y, sprite = sprite}
entity:remove()
end
end
end
end
return false
end
return true
end)
end
end
In your case, you have to test the position with the ground's one and if it's a hole, change the animation with the falling one. (and of course, not create the new object !!)
For one time I am not asking for help, I'm glad to help someone else !
#4
Development / Re: Store map entities in a table automatically
August 01, 2018, 01:22:52 PM
Thanks a lot, Grand Master of Solarus ! It was more easy than I expected !!
I just have to add get_name() to make it work !
I just have to add get_name() to make it work !
Code Select
local destinations = {}
for destination in map:get_entities_by_type("destination") do
destinations[#destinations + 1] = destination:get_name()
end
#5
Development / Store map entities in a table automatically
July 31, 2018, 09:30:02 AM
Hello !! Long time no see !
I'm wondering if it was possible create a table with map entities ?
Here is my need :
I want to create some npc randomly on a map, but, I want those npc to be created on random destinations already on the map. I found how to do, but I have to make a table with all destination manually, and I wanted to know if it was a possibility to automatically generate a table with all map destinations (it could be usefull if the map had 50 or more destinations)
I think that using the map data file could be a solution but I don't see how to do it... (maybe with parsing the map entities corresponding to a destination ?)
Thanks in advance for solutions
I'm wondering if it was possible create a table with map entities ?
Here is my need :
I want to create some npc randomly on a map, but, I want those npc to be created on random destinations already on the map. I found how to do, but I have to make a table with all destination manually, and I wanted to know if it was a possibility to automatically generate a table with all map destinations (it could be usefull if the map had 50 or more destinations)
I think that using the map data file could be a solution but I don't see how to do it... (maybe with parsing the map entities corresponding to a destination ?)
Thanks in advance for solutions
#6
Bugs & Feature requests / npc suggestion if not already told
February 21, 2017, 01:28:08 PM
Hello, I don't know if it was already suggested, but I was wondering if it was not possible to add the function "set_drawn_in_y_order" to the npc (the generalized one). I explain myself :
I often have to create a custom entity to replace a generalized NPC because the sprite is more than 16x16 pixel. This could be useful to create a big stone or a letter box or whatever taller than 16 pixels without coding a dialog function in a custom entity and it could avoid to have a lot of them in the entities folder, especially if they are useless (just for a dialog).
Maybe it's not possible or not necessary because custom entity make it, but I think it could be easier to make some "big readable things".
PS: I was thinking of it and it could be usefull for all map entities !
I often have to create a custom entity to replace a generalized NPC because the sprite is more than 16x16 pixel. This could be useful to create a big stone or a letter box or whatever taller than 16 pixels without coding a dialog function in a custom entity and it could avoid to have a lot of them in the entities folder, especially if they are useless (just for a dialog).
Maybe it's not possible or not necessary because custom entity make it, but I think it could be easier to make some "big readable things".
PS: I was thinking of it and it could be usefull for all map entities !
#7
Bugs & Feature requests / Re: possible bug when asking a question
January 11, 2017, 08:16:53 PM
Good job Diarandor! It works fine with the line self.choices = {} added.
Sorry to have opened an issue on github for a script error... (I don't even think to check it, and even if I checked the script, I'm not familiar with all the subtility of the lua language)
Quote from: MetalZelda on January 11, 2017, 07:39:34 PMHe definitely had the solution.
Edit: Diarandor might have the solution
Sorry to have opened an issue on github for a script error... (I don't even think to check it, and even if I checked the script, I'm not familiar with all the subtility of the lua language)
#8
Bugs & Feature requests / Re: possible bug when asking a question
January 11, 2017, 06:55:38 PM
I use the alttp dialog box. The one in the ressource pack.
#9
Bugs & Feature requests / Re: possible bug when asking a question
January 11, 2017, 06:42:21 AM
Done ! I put an issue on github : https://github.com/solarus-games/solarus/issues/1016
I was wondering if my dialog code was right, but I don't think it was the problem.
I was wondering if my dialog code was right, but I don't think it was the problem.
#10
Bugs & Feature requests / possible bug when asking a question
January 10, 2017, 04:00:35 PM
Hello! I don't know if it is a bug,if someone already told it, or if it's just my mistake, but when I wanted to ask a question with 3 answers, if one of this answer has another question with only 2 answers, the cursor moves like there was 3 answers, like the first question(even if the fourth line is blank, or the answers start on the third line, the cursor moves on line 2,3 and 4
I found why it was like that, but I don't know if it's normal: in my dialog, I put all the questions in the same sub directory like this :
- somedialog.question.question1
- somedialog.question.question2
question1 having 3 answers, question2 having 2 answers. When testing, there's the bug I mentionned.
To avoid the bug, I had to do this.
- somedialog.question1.question
- somedialog.question2.question
Did anyone already see this ?
I found why it was like that, but I don't know if it's normal: in my dialog, I put all the questions in the same sub directory like this :
- somedialog.question.question1
- somedialog.question.question2
question1 having 3 answers, question2 having 2 answers. When testing, there's the bug I mentionned.
To avoid the bug, I had to do this.
- somedialog.question1.question
- somedialog.question2.question
Did anyone already see this ?
#11
Development / Re: Avoid pickables to be ... picked ?
December 28, 2016, 03:51:53 AM
Hello. I didn't come here since a long time, but I visit the forum this morning and saw your post. I think that maybe with layer, and transparent tile, you should do something. i.e put your item on the tile in the upper layer, and make the layer change when the hero jump. I don't know if it works, but it's an idea I had.
#12
Development / Re: Is anyone working on a local co-op play? is there an easy way to do it?
February 06, 2016, 06:54:48 AM
Thanks a lot! But for now I'm just working on other things and I don't want to put my head into this. But when I will have some time, I'll look it and maybe this time I'll ask for your help !
#13
Development / Re: Is anyone working on a local co-op play? is there an easy way to do it?
February 02, 2016, 05:15:37 AMQuoteMy scripts are not exactly to make secondary heroes as followers, they stay stopped until you switch, so it's not exactly the same mechanics, only the switching hero function will be similar.
Well, since my second character can also be stopped on a map, I think it was the same. I don't see your script, and maybe it could be usefull for me for some little trouble I have (especially with tunics which is not save in my script, so I have to use a trick to do it)
#14
Development / Re: Is anyone working on a local co-op play? is there an easy way to do it?
January 26, 2016, 08:11:20 AM
Hello and Happy New Year everyone (It's still time!) ! So, it would be like Secret of Mana (and seiken 3) on SNES ! I've done this with my game (to test the follower without changing the leader) and it works. (I don't use Diarandor's script because I've my own, but it should be the same!)
#15
Development / Re: Lens of Truth?
November 18, 2015, 11:02:17 AM
Hello !
I've done something like this when I developped the lens for my project with RM2K. I didn't make it yet with solarus but I have a lot of things to do before !!
I've done something like this when I developped the lens for my project with RM2K. I didn't make it yet with solarus but I have a lot of things to do before !!