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

#31
Development / Re: Receptacle
January 21, 2018, 12:06:58 AM
Non, je parle de ton code, celui de ton item

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

function item:on_created()
  self:set_shadow(nil)
  self:set_sound_when_picked(nil)
  self:set_sound_when_brandished("get_heart_container")
end


function item:on_obtaining(variant, savegame_variable)
 
end

function item:on_obtained(variant, savegame_variable)
  game:add_max_life(4)
end
#32
Ah yes, Children of Solarus, I remember this. Mercuris Chest will be released first, in 2044, right ?

Looking forward to this, so it's mostly a rework of MoS DX with new stuffs rather then a straight assets mod ?

Understood ? Solarus team are SECRETLY working on a new site, it's a secret to everybody
#33
Development / Re: Receptacle
January 16, 2018, 05:59:58 PM
J'avais ce genre d'erreur mais ça remonte, surement un truc dans ton code, peux tu le montrer ?
#34
Development / Re: Bouger la caméra
December 31, 2017, 04:10:31 PM
Oui, il faudrait que tu apprennes le LUA afin d'y connaitre les bases.
Tu devrais suivre les tutoriaux de Christopho, ca peut parfaitement aider a maitriser et l'éditeur, et le LUA dans une forme basique

https://www.youtube.com/watch?v=rsammSHv7xc&index=1&list=PLzJ4jb-Y0ufzB4nXkSINFhbrtLlnlI4li
#35
Your projects / Re: Project Z2R
December 26, 2017, 05:03:54 PM
Quote from: wrightmat on December 26, 2017, 03:43:10 PM
The full AoL map consists of 169x118 tiles (of course a lot of that is ocean). Although the map from AoL contains the full map for LoZ, so the scale is obviously much larger than LttP.

There is one missing thing in the AOL map image, the labyrinth before the last palace

For the map size you have 2 solutions

Map the whole map into 1 single huge map (You are prone to lags if you put a lot of entities, rare in Solarus but it can still happen)
"Segment" the maps by linking maps each other

Start with the basic 320x240, then resize the map to your needs, it's fairly easy on Solarus
#36
Development / Re: Bouger la caméra
December 23, 2017, 05:53:48 PM
Tu as plusieurs facon de faire.

Dans solarus < 1.5, tu peux utiliser une fonction hardcodée map:move_camera
Dans les futures versions, il me semble que cette fonction n'existera plus mais tu peux cependant la coder et modifier son comportement comme bon te semble

On te conseilleras d'utiliser les metatable comme le script ci-dessous

Copies ce code, enregistre le script et dans main.lua, utilise require()

Code (lua) Select
local map_metatable = sol.main.get_metatable("map")

-- Move the camera
function map_metatable:move_camera(x, y, speed, callback, delay_before, delay_after)
  local camera = self:get_camera()
  local game = self:get_game()
  local hero = self:get_hero()

  delay_before = delay_before or 1000
  delay_after = delay_after or 1000

  local back_x, back_y = camera:get_position_to_track(hero)
  game:set_suspended(true)
  camera:start_manual()

  local movement = sol.movement.create("target")
  movement:set_target(camera:get_position_to_track(x, y))
  movement:set_ignore_obstacles(true)
  movement:set_speed(speed)
  movement:start(camera, function()
    local timer_1 = sol.timer.start(self, delay_before, function()
      callback()
      local timer_2 = sol.timer.start(self, delay_after, function()
        local movement = sol.movement.create("target")
        movement:set_target(back_x, back_y)
        movement:set_ignore_obstacles(true)
        movement:set_speed(speed)
        movement:start(camera, function()
          game:set_suspended(false)
          camera:start_tracking(hero)
          if self.on_camera_back ~= nil then
            self:on_camera_back()
          end
        end)
      end)
      timer_2:set_suspended_with_map(false)
    end)
    timer_1:set_suspended_with_map(false)
  end)
end


Donc, dans ton script, tu devrais utiliser

Code (lua) Select

  function Switch_a:on_activated()
    local b3_door = map:get_entity("Porte_b_3") -- ?
    local x, y = map:get_entity("Porte_a"):get_position()
    local speed = 90

    map:move_camera(x, y, speed, function() 
      sol.audio.play_sound("door_open")
      sol.audio.play_sound("secret")
      map:open_doors("Porte_a")
    end, 1000, 1000)
  end
#37
General discussion / Re: Aide ennemie mur capteur
December 23, 2017, 12:15:28 AM
Isn't this feature used in ROTH SE ? I remember that enemies reset position when separators has been activated
Else, you might have to deal with distance to trigger ennemies but i'm pretty sure that what you're searching exists in ROTH SE

