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

Topics - Starlock

#21
Development / Stop hero animation outside collision
October 08, 2016, 10:16:35 PM
I'm trying to make a collision test on a custom entity  that changes the hero animation while overlapping. Setting the animation works, but the animation persists outside of the entity until the hero stops moving. What do I do to fix this?

This is the chunk:

Code ( lua) Select
  entity:add_collision_test("overlapping", function()
    if entity:overlaps(hero) then
      hero:set_animation("spring")
    end
    return true
  end)
#22
Development / Trouble with dialog function syntax
August 24, 2016, 07:15:38 PM
Hey, I started working on the dialog box for the level up system, and it is supposed to show a dialog that allows you to pick a stat to boost, but if a stat is maxed out, it will show a dialog allowing to boost the other two, and if two are maxed out, it should boost the last stat. I've tried multiple different things, and it continues to just show the same dialog, so I decided it might be easier to ask on the forums.

This is the chunk of code:

Code ( lua) Select
-- Level up
  if self.current_xp_displayed >= xp_to_levelup then
self.game:set_value("current_level", current_level + 1)
difference = current_xp - xp_to_levelup
self.game:set_value("current_xp", difference)
current_xp = self.game:get_value("current_xp")
self.current_xp_displayed = 0
self.current_xp_displayed_length = string.len(self.current_xp_displayed)
    self.game:start_dialog("levelup", current_level + 1, function()
      if self.game:get_max_life(60) then
        self.game:start_dialog("leveluphealthmax", function(answer)
          if answer == 2 then
            self.game:start_dialog("levelupmana", self.game:get_max_magic() + 10)
            self.game:set_max_magic(self.game:get_max_magic() + 10)
            self.game:set_magic(self.game:get_max_magic())
          elseif answer == 3 then
            self.game:start_dialog("levelupstamina", self.game:get_max_stamina() + 10)
            self.game:set_max_stamina(self.game:get_max_stamina() + 10)
            self.game:set_stamina(self.game:get_max_stamina())
        end
      end)
      elseif self.game:get_max_magic(200) then
        self.game:start_dialog("levelupmanamax", function(answer)
          if answer == 2 then
            self.game:start_dialog("leveluphealth", self.game:get_max_life(), self.game:get_max_life())
            self.game:add_max_life(5)
            self.game:set_life(game:get_max_life())
          elseif answer == 3 then
            self.game:start_dialog("levelupstamina", self.game:get_max_stamina(), self.game:get_max_stamina())
            self.game:add_max_stamina(10)
            self.game:set_stamina(game:get_max_stamina())
         end
       end)
      elseif self.game:get_max_stamina(200) then
        self.game:start_dialog("levelupstaminamax", function(answer)
          if answer == 2 then
            self.game:start_dialog("leveluphealth", self.game:get_max_life(), self.game:get_max_life())
            self.game:add_max_life(5)
            self.game:set_life(game:get_max_life())
          elseif answer == 3 then
            self.game:start_dialog("levelupmagic", self.game:get_max_magic(), self.game:get_max_magic())
            self.game:add_max_magic(10)
            self.game:set_magic(game:get_max_magic())
      elseif self.game:get_max_life(60) and
             self.game:get_max_magic(200) then
               self.game:start_dialog("levelupstamina", self.game:get_max_stamina(), self.game:get_max_stamina())
               self.game:add_max_stamina(10)
               self.game:set_stamina(game:get_max_stamina())
      elseif self.game:get_max_life(60) and
             self.game:get_max_stamina(200) then
               self.game:start_dialog("levelupmagic", self.game:get_max_magic(), self.game:get_max_magic())
               self.game:add_max_magic(10)
               self.game:set_magic(game:get_max_magic())
      elseif self.game:get_max_magic(200) and
             self.game:get_max_stamina(200) then
               self.game:start_dialog("leveluphealth", self.game:get_max_life(), self.game:get_max_life())
               self.game:add_max_life(5)
               self.game:set_life(game:get_max_life())
            end
         end)
      else self.game:start_dialog("levelupall", function(answer)
          if answer == 2 then
            self.game:start_dialog("leveluphealth", self.game:get_max_life(), self.game:get_max_life())
            self.game:add_max_life(5)
            self.game:set_life(game:get_max_life())
          elseif answer == 3 then
            self.game:start_dialog("levelupmagic", self.game:get_max_magic(), self.game:get_max_magic())
            self.game:add_max_magic(10)
            self.game:set_magic(game:get_max_magic())
          elseif answer == 4 then
            self.game:start_dialog("levelupstamina", self.game:get_max_stamina(), self.game:get_max_stamina())
            self.game:add_max_stamina(10)
            self.game:set_stamina(game:get_max_stamina())
         end
       end)
end
end)
end
end
#23
Development / Initial game values in zsdx
May 03, 2016, 04:16:11 AM
Hey, I've just started to try and implement @froggy77 's level and xp system. However, his system is based around zelda roth and my game is based around zsdx code.

