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 - dpro_games

#16
Development / Save file ?
November 24, 2017, 09:09:30 AM
Hello, I working on a project with the solarus engine in my school but I can run the quest. I think the probleme come from the save file which cannot be created because of my "student session" can't write on the local disk but only on a serveur. So, how can I change the path to say to solarus than it need to create the file on the serveur and load the save from it ?

Thank you to help me  :)
#17
Development / Re: How to use: chest:on_opened() ?
July 12, 2017, 06:54:13 PM
I found by myself, that's work !  :D
I use this line:
hero:start_treasure(treasure_item, [treasure_variant, [treasure_savegame_variable, [callback]]])
To give the treasure to the hero when he open the chest.

Thanks you for helped me !  :D :D
#18
Development / Re: How to use: chest:on_opened() ?
July 12, 2017, 06:33:15 PM
It work but there is still a problem... When I open the chest, the value is increase but the hero don't get the sword in the chest. May I need to give the sword by the code but I don't know the line which give the item like if the player open a chest...
Thank to help me.
#19
Development / Re: How to use: chest:on_opened() ?
July 11, 2017, 05:04:32 PM
I just want to detect when the chest is open to open a door.
#20
Development / Re: How to use: chest:on_opened() ?
July 11, 2017, 04:55:15 PM
Thank for the answere
With this code
function sword_chest:on_opened(sword, 1, "sword_chest_save")
  hero:unfreeze()
  chest_open = chest_open + 1
  test()
end


I have another error
Error: Failed to load script 'maps/dungeons/tuto/place_holder': [string "maps/dungeons/tuto/place_holder.lua"]:5: <name> or '...' expected near '1'

I don't understand why...
#21
Hello, I create this code to increment a value when this chest is open but I have this error :
Error: Failed to load script 'maps/dungeons/tuto/place_holder': [string "maps/dungeons/tuto/place_holder.lua"]:5: <name> or '...' expected near '"sword"'

function sword_chest:on_opened("sword", 1, "sword_chest_save")
  hero:unfreeze()
  chest_open = chest_open + 1
  test()
end
#22
Development / Re: In trouble with pause menu
June 30, 2017, 12:01:04 AM
Je n'ai rien compris à comment le corriger (je suis débutant complet...)
Ou se trouve le code à changer et par quoi le remplacer ?

Merci pour la reponse !
#23
Development / In trouble with pause menu
June 29, 2017, 11:21:29 PM
Hello, i'm using the exact same code as the christopho's project (mecuris chest) for the pause menu and the game over menu...
(pause.lua/pause_inventory.lua/pause_map.lua/pause_options.lua/pause_quest_status.lua/pause_submenu.lua/game_over.lua)
https://github.com/solarus-games/zelda-mercuris-chest/tree/dev/data/scripts/menus
But there is a strange bug when the player die... the game over menu work very well but if the player choose to continue the game (with save or without save...) when the pause button is pressed during the game after the choice, the menu is completely broken... the images are superimposed on the others ect... I don't know why. But when we quit the game and restart the save all is back as before...

Please help me ! Thank
#24
Development / Re: Small Key HUD ?
April 05, 2017, 06:26:28 PM
Ça marche enfin !!  ;D
Vraiment merci de m'avoir accordé du temps pour m'aider ! J'ai compris plein de chose sur le fonctionnement de Solarus !

Et un gros GG pour avoir conçu le moteur de mes rêve: Solarus !   :)
#25
Development / Re: Small Key HUD ?
April 05, 2017, 05:56:24 PM
Juste, comment faire pour que ma variable qui compte les clés soit égale a zéro aux début du jeu et pas a "nil" ?
#26
Development / Re: Small Key HUD ?
April 05, 2017, 05:22:20 PM
Ah oui pardon, je suis débile...  ;D

-- 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)

  -- Set up the HUD.
  local hud = {
    enabled = false,
    elements = {},
  }

  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
  end

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

    if hud:is_enabled() then
      -- Stop all HUD elements.
      hud:set_enabled(false)
    end
  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
    end
  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

  -- 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

  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
#27
Development / Re: Small Key HUD ?
April 05, 2017, 04:36:12 PM
J'ai de nouveau un problème au niveau du HUD cette fois, mais il me semble que j'ai presque réussis...

Le code du HUD pour la small_key :

-- The small_key counter shown in the game screen.

local small_key_builder = {}

local small_key_icon_img = sol.surface.create("hud/small_key_icon.png")

function small_key_builder:new(game, config)

  local small_key = {}

  local digits_text = sol.text_surface.create({
    font = "white_digits",
    horizontal_alignment = "left",
    vertical_alignment = "top",
  })
  local small_key_displayed = game:get_value("small_keys_save")

  local dst_x, dst_y = config.x, config.y

  function small_key:on_draw(dst_surface)

    local x, y = dst_x, dst_y
    local width, height = dst_surface:get_size()
    if x < 0 then
      x = width + x
    end
    if y < 0 then
      y = height + y
    end

    small_key_icon_img:draw(dst_surface, x + 8, y)
    digits_text:draw(dst_surface, x, y + 10)
  end

end

return small_key_builder


Mais j'ai une erreur :

Error: In on_started: [string "scripts/hud/hud.lua"]:21: attempt to index local 'element' (a nil value)

Voici le script de la clé :

local item = ...
local game = item:get_game()

function item:on_created()

  self:set_shadow("small")
  self:set_brandish_when_picked(false)
  self:set_sound_when_picked("picked_small_key")
end

function item:on_obtaining(variant, savegame_variable)

  local count = game:get_value("small_keys_save") or 0
  game:set_value("small_keys_save", count + 1)
end
#28
Development / Re: Small Key HUD ?
April 05, 2017, 03:08:02 PM
Ca marche !! Merci beaucoup !!  :)
#29
Development / Re: Small Key HUD ?
April 05, 2017, 02:56:12 PM
Il y a encore un problème quand je prend une clé, j'ai une erreur différente maintenant :

Error: In on_obtaining: [string "items/small_key.lua"]:12: attempt to index global 'game' (a nil value)
#30
Development / Re: Small Key HUD ?
April 05, 2017, 02:49:19 PM
En fait, je commence vraiment la programmation et là, çà fait déjà plusieurs semaine que je bloque sur le système de clé avec le HUD... Donc en gros je ne comprend rien au script "equipment" (je doit supprimer quoi pour faire le truc le plus simple possible) et où je doit placer le require de ce script ? Vraiment merci d'accorder du temps au nouveau développeur !