check for separator_manager.lua or something like this
#38
Development / Re: Lanterne qui illumine autour de links
December 18, 2017, 06:27:23 PM
Quote from: wrightmat on December 18, 2017, 03:03:30 PM
My system doesn't exactly meet your criteria, but it could be a starting point that you could customize. Of note in my system, the lantern does not need to be equipped in order to offer the glow at night/dawn/dusk and the intensity does not change based on magic level.

Oddly I have to rework my lantern item completely that should meet his criteria, probably not the intensity because it can't be changed, maybe this can be done using shaders (if I take as example the video bellow), but that's an upcoming feature.

https://www.youtube.com/watch?v=1cpJ6q9ppuE
#39
Your scripts / Re: [WIP] Ceiling dropping effect (ALTTP)
December 17, 2017, 03:39:42 PM
I like this script, I'm using it but it have the limitation to be only available for the hero

I am currently working on this kind of script as well, this time, all entities are able to use this ability (enemies, hero, custom entities)

This is not perfect as it might lead to problems currently but it mostly works
Entity's real position remains intact, only their sprites are being moved

Code (lua) Select
local object = {}

-- Falling from ceiling
-- Works with any type of entity
-- Version 0.1 - MetalZelda

--[[
  Make it work:
 
  - Save this script anywhere you want
  - In any script (metatable script is better):
 
  Example: I want to make this available for the hero
  local fall_manager = require("path_to_the_script")
  fall_manager:create("hero")

  Recommended way to make this work:
  -> in main.lua

  local fall_manager = require("path_to_the_script")
  local entities_fall_compatibility = { "hero", "enemy", "npc"}
  for _, entities in ipairs(entities_fall_compatibility) do
    fall_manager:create(entities)
  end
 
 
  Careful, it only work with map entities
 
  To active it, simply call
    - hero:fall_from_ceiling(height, sound, callback) where
 
  height = the height of the falling things (must be positive)
  sound = any sound you wanna play when the falling animation starts
  callback = what to do when it finished (text, cutscene, death, etc)
 
- Remember that you can implement it anywhere else, the target only need to be an entity / sprite
]]

function object:create(meta)
  local object_meta = sol.main.get_metatable(meta)
  local currently_falling = false
 
  function object_meta:fall_from_ceiling(height, sound, callback)
    currently_falling = true

if meta == "hero" then
          -- This means that self returns the hero entity, avoid him from moving.
  self:freeze()
end

-- Get the current object position
local cx, cy, clayer = self:get_position()
local map = self:get_map()

-- Draw a shadow in the entity's real position
local shadow = map:create_custom_entity({
  x = cx,
  y = cy,
  layer = clayer,
  width = 16,
  height = 16,
  sprite = "entities/shadow",
  direction = 0
})


local first_active_sprite = nil

    -- Depending on things, obejct might have different sprite that is synchronized to him
for sprite_name, sprite in self:get_sprites() do
  sprite:set_xy(0, -height)
 
  if first_active_sprite ~= nil then
    first_active_sprite = sprite_name
  end
end

local target_sprite = self:get_sprite(first_active_sprite)

if sound ~= nil then
  sol.audio.play_sound(sound)
end

local movement = sol.movement.create("straight")
movement:set_max_distance(height)
movement:set_angle(3 * math.pi / 2)
movement:set_speed(300)
movement:set_ignore_obstacles(true)
movement:start(target_sprite, function()
  -- Movement finished, disable the falling movement
  first_active_sprite = nil
  currently_falling = false

          sol.audio.play_sound("hero_lands")
 
  if meta == "hero" then
    self:unfreeze()
  end
 
  if callback ~= nil then
    callback()
  end
 
  shadow:remove()
end)

local entity = self

-- Notify the game to synchronize all sprites during the freefall movement if any
function movement:on_position_changed()
  local x, y = target_sprite:get_xy()
 
  local animation = shadow:get_sprite():get_animation()
  local current_height = -y
 
          -- Adding some shadow stuff here

  if current_height == height / 1.5 then
    if animation ~= "demi" then
  shadow:get_sprite():set_animation("demi")
end
  elseif current_height == height / 4 then
    if animation ~= "big" then
  shadow:get_sprite():set_animation("big")
end
  end
 
  -- Depending on things, obejct might have different sprite that is synchronized to him
  for _, sprite in entity:get_sprites() do
    sprite:set_xy(x, y)
  end
 
end
  end
end


return object


