Show Posts

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.


Topics - Yosha

Pages: [1]
1
Development / custom entity and map limit
« on: 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.

2
Development / Store map entities in a table automatically
« on: 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

3
Bugs & Feature requests / npc suggestion if not already told
« on: 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 !

4
Bugs & Feature requests / possible bug when asking a question
« on: 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 ?

5
Development / one enemy works, but two not...
« on: October 01, 2015, 09:37:49 am »
Hello, I have a problem with an enemy I made. I 've done a Skulltula (like in OoT) falling from the ceiling, turning, etc... and after many days of coding, I finished it. It works as I would, but when I adding a second Skulltula, both of them doesn't work! I had the same problem when I made custom wizzrobe (before the release of ROTH, otherwise I didn't lost my time on it) and I've solved it somehow, but I don't remember how today! I think it's a problem with "self", but not sure! Here is the code. (And if it can help some dev to make a skulltula!)
Code: ( lua) [Select]
local enemy = ...

-- Skulltula :

local fallen = false
local vulnerable = false

local shadow_x, shadow_y, shadow_z = enemy:get_position()
local m = sol.movement.create("straight")

local angle = math.pi/2
local angle_inverse = 3*math.pi/2

function enemy:on_created()
   self:set_life(4)
     self:set_damage(2)
     self:set_optimization_distance(160)
     self:set_size(16, 16)
     self:set_origin(8, 13)
   self:set_can_attack(false)
   self:set_pushed_back_when_hurt(false)
   self:set_attack_consequence("sword", "custom")
     self:set_attack_consequence("hookshot", "ignored")
     self:set_attack_consequence("boomerang", "ignored")
   self:set_attack_consequence("explosion", "ignored")
   self:set_obstacle_behavior("flying")
      self:set_layer_independent_collisions(true)
   sprite = self:create_sprite("enemies/skulltula")   
end

function enemy:on_restarted()
   if not fallen then
          sprite:set_animation("shadow")
      self:check_hero()
   else
      self:turning()   
     end     
end

function enemy:check_hero()
     local hero = self:get_map():get_entity("hero")
     local x, y, z = self:get_position()
     local hero_x, hero_y, hero_z = hero:get_position()
     
   if self:get_distance(hero) <= 32 then
      local direction = self:get_direction4_to(hero)
        sprite:set_direction(direction)
      if direction == 0 then
         angle = 2*math.pi/2
         angle_inverse = 0
      end
      if direction == 1 then
         angle = 3*math.pi/2
         angle_inverse = math.pi/2
      end
      if direction == 2 then
         angle = 0
         angle_inverse = 2*math.pi/2
      end
      if direction == 3 then
         angle = math.pi/2
         angle_inverse = 3*math.pi/2
      end
      self:falling()   
   end

     sol.timer.stop_all(self)
     sol.timer.start(self, 500, function() self:check_hero() end)
end

function enemy:falling()
   sol.audio.play_sound("jump")   
   sprite:set_animation("walking")
   self:set_position(shadow_x, shadow_y - 120, 2)
   self:set_can_attack(true)
   m:set_speed(320)
   m:set_angle(3*math.pi/2)
   m:set_max_distance(120)
   m:start(self)   
end

function enemy:on_movement_finished()
   if fallen == false then
      fallen = true
      self:set_position(shadow_x, shadow_y, shadow_z)
      self:restart()
   end   
end

function enemy:turn_anim()
   if vulnerable == false then
      sprite:set_animation("vulnerable")
      vulnerable = true
   else
      sprite:set_animation("walking")
      vulnerable = false
   end
end

function enemy:turning()
   sol.timer.start(self, 2000, function()          -- Shaking
      if vulnerable == false then   
         sprite:set_animation("shaking") 
      else
         sprite:set_animation("vulnerable_shaking")
      end
      sol.timer.start(self, 2000, function()       -- Turning
         self:turn_anim()
           sol.timer.start(self, 2000, function() self:turning() end)
      end)
   end)
end

function enemy:on_custom_attack_received(attack, sprite)
   if fallen == true then
      m:set_angle(angle)
      m:set_speed(128)
            m:start(self)
      sol.timer.start(self, 200, function()
         m:set_angle(angle_inverse)
         sol.timer.start(self, 400, function()
            m:set_angle(angle)
            sol.timer.start(self, 200, function() m:stop() end)
         end)
      end)
      if vulnerable == false then
         sol.audio.play_sound("sword_tapping")   
      else
         sprite:set_animation("hurt")
         sol.audio.play_sound("enemy_hurt")
         self:remove_life(1)   
         sol.timer.start(self, 200, function() self:turn_anim() end)
      end
   end
end

6
Development / Random...
« on: September 25, 2015, 08:56:23 am »
Hello, I don't know if anyone have already seen this, but I just saw yesterday that when I generate random numbers in a dialog, for each game I played, it was always the same numbers and in the same order...

7
Development / custom_entity script and Solarus v1.4.3
« on: August 19, 2015, 01:13:25 pm »
Hello, I didn't work on my project since the last update, but today, when I wanted to test some minor adjustment, I see that some code in my custom_entity script won't work. The custom_entity is an ally and here is the problem: usually when he walks into a hole, he falls like the hero. But today instead of normally fall into the hole, he is blocked ! I tried to add custom_entity:set_can_traverse_ground("hole", true) but it really makes the character traverse the hole!
What's the matter, It worked fine before the update. I see that because I wanted to display water when he walks throught shallow water, but like the hole nothing happens if the set can traverse ground is true...

There is the part of the code :
Code: ( lua) [Select]
function P2:on_ground_below_changed(ground_below)
if ground_below == "hole" then -- Rajouter if not jumping plus tard
game:set_value("P2_state", "falling")
P2_Move:stop()
if P2:get_sprite():get_animation() ~= "falling" then
P1:freeze()
P2:get_sprite():set_animation("falling")
sol.audio.play_sound("hero_falls")
end
local P2_sprite = P2:get_sprite()
function P2_sprite:on_animation_finished(animation)
if animation == "falling" then
game:set_value("P2_state", "free")
P1:unfreeze()
end
end
end
end


8
Development / Stream and block
« on: July 24, 2015, 07:41:09 am »
Hello, I saw on the Lua API doc that stream could by followed by bombs, but I want to know if it was possible with other entities, like destructible, pickable or block.
My purpose is to push a block on a stream and the block move toward it. Maybe can I use a cutom entity, but it would be useful to have to possibility to make it directly with the engine.

9
Development / custom_entity and sprite event
« on: July 16, 2015, 08:45:01 am »
Hello, like many users here, I made a custom entity that follow the hero (it's the main gameplay of my project since many years I'm working on!) but I have some little troubles with it. It moves, throught stairs, hole or whatever, and I can change the sprite animation, but when I want to came back to normal, after the animation finished, I have an error.

Here is an example : P1 is the hero and P2 the follower

Code: [Select]
function P2:on_ground_below_changed(ground_below)
if ground_below == "hole" then
game:set_value("P2_state", "falling")
P2_Move:stop()
if P2:get_sprite():get_animation() ~= "falling" then
P2:get_sprite():set_animation("falling")
P1:freeze()
end
function P2:get_sprite():on_animation_finished("falling")
game:set_value("P2_state", "free")
P1:unfreeze()
end
end
end

Now there's the error :
Error: Failed to load script 'entities/P2': [string "entities/P2.lua"]:220: unexpected symbol near ':'
Error: In entities/P2: attempt to call a string value

The problem seems to be : function P2:get_sprite():on_animation_finished("falling")   

I have another problem with the jump (it works once and doesn't work after) but we'll see that later !
Thanks for the help!

10
Bugs & Feature requests / Bug:custom_entity:set_can_traverse_ground
« on: July 15, 2015, 09:51:37 am »
Hello, I seem I found a bug with the custom entity. I didn't understand why my custom entity would not walk on ladder and, after many test, I know why. My line was custom_entity:set_can_traverse_ground("ladder", true) but it didn't work. Finally, I had to put custom_entity:set_can_traverse_ground("ladder", false) and now it works. Maybe there is other bugs with this method, (i.e with other entities, why not) but I didn't try.

11
Development / block between two floor
« on: June 12, 2015, 02:32:55 pm »
Hello Solarus users,

I was wondering if it was a simple way to make a block fall into a below floor, i.e. the hero push a block in a hole and go to the B1 floor to activate a switch with this block (which just fall from upstairs). Noting that the two floors are on separate maps !

Thanks

12
Bugs & Feature requests / Surface bug or my bad ?
« on: March 24, 2015, 09:02:41 am »
Hello ! I'm new in the forum, but I know Solarus for a long time. I didn't want to doing some stuff with it before the quest editor was fully operationnal in my opinion, but with the 1.3 version in soon the 1.4, it seems to be the good moment to start it.
Well, I just start two or three weeks ago and for the moment I'm just trying to do some scripting to understand the engine. First of all, I made a night and day cycle and it seems to work. After that, I wanted to do a weather effect with clouds, rain and more, and here is the problem ! I saw in this forum how to show an overlay, but not to make an animation with it. So I coded a script in a map (what I think to be good) but I have an error message and the engine crash after a few moment (2 or 3 minutes or more). I don't know why but the engine crash and I would like to know why !!
Here is the first dialog box message :

Failed to convert software

and the second :

This application has requested the Runtime it in an unusual way. Please contact the application's support team for more information.

I saw that this problem appears only when the surface is animated or moved but not always. Did I do something wrong ?
Here is a shorter and simplified version of what I do (I test it many times and it bug only two times, but it bugged !) :

local map = ...
local Meteo_Pluie_Anim = 1
local Meteo_Etat = "pluie"
local Calque_Pluie = sol.surface.create()

local function Anim()
   Meteo_Pluie_Anim = Meteo_Pluie_Anim + 1
   if Meteo_Pluie_Anim == 4 then Meteo_Pluie_Anim = 1 end   
   Calque_Pluie = sol.surface.create("meteo/"..Meteo_Etat.."_"..Meteo_Pluie_Anim..".png")
end

sol.timer.start(map, 100, function() Anim() return true end)

function map:on_draw(dst_surface)   
   Calque_Pluie:draw(dst_surface)
end

I have other questions, but I will post them in the devlopment section. And sorry for my english...

Pages: [1]