http://forum.solarus-games.org/index.php/topic,520.0.html

I believe the problem is declaring new savegame values, however nothing I've tried seems to work. I tried changing everything to roth, but that turned out to be a lot more trouble than I expected. I tried putting the values at the end of the savegames code and that didn't seem to do anything. Where should initial values be saved in zsdx?
#24
Development / 2 Item Related Questions
April 05, 2016, 06:42:24 PM
Hey, I'm continuing to work on items and just had 2 questions regarding what is possible.

1) For a gust type spell, is it possible for the amount of pushback to be changed/doubled, or is the pushback static

2) Can there be an item like the magic ring from ALTTP that can half the amount of magic needed to cast spells?
#25
Development / Teletransporter item
March 19, 2016, 03:54:14 AM
Hey I'm currently working on the map for one of the final dungeons in my game. My plan is to create a portal gun type item that shoots entities that can create teletransporters when they collide with a special portal wall. Before I design the entire dungeon around this item I was wondering if such a thing is even doable  :P
#26
Development / Entity not working, no error
March 10, 2016, 03:15:10 AM
I'm trying to make a vine entity that can only be destroyed by using fire. There's no error, but the entity doesn't get destroyed when fire is used.
Code ( lua) Select
local entity = ...
local map = entity:get_map()

function entity:on_created()
  self:set_size(16, 16)
  self:set_traversable_by("hero", false)
  self:create_sprite("entities/bush_vine")

    if entity:get_type() == "fire" then
      sol.audio.play_sound("jump")
      self:remove()
   end
end

function entity:on_removed()
  self:get_sprite():set_animation("destroy")
end
#27
Development / Scrolling dialog selections?
February 09, 2016, 06:18:52 PM
Hey, I'm planning to implement a crafting system that involves talking to NPCs and they will show a selection of craftables and the regents required to make them. I figured it would be easier to make this as a dialog that displays craftables and checks if you have the regents when you select it. Is it possible to have more than 4 selection in a dialog that you can scroll through or would I have to create a menu for a crafting system to be possible
#28
General discussion / NPCs
February 05, 2016, 05:51:10 PM
Hello everyone, I've been steadily working on my project and am currently making graphics for NPCs. I figured since everyone in the forums have been so helpful that if you want, I can draw in an avatar or whatever you want as an NPC in the game. If anyone is interested, write here or shoot me a PM about a general idea of what you want the NPC to look like and what you want the NPC to say/do.  ;)
#29
Development / problem with doors
January 14, 2016, 04:01:49 PM
I've been working on dungeon design,and have been using the door_manager code. I'm having a couple probelms, but with that code, one door will open when one auto_enemy is killed and the rest will open after the others are killed.

And in the code of one map:

Code ( lua) Select
local map = ...
local game = map:get_game()

local door_manager = require("maps/lib/door_manager")
door_manager:manage_map(map)

function map:on_started()
  function map:on_started()
  if not game:get_value("dun1keyy") then chest_key:set_enabled(false) end
