Menu

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.

Show posts Menu

Messages - wizard_wizzle (aka ZeldaHistorian)

#181
Development / Re: Custom code debugging
August 25, 2015, 01:54:26 PM
Thanks Christopho, I wasn't sure if that bug was fixed yet.

Diarandor, any chance you could help me modify my code with timers to make it work in the mean time as well?
#182
Development / Custom code debugging
August 25, 2015, 03:52:37 AM
Alright - I can't tell if I coded something wrong here, or if there's an error in the engine. I have a cane that generates ice blocks. These blocks can either fill empty pits (another custom entity, which works correctly), freeze water so the hero can walk on it, or enable lava to be walked on. Pushing the block onto water or lava isn't working at all, and the collision detection when creating a new block on top of lava or water is hit or miss. The lava and deep water are both set up as dynamic tiles, and neither set_traversable_by() or set_can_traverse() seem to work for the block. Below is my code, any help would be appreciated :)


local entity = ...
local map = entity:get_map()
local pushing = false
local block_on_switch = false

-- Ice block: special block made of ice that can fill an
-- ice pit, turn lava solid, and freeze water.

function entity:on_created()
  self:set_size(16, 16)
  self:snap_to_grid()
  self:set_modified_ground("ice")
  self:set_traversable_by("hero", false)
  self:set_traversable_by("dynamic_tile", true)
  self:set_traversable_by("custom_entity", true) --to allow pushing block into pit
  self:set_can_traverse("dynamic_tile", true)
  self:create_sprite("entities/ice_block")

  self:add_collision_test("facing", function(self, other)
    if other:get_type() == "hero" and not pushing then
      pushing = true
      local m = sol.movement.create("path")
      m:set_ignore_obstacles(false)
      m:set_snap_to_grid(true)

      if other:get_direction() == 0 then m:set_path({0,0})
      elseif other:get_direction() == 1 then m:set_path({2,2})
      elseif other:get_direction() == 2 then m:set_path({4,4})
      elseif other:get_direction() == 3 then m:set_path({6,6}) end
      m:start(self, function()
pushing = false
      end)
    end
  end)

  self:add_collision_test("overlapping", function(self, other)
    local lava_crust, ice_patch
    if other:get_type() == "dynamic_tile" then
      local tsx, tsy = other:get_size()
      local tpx, tpy, tpl = other:get_position()
      local sx, sy, sl = self:get_position()
      self:clear_collision_tests()
      self:remove()
      if map:get_ground(sx,sy,sl) == "lava" then
        if (sx > tpx-32) and (sx < tpx+tsx+32) and (sy > tpy-32) and (sy < tpy+tsy+32) then
          lava_crust = map:create_custom_entity({ x = sx, y = sy, layer = sl, width = 32, height = 32, direction = 0 })
          lava_crust:snap_to_grid()
          sol.audio.play_sound("freeze")
          lava_crust:create_sprite("entities/lava")
          lava_crust:set_modified_ground("traversable")
          lava_crust:set_traversable_by("hero", true)
          lava_crust:set_traversable_by("enemy", true)
  sol.timer.start(map, 15000, function()
    lava_crust:remove()
  end)
        end
      elseif map:get_ground(sx,sy,sl) == "deep_water" then
        if (sx > tpx-16) and (sx < tpx+tsx+16) and (sy > tpy-16) and (sy < tpy+tsy+16) then
          ice_patch = map:create_custom_entity({ x = sx, y = sy, layer = sl, width = 32, height = 32, direction = 0 })
          sol.audio.play_sound("freeze")
          ice_patch:create_sprite("entities/ice")
          ice_patch:set_modified_ground("ice")
          ice_patch:set_traversable_by("hero", true)
          ice_patch:set_traversable_by("enemy", true)
  sol.timer.start(map, 15000, function()
    ice_patch:remove()
  end)
        end
      end
    elseif other:get_type() == "switch" then
      block_on_switch = true
      other:set_activated(true)
      if other:on_activated() ~= nil and not other.active then
        other:on_activated()
        other.active = true
      end
      sol.timer.start(map, 1000, function()
        if block_on_switch then
          return true
        else
          block_on_switch = false
          other:set_activated(false)
          if other:on_inactivated() ~= nil and other.active then
            other:on_inactivated()
            other.active = false
          end
        end
      end)
    elseif other:get_type() == "hole" then
      sol.audio.play_sound("hero_falls")
      self:remove()
    elseif other:get_type() == "fire" then
      sol.audio.play_sound("ice_melt")
      self:remove()
    elseif other:get_type() == "explosion" then
      sol.audio.play_sound("ice_melt")
      self:remove()
    else
      block_on_switch = false
    end
  end)
end

function entity:on_removed()
  self:get_sprite():set_animation("destroy")
end
#183
Each is a "special" type - one being deep water and one being lava, so conditionally traversable? :)
#184
I may be able to confirm this. I have a script that creates a custom block (custom entity) that the hero can push. Before the last update, he was able to push the block onto dynamic tiles and holes and it behaved as expected - dynamic tiles were traversable and holes were collision detected correctly (I have a collision test that removed the block). Now the entity will not traverse either even if set_can_traverse("dynamic_tile") is set.