This way, you can still use the ability to start the animation on the player when falling from a hole (using map:on_started(destination)), plus you can use it to create falling enemies
Plus, sprites synchronised to an entity will follow the falling movement (hero's shield for example)
You can also make a timer to make the hero to change direction a la ALTTP, there is a local variable that return whever or not the entity is falling or not

Upcoming update will include ground detection, mostly to use a different landing sound depending on the terrain
#40
Development / Re: Lanterne qui illumine autour de links
December 17, 2017, 01:49:37 PM
Yo'

Tu peux toujours regarder comment çe système fonctionne sur le jeu Book of Mudora, Wrightmat utilise ce système (basé sur un système jour - nuit)

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

Si tu cherches un système plus simple (à la ALTTP), regarde du coté de Mystery of Solarus DX

En principe, ce systeme est simple:

- Tu crées une surface avec le contour de la lanterne
- Tu dessines cette surface relative a la position (et direction) du héros
#41
Development / Re: Randomnize table ?
December 10, 2017, 05:33:28 PM
Quote from: Diarandor on December 10, 2017, 05:13:24 PM
That depends on what you want to do.

1) If you want to show only the treasure of the chest you opened and not the others, then you only need a random number between 1 and #minigame_prizes (remember to rename your list "minigame_prices" to "minigame_priZes", because it's not the same thing). You can use:

local index = math.random(1, #minigame_prizes)
local prize = minigame_prizes[index]


2) If you want to show where all prizes are after you open the chest, then you need to code a random permutation. I would use the "Knuth shuffles" permutation algorithm (it is very simple and the code is short); you can adapt the code from here:
https://en.wikipedia.org/wiki/Random_permutation
You can either permute the prizes list directly, or permute a list with numbers from 1 to #minigame_prizes and then use the permuted indices list to associate the prizes to the corresponding chests.

We all enjoy games with chests. Does that mean we are all perverts?  :o

Yes, that's the way I wanna go
I did found some workaround by setting a random treasure at chest opening sequence

Code (lua) Select
-- Define what happen when the player tries to open a chest
-- Since chests are empty (no treasure), that makes things easier
for chests in map:get_entities_by_type("chest") do
  chests.on_opened = function()
    if minigame_state == "end" then
      sol.audio.play_sound("error")
      game:start_dialog("minigame.chest.need_pay", function()
        sol.audio.play_sound("objects/minecart/landing")
        chests:set_open(false)
        hero:unfreeze()
      end)
    else
      local rng = math.random(1, #minigame_prizes)
      rng = minigame_prizes[rng]

      local treasure, variant, savegame = rng[1], rng[2], rng[3]
      hero:start_treasure(treasure, variant + 1, savegame, function()
        game:start_dialog("minigame.chest.finished")
      end)
      minigame_state = "end"
     
    end
  end
end


I don't know if there's a better way to do so, since rng only applies when the choosen chest has been opened
Oh well, it does what I wanted

Y'all love chests chest is love chest is life :o
#42
Development / Randomnize table ?
December 10, 2017, 02:31:53 PM
Hello

Today I am mostly programming minigames, one of which is based on ALTTP.
But, I have taken another view of how the minigame would work.
Winnable items are shown before the game starts like so



Then a movement starts on winnable item's entity and the minigame starts.

This leads me to this question to make the minigame more dependant of an RNG (Random Number Generator) to make the minigame a bit more difficult
Winnable items are stored in a table

Code (lua) Select
local minigame_prices = {
  {"rupee", 0},
  {"amber_counter", 0},
  {"green_chuchu_counter", 0},
  {"heart_piece", 0},
  {"arrow", 0},
  {"rupee", 3},
  {"heart", 0},
  {"rupee", 5},
  {"rupee", 2},
}


Basically, it is

[chest 1] treasure = rupee, variant = 0

All I want is

[chest (random 1 - 9)] treasure = rupee, variant = 0

Any idea of how to make it happen ?
#43
I like how it's done, it reminds me of a shooting game in Anciant Stone Tablets
#44
Your scripts / Re: New rain script
November 18, 2017, 01:14:59 PM
It is much better now, this is awesome, thanks for this awesome script !
#45
Your scripts / Re: New rain script
November 14, 2017, 04:26:24 PM
Quote from: Diarandor on November 12, 2017, 08:37:17 PM
Yes, snow should not be harder than this. But better to make it in a different script because the rain script is already very complex due to the smooth transition between different rain modes (the rain drop number and their properties, and the darkness value, vary very smoothly). If you can wait for Christmas holidays, I will probably make the snow script for then.

Snow can be easy to make, just by editing the rain script, it tooks me around 5 minutes to make sprites and edit stuffs and the result is ok (if you take out the green terrain which don't fit the snow weather)
The snow effect is better with the drop deviation variable

Great thing is, it is really easy to include the weather script with my day / night cycle, I don't see any problem so far