end

  map:set_doors_open("auto_door_f", true)


  self.night_overlay = sol.surface.create()  -- Create an empty surface of the size of the screen.
  self.night_overlay:set_opacity(152)        -- Make it semi-transparent (0: transparent, 255: opaque).
  self.night_overlay:fill_color({195, 24, 24})  -- Fill it with dark blue to obtain a night effect.
end
function map:on_draw(destination_surface)
  self.night_overlay:draw(destination_surface)
end

function bridge_switch:on_activated()

  sol.audio.play_sound("secret")
  map:set_entities_enabled("bridge_tile", true)
end

function close_auto_door_f_sensor_1:on_activated()

  if auto_door_f:is_open()
      and map:has_entities("auto_enemy_auto_door_f") then
    map:close_doors("auto_door_f")
  end
end

for enemies in map:get_entities("auto_enemy_auto_door_f") do
  enemies.on_dead = function()
    if not map:has_entities("auto_enemy_auto_door_f") and not game:get_value("dun1keyy") then
      chest_key:set_enabled(true)
      sol.audio.play_sound("chest_appears")
    end
  end
end


the auto_door_f wont reopen after the enemies are killed and the chest_key doesn't start out false
#30
Development / Epona
January 09, 2016, 03:57:45 AM
Would there be a  way to code a horse like Epona that the hero would be able to ride? And would it be considered a custom entity or some sort of NPC
#31
Development / Possible to create a level up system?
January 05, 2016, 05:18:37 AM
For my game, I want to create a leveling system that is a mix of ideas between Zelda 2 and Skyrim. Every time you reach a new level you can choose to raise either health, magic, or stamina with a max level of 10 for each, making a maximum total level of 30.

First off, is such a system possible with the engine. Second, if it is how would I get started creating it?
#32
Development / Different crystals for every dungeon
January 03, 2016, 05:38:43 AM
Hey, I was working on making crystal/crystal block sprites for dungeons. Is there a way for every dungeon to have a different sprite for crystals rather than all of them using the same ones?
#33
Development / Bomb Soldiers?
January 02, 2016, 05:53:37 PM
I noticed while looking through the zsdx and roth repositories that there were no bomb or bow soldiers. Is it possible to make an enemy that throws bombs?
#34
Development / How do you code turret type enemies?
December 23, 2015, 04:51:49 AM
I'm not too sure about how to go about making turrets that remain stationary but continuously fire(I supposed using a timer)

One turret would fire in one direction but does not change direction to follow the hero, one fires in four main directions(N,S,E,W) and another that fires in eight direction (N,NW,NE,W,E,SW,SE,S)
#35
Development / Lens of Truth?
November 17, 2015, 05:50:25 PM
Hey, I would like to try to create an item similar to the Lens of Truth from OoT, and I would just like to make sure something like that is possible. My initial thought process is to make the item enable specific dynamic tiles while it is being used and then re-disable them when the item is no longer in use.
#36
Development / Question about Switches
October 30, 2015, 07:31:51 PM
Hey I'm having a bit of trouble with arrow switches. 1)When I shoot an arrow, the arrow goes straight through the switch rather than activating it. 2) Is it possible to require more than one switch in order to activate a dynamic tile like a bridge?
#37
Development / Using timers in custom entitites
October 11, 2015, 05:22:37 AM
Hey so I was trying to make a custom entity that restores health over time. The code basically works fine but the timer covers the entire map rather than just when traversing the entity. Is there a way to make it so the hero has to be on the entity for the timer to activate?

Also, how do i change the hero animation on the entity because set_animation doesnt seem to be working...
#38
Development / Moving data to new computer
October 02, 2015, 09:53:41 PM
I just got a new laptop and I tried to move the data to it, but now the screen is black and I am receiving an error that did not exist on my original computer.

"Error: In timer callback: [string "scripts/menus/title.lua"]:27: attempt to index local 'zs_presents_img' (a nil value)"

I had this error before, but it was fixed so I'm not sure why it is suddenly reappearing when I have double checked that the image required exists under languages
#39
Development / Problems with dialog and HUD
September 05, 2015, 02:44:21 AM
In game manager I keep getting an error towards the hud: "Error: In on_map_changed: [string "scripts/game_manager.lua"]:75: attempt to index upvalue 'hud' (a nil value)"

and the dialog box creates the error:  Error: In on_started: "[string "scripts/dialog_box.lua"]:59: attempt to call field 'get_dialog_font' (a nil value)"

Clearly the problem is about the nil values but when I try defining either of them the error remains so I'm not quite understanding what to do....

Game_manager.lua
Code ( lua) Select
-- Script that creates a game ready to be played.

-- Usage:
-- local game_manager = require("scripts/game_manager")
-- local game = game_manager:create("savegame_file_name")
-- game:start()

local game_manager = {}

-- Creates a game ready to be played.
function game_manager:create(file)

  -- Create the game (but do not start it).
  local exists = sol.game.exists(file)
  local game = sol.game.load(file)
  if not exists then
    -- This is a new savegame file.
    game:set_starting_location("house")
    game:set_max_money(99)
    game:set_max_life(12)
    game:set_life(game:get_max_life())
    game:get_item("rupee_bag"):set_variant(1)
  end
 
  sol.main.load_file("scripts/dialog_box.lua")(game)
  sol.main.load_file("scripts/game_over.lua")(game)
  local hud_manager = require("scripts/hud/hud")
  local hud
  local pause_manager = require("scripts/menus/pause")
  local pause_menu

  -- Function called when the player runs this game.
  function game:on_started()

    -- Prepare the dialog box menu and the HUD.
    game:initialize_dialog_box()
    hud = hud_manager:create(game)
    pause_menu = pause_manager:create(game)
  end

  -- Function called when the game stops.
  function game:on_finished()

    -- Clean the dialog box and the HUD.
    game:quit_dialog_box()
    hud:quit()
    hud = nil
    pause_menu = nil
  end

  -- Function called when the game is paused.
  function game:on_paused()

    -- Tell the HUD we are paused.
    hud:on_paused()

    -- Start the pause menu.
    sol.menu.start(game, pause_menu)
  end

  -- Function called when the game is paused.
  function game:on_unpaused()

    -- Tell the HUD we are no longer paused.
    hud:on_unpaused()

    -- Stop the pause menu.
    sol.menu.stop(pause_menu)
  end

  -- Function called when the player goes to another map.
  game.on_map_changed = function(game, map)

    -- Notify the HUD (some HUD elements need to know that).
    hud:on_map_changed(map)
  end

  local custom_command_effects = {}
  -- Returns the current customized effect of the action or attack command.
  -- nil means that the built-in effect.
  function game:get_custom_command_effect(command)
    return custom_command_effects[command]
  end

  -- Overrides the effect of the action or attack command.
  -- Set the effect to nil to restore the built-in effect.
  function game:set_custom_command_effect(command, effect)
    custom_command_effects[command] = effect
  end

  -- Returns whether the HUD is currently shown.
  function game:is_hud_enabled()
    return hud:is_enabled()
  end

  -- Enables or disables the HUD.
  function game:set_hud_enabled(enable)
    return hud:set_enabled(enable)
  end

  local rupee_icon = sol.surface.create("hud/rupee_icon.png")
  local rupee_text = sol.text_surface.create()
  rupee_text:set_font("8_bit")

  function game:on_draw(dst_surface)

    rupee_icon:draw_region(0, 0, 12, 12, dst_surface, 10, 220)
    rupee_text:set_text(game:get_money())
    rupee_text:draw(dst_surface, 25, 225)
  end
 

  return game
end

return game_manager



And this is line 59 of the dialogbox script
Code ( lua) Select
local font, font_size = sol.language.get_dialog_font()
#40
Development / Diablo like health/magic?
September 02, 2015, 03:31:47 AM
Is it possible for the hearts and magic bar used in ZSDX to be instead shown as red and blue orbs like in Diablo? I tried to simply use the code and custom graphics but I'm not exactly sure how to compile the graphics to create a HUD.