I'm also not sure that the collision tests are detecting coordinates correctly, or probably I need to do more error testing of my script. When the hero pushes or creates a block on top of lava or water, it will freeze the ground below. The only collision test I can get to do anything is "overlapping", and even then if the block is placed on the edge of the dynamic tiles (lava or deep water), it won't freeze as expected. It works if placed more central to the tile.
#185
Development / Re: Thought experiment: Beamos
August 14, 2015, 05:51:49 AM
Finally got a chance to implement and test the beamos, and the script is great!!! Thanks Diarandor!
#186
This looks like a really cool idea! And it appears you've gotten a lot of the difficult custom scripting done, so great work! I look forward to trying this one out.
#187
Development / Thought experiment: Beamos
July 29, 2015, 03:58:13 AM
Hi all!

I'd really like to include beamos in my game, and I think other people might too - but it's a little too high level to wrap my head around. So, I thought I'd present the idea to the community and see what we can come up with!

The beamos statue is easy, you'd want a sprite with 8 directions so it can follow the hero, then just check and see when the hero is too close and start firing a beam. The beam itself is where it gets tricky! My thought is that the beam would an enemy breed of its own which is generated by the beamos statue (probably in a continuous stream). What I'm thinking of is an 8x8 sprite that can be created over and over again so that the beam can go in any direction. They move toward the hero in a line (somehow) and terminate being generated after a certain time. I'm not entirely sure how to implement this though...

Maybe I'm over (or under) thinking this and there's a better way? Let's brainstorm! :)
#188
Based on just those two lines you posted, you're creating your enemy variable after you're referencing it, so that  could be your problem. Hard to tell without more of the code though.

local enemy = entity:get_map():get_entity("enemy")
local enemy_x, enemy_y, enemy_layer = enemy:get_position()
#189
Development / Re: New Enemy Features Code
July 29, 2015, 12:03:21 AM
I don't recall providing any projectile code - is it from my github? If so, it probably came from christopho in one way or another, lol. Glad it was helpful though! I look forward to trying out this code!
#190
Your projects / Re: Zelda: Book of Mudora
July 18, 2015, 05:56:10 AM
https://www.dropbox.com/s/xxthc8fqupuxtd5/zbom-0.45.zip?dl=0

New version fixes all of the above issues, except for the kids causing you to be stuck.

VERSION 0.45 released 16-JUL-15
  - Added dungeon exploration mechanic and advanced compass (with secret chime) [still in progress]
  - Display clouds when in North Hyrule or Subrosia without upgraded map, added map for Subrosia
  - Updated dungeon maps for Sewers and Grove to correctly show doors and rooms
  - Added content to second floor of Hyrule Castle
  - Fixed night overlay not displaying correctly and updated other overlay code
  - Added capability to have color text dialogs and starting colorizing existing dialogs [still in progress]
  - Added enemies to North Hyrule field in order to discourage early exploration
#191
Your projects / Re: Zelda: Book of Mudora
July 17, 2015, 03:04:20 AM
Thanks for playing Christopho! It's been fun to watch and it's been really helpful to fix some stuff :)

There is one more full and complete dungeon (Snowpeak Caverns) after the one you finished. Then there's another dungeon that's technically fully playable, but may have some more content added (Wind Tower). The final dungeon is not playable yet (Interloper Sanctum), so you can't actually finish the game.

There is also side quests still to do - multiple optional items and upgrades, a full trading sequence, heart pieces, etc.
#192
Your projects / Re: Zelda: Book of Mudora
July 12, 2015, 09:46:30 PM
Race sound issue is fixed - thanks for the report!

I agree with you about the kids, but the engine doesn't currently allow me to set NPCs as traversable. I have logged an issue on the Solarus github.
#193
Development / Re: About color text dialogs
July 12, 2015, 09:11:08 PM
Works great now - thanks!

I think the syntax is just fine, but I did go through and simplify things for my game. I wanted to be able to use $r, $g, $b, etc. for the colors just like $0 and $1 are used. If you'd like to check out my edited version, I just committed the change to zbom's github.

I am so excited to start adding colors to my dialogs! Thanks again!
#194
Development / Re: About color text dialogs
July 11, 2015, 12:39:10 AM
Wow, this is really cool! I tried to play around with colored dialogs and didn't get anywhere with it - great work!  8)

Is anyone else getting this repeating error? In on_draw [string "menus/dialog_box.lua"]:564: attempt to index a nil value
The only thing I changed was this section:
  -- Initialize dialog box data.
dialog_box.line_surfaces.default = {}; dialog_box.current_line_surface = dialog_box.line_surfaces.default
  local font, font_size = sol.language.get_dialog_font()
  for i = 1, nb_visible_lines do
    dialog_box.lines[i] = ""
    dialog_box.line_surfaces.default[i] = sol.text_surface.create{
      horizontal_alignment = "left",
      vertical_alignment = "top",
      rendering_mode = "antialiasing",
      font = font,
      font_size = font_size,
    }
  end

to take into account the global dialog font. Did I mess something up? I tried it with the exact dialog that you posted, but I think I'm still a little confused by the syntax.
#195
Bugs & Feature requests / Segmentation fault?
July 06, 2015, 04:41:33 AM
I have a new bug that's popped up in my game, and I'm not sure if it's an engine problem or something else. I have the following code in one of my dungeons, and when it gets to this point in the game, it crashes with a Segmentation Fault:

for enemy in map:get_entities("keese") do
  enemy.on_dead = function()
    if not map:has_entities("keese_rupees") and not game:get_value("b1119") then
      chest_rupees:set_enabled(true)
      bridge_rupees:set_enabled(true)
      sol.audio.play_sound("chest_appears")
    end
  end
end


I haven't changed anything with this code recently, and the fault would've just started appearing in Solarus 1.4.2. Any ideas?