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.


Messages - ponderitus

Pages: 1 2 [3] 4 5
31
Development / Re: help with 1.6
« on: February 07, 2019, 12:54:38 am »
Ooh awesome thanks for the reply, I'll be looking at that 1st thing in the morning. Cant wait to get back into it all, dont know why i stopped tbh. Thanks for bringing out 1.6 i saw your vid on youtube and was instantly back

Got home, works perfectly. Thanks once again Lord Christopho

32
Development / Re: help with 1.6
« on: February 06, 2019, 05:09:42 pm »
Hey Max, glad you came through, I've been keeping my eye on Oceans Heart. It's looking better and better each time i see it, I loved the enemy that runs away from you that you made, i see your graphics are included in the demo art as well, fair play.

Here's my Hud script, im pretty sure i ripped it from one of the solarus made games and then adapted it to work for me

Code: [Select]
-- Script that creates a head-up display for a game.

-- Usage:
-- require("scripts/hud/hud")

require("scripts/multi_events")
local hud_config = require("scripts/hud/hud_config")

-- Creates and runs a HUD for the specified game.
local function initialize_hud_features(game)

  if game.set_hud_enabled ~= nil then
    -- Already done.
    game:set_hud_enabled(true)
    return
  end

  -- Set up the HUD.
  local hud = {
    enabled = false,
    elements = {},
    showing_dialog = false,
    top_left_opacity = 255,
    custom_command_effects = {},
  }

  local item_icons = {}
  local action_icon
  local attack_icon

  function game:get_hud()
    return hud
  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

  function game:get_custom_command_effect(command)

    return hud.custom_command_effects[command]
  end

  -- Make the action (or attack) icon of the HUD show something else than the
  -- built-in effect or the action (or attack) command.
  -- You are responsible to override the command if you don't want the built-in
  -- effect to be performed.
  -- Set the effect to nil to show the built-in effect again.
  function game:set_custom_command_effect(command, effect)

    hud.custom_command_effects[command] = effect
  end

  -- Destroys the HUD.
  function hud:quit()

    if hud:is_enabled() then
      -- Stop all HUD elements.
      hud:set_enabled(false)
    end
  end

  -- Call this function to notify the HUD that the current map has changed.
  local function hud_on_map_changed(game, map)

    if hud:is_enabled() then
      for _, menu in ipairs(hud.elements) do
        if menu.on_map_changed ~= nil then
          menu:on_map_changed(map)
        end
      end
    end
  end

  -- Call this function to notify the HUD that the game was just paused.
  local function hud_on_paused(game)

    if hud:is_enabled() then
      for _, menu in ipairs(hud.elements) do
        if menu.on_paused ~= nil then
          menu:on_paused()
        end
      end
    end
  end

  -- Call this function to notify the HUD that the game was just unpaused.
  local function hud_on_unpaused(game)

    if hud:is_enabled() then
      for _, menu in ipairs(hud.elements) do
        if menu.on_unpaused ~= nil then
          menu:on_unpaused()
        end
      end
    end
  end

  -- Called periodically to change the transparency or position of icons.
  local function check_hud()

    local map = game:get_map()
    if map ~= nil then
      -- If the hero is below the top-left icons, make them semi-transparent.
      local hero = map:get_entity("hero")
      local hero_x, hero_y = hero:get_position()
      local camera_x, camera_y = map:get_camera():get_position()
      local x = hero_x - camera_x
      local y = hero_y - camera_y
      local opacity = nil

      if hud.top_left_opacity == 255
        and not game:is_suspended()
        and x < 88
        and y < 80 then
        opacity = 96
      elseif hud.top_left_opacity == 96
        and (game:is_suspended()
        or x >= 88
        or y >= 80) then
        opacity = 255
      end

      if opacity ~= nil then
        hud.top_left_opacity = opacity
        for i, element_config in ipairs(hud_config) do
          if element_config.x >= 0 and element_config.x < 72 and
              element_config.y >= 0 and element_config.y < 64 then
            hud.elements[i]:get_surface():set_opacity(opacity)
          end
        end
      end

      -- During a dialog, move the action icon and the sword icon.
      if not hud.showing_dialog and
        game:is_dialog_enabled() then
        hud.showing_dialog = true
        action_icon:set_dst_position(0, 54)
        attack_icon:set_dst_position(0, 29)
      elseif hud.showing_dialog and
        not game:is_dialog_enabled() then
        hud.showing_dialog = false
        action_icon:set_dst_position(26, 51)
        attack_icon:set_dst_position(13, 29)
      end
    end

    return true  -- Repeat the timer.
  end

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

  -- Enables or disables the HUD.
  function hud:set_enabled(enabled)

    if enabled ~= hud.enabled then
      hud.enabled = enabled

      for _, menu in ipairs(hud.elements) do
        if enabled then
          -- Start each HUD element.
          sol.menu.start(game, menu)
        else
          -- Stop each HUD element.
          sol.menu.stop(menu)
        end
      end

      if enabled then
        sol.timer.start(hud, 50, check_hud)
      end
    end
  end

  -- Changes the opacity of an item icon.
  function hud:set_item_icon_opacity(item_index, opacity)
    item_icons[item_index].get_surface():set_opacity(opacity)
  end

  for _, element_config in ipairs(hud_config) do
    local element_builder = require(element_config.menu_script)
    local element = element_builder:new(game, element_config)
    if element.set_dst_position ~= nil then
      -- Compatibility with old HUD element scripts
      -- whose new() method don't take a config parameter.
      element:set_dst_position(element_config.x, element_config.y)
    end
    hud.elements[#hud.elements + 1] = element

    if element_config.menu_script == "scripts/hud/item_icon" then
      item_icons[element_config.slot] = element
    elseif element_config.menu_script == "scripts/hud/action_icon" then
      action_icon = element
    elseif element_config.menu_script == "scripts/hud/attack_icon" then
      attack_icon = element
    end
  end

  game:register_event("on_map_changed", hud_on_map_changed)
  game:register_event("on_paused", hud_on_paused)
  game:register_event("on_unpaused", hud_on_unpaused)

  -- Start the HUD.
  hud:set_enabled(true)
end

-- Set up the HUD features on any game that starts.
local game_meta = sol.main.get_metatable("game")
game_meta:register_event("on_started", initialize_hud_features)

return true

33
Development / help with 1.6
« on: February 06, 2019, 02:09:04 pm »
Hey, I've been away for the longest time but the 1.6 update piqued my interest again. anyway i cant seem to get rid of this error message since updating, can anyone point me in the right path?
Code: [Select]
Info: Simulation started
Error: bad argument #1 to sol.timer.start (game, item, map, entity, menu or sol.main expected, got table), will use a default context instead
stack traceback:
[C]: at 0x018a4540
[C]: in function 'start'
scripts/hud/hud.lua:179: in function 'set_enabled'
scripts/hud/hud.lua:213: in function 'callback'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function <scripts/multi_events.lua:40>
(Thread 0x9f301c0)
Info: Simulation finished

34
Your scripts / Re: Deku/Turret Type Enemy
« on: May 04, 2018, 02:31:22 am »
Hey, just thought I'd show you what I made with your code, I have made a wake_up animation for him which looks pretty cool but couldn't work out how to put a timer on the waking part so that it would show so I just left it out. seems to instantly go from asleep to awake...and if you adjust the timer in place already it goes mental for a moment and repeats. Still looks ok without it I think. Was going to make the nuts it shoots rebound and be able to kill him as well. I know the triple Octorok code has the ability to do that so I'll have a little look at that and see how it looks/works plus Agahnim also has that "ability" so there's at least 2 scripts for me to read through, hopefully I can figure it out.

https://www.youtube.com/watch?v=F-kEPrG9wKQ


Thanks or making this again. Really appreciate the effort...I'm sure someone else must be wanting this type of enemy as well. Since this video I've also added a wall on top of the enemy that removes when the enemy dies to stop being able to traverse whilst hurt and to stop being hurt (but not damaged) if you touch him. only works on the Y axis but meh, it's half the battle.

Just read you hope to have a demo next week, looking forward to that!

35
Your scripts / Re: Deku/Turret Type Enemy
« on: May 03, 2018, 04:14:42 am »
you know what, it works perfectly it was just me being an idiot as usual. That's awesome

36
Your scripts / Re: Deku/Turret Type Enemy
« on: May 02, 2018, 03:20:52 am »
This looks great man, only just seen it I've been stuck at work. I'll defo try to input this into my project. Still think you should make it into one of your mandrakes. maybe I'll try that.

Is the smoke effect coming from the chimney new? haven't noticed it before now, its nice.


Just tried to add it. I get this error

Error: In timer callback: [string "enemies/lib/turret.lua"]:281: attempt to call method 'go' (a nil value)

any idea how to fix that?

37
Development / Re: Setting Up A Basic Equipment Menu?
« on: April 25, 2018, 05:43:21 pm »
mad that I mentioned your project and you answered. It was actually your mandrake that made me think of making it. When i walked up to it thinking it was a normal bush then boom, enemy. was great. but then left me looking for a shooting mandrake...
I've been looking through your enemies, I love your Ogre..or the "melee attacker", I wanted to replicate that so it attacks multiple co-ordinates, like the Club Moblins do. I love your game, the art style is amazing, and the dialog box!
I get how i need to go about making the enemy with those functions, I've read a lot of enemies now lol. I just don't really know how to make the functions yet tho, the whole finding where the hero is. this would be my 1st enemy. It's starting to make more sense every time I read them.

But for your inventory try copying over files from other projects that have working menus..but make sure you have all the files they do, check you have all the language strings as well as dialogs to make them work, then...edit them, that's how I got mine working eventually. Or the reverse. get a Master folder and delete everything until you have a blank project with nothing but a blank map and a working menu. then add your files into that project and edit around that...Obviously don't delete the Items in the project until afterwards

38
Development / Re: Setting Up A Basic Equipment Menu?
« on: April 25, 2018, 11:47:42 am »
Yeah I added a enemy:on_custom_attack_received() to counter that, so they break when hit with swords. Haven't played with the shield yet just use it as a defense upgrade really. Seems like you know your stuff though. Let me know if you create anything interesting. I'm always after new enemies, mine suck! Been trying to create...essentially a Deku scrub for a few days, one that will be "sleeping" then will "wake up" when hero is within distance and shoot if he is in-line with x or y. Then if you are too close it will "sleep" again. so can't be killed with melee unless its frozen, so only by its own bullets being returned or arrows...I have no idea where to start.

The teleporting Octorok in Ocean's Heart is pretty cool, and his Ogre. If you haven't seen Ocean's Heart I'd go check it out. By Max.

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

39
Development / Re: Setting Up A Basic Equipment Menu?
« on: April 24, 2018, 01:45:28 am »
Code: [Select]
  game:get_item("pegasus_shoes"):set_variant(1)
  game:get_item("magic_bar"):set_variant(1)
  game:get_item("flippers"):set_variant(1)
 
those will let you test your boots, flippers and bar as they don't need to be assigned to use, or at least don't in mine. you can also do the same with the feather with a couple of tweaks

have a read of all the scripts you have, they may look like jibberish at first but after a while they will make sense I promise (could be months, I still don't understand most). But random bits will end up helping you. I couldn't get an Npc to change animation for the longest time, abandoned it, then read a random map from christopho and the team and saw I needed

Code: [Select]
  name:get_sprite():set_animation("")
  name:get_sprite():set_direction("")...ect
and the game changed....

Don't be afraid to ask a seemingly stupid question though, I've held back from asking lots of things and it's stunted my progression immensely. Someone could and would have given me the answer in seconds. Also, they might not be so stupid. Pretty sure I asked something like this when I started.

It's a shame the Youtube tutorials finished, they helped me sooooo much when I was starting, you don't even want to know what I was doing to get my bridges to work before that tutorial came out, I had hundreds of sensors. Hopefully they will come back one day, there's still a hell of a lot to cover. It would also be nice if there were more examples in 'Solarus 1.5 - Lua API reference'. That thing is confusing as hell sometimes.

What are you looking to make?

40
Development / Re: Setting Up A Basic Equipment Menu?
« on: April 24, 2018, 12:04:51 am »
I can't really help you with a complete Pause menu, inventory and what knot....it involves a lot of drawing and specific tile placement and other things, its a lot of work. Or at least is for me. If you are trying to copy one, first read through the script and find out if you've got all the files it's going to need to use first. it might require an image that's in the language folder that you don't have or another script.
If you just want to test an item you can so it by putting something such as :

Code: [Select]
  game:get_item("boomerang"):set_variant(1)
  game:set_item_assigned(1,game:get_item("boomerang"))

  game:get_item("hookshot"):set_variant(1)
  game:set_item_assigned(2,game:get_item("hookshot"))

in your initial_game.lua, or wherever your starting values are made

Hopefully this helps, I may not have understood what you meant. Welcome to the community

41
Your scripts / Re: [Big Layer] Solarus-online
« on: March 24, 2018, 08:18:11 pm »
Wow, I haven't been on here for a while so I've only just seen this...this is amazing! I haven't tested it or anything but it started my imagination going crazy with new types of quest that can be made....new modes and types of gameplay....

can the users interact with eachother? so that you could make something like...zelda bomberman for example? or a battle arena? Not what I intend to use it for, just wondered.

42
Development / Re: entity sounds
« on: May 13, 2017, 11:16:44 pm »
cheers man, that was my quick fix, just rename my files to be named the same and delete the old ones

43
Development / entity sounds
« on: May 13, 2017, 07:31:09 pm »
Does anyone know where the code is which selects the sounds entities make? I want to change the noise the chest makes when opening, I know how to change it for a chest on a map (as below), but i wanted to change all the sounds from the Alttp ones, like I also want to change the noise a block makes when pushed and so on.

function chest:on_opened()
  sol.audio.play_sound("chest_small")
end

44
Development / Re: Script working part of the time
« on: May 13, 2017, 05:30:05 am »
I think i got it, the problem I think was that I was setting the npc to visible true/false rather than enabled so when I was trying to interact with the npc it was 50/50 whether the invisible or the real npc was being interacted with. since changing to enabled I've tested it 5 times and its worked all 5.

45
Development / Re: Script working part of the time
« on: May 13, 2017, 03:31:52 am »
sorry, what i meant is if i test the script once it may work, then the next time i test it (after making no changes) it won't work. then next time it may or may not again.

how do i add debug print statements?

Pages: 1 2 [3] 4 5