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

#541
Hi
I was wondering if it was possible to save a single custom entity state on the map when there are copies of the same entity  ?

This is my alternate chest script (issue bellow)

Code (lua) Select
local entity = ...
local game = entity:get_game()
local map = entity:get_game():get_map()
local hero = entity:get_map():get_entity("hero")

-- Chest example : Small Key (code from : Big chest example : Master Key)

-- Hud notification : check hero & entity direction and tell by the way of a hud info if it can be opened
entity:add_collision_test("touching", function()
if not open and hero:get_direction() == entity:get_direction() then
game:set_custom_command_effect("action", "open")
else
game:set_custom_command_effect("action", nil)
end
end)

function entity:on_created()
  self:set_drawn_in_y_order(true)
  self:set_can_traverse("hero", false)
  self:set_traversable_by("hero", false)

-- check if open
if open then
self:get_sprite():set_animation("open")
end

end

function entity:on_interaction()

local x,y = entity:get_position()
local hero = entity:get_map():get_entity("hero")

if not open then
open = false
end

  if hero:get_direction() == entity:get_direction() and not open then
       if entity:get_direction() == 0 then --right
           hero:set_position(x-16, y)
       elseif entity:get_direction() == 1 then --up
           hero:set_position(x, y+16)
       elseif entity:get_direction() == 2 then --left
           hero:set_position(x+16, y)
       elseif entity:get_direction() == 3 then --down
           hero:set_position(x, y-16)
       end

    hero:freeze()
    game:set_pause_allowed(false)

    sol.timer.start(1,function()
            hero:set_animation("drop")
    end)

    sol.timer.start(200,function()
           if hero:get_direction() == 3 or hero:get_direction() == 1 then
            hero:set_animation("stopped")
           else
            hero:set_animation("grabbing")
           end
    end)

    sol.timer.start(300,function()
           if hero:get_direction() == 0 or hero:get_direction() == 2 then
            hero:set_animation("stopped")
           end
    self:get_sprite():set_animation("open")
    sol.audio.play_sound("/common/chest_open")
    end)
     
    sol.timer.start(600,function()
    hero:set_animation("stopped")
    if hero:get_direction() == entity:get_direction() then
       if entity:get_direction() == 0 then --right
           hero:set_direction(3)
       elseif entity:get_direction() == 1 then --up
           hero:set_direction(2)
       elseif entity:get_direction() == 2 then --left
           hero:set_direction(3)
       end
      end
     end)

    sol.timer.start(750,function()
    hero:set_animation("chest_holding_before_brandish")
    end)

    sol.timer.start(1500, function()
    hero:unfreeze()
    hero:start_treasure("small_key")
    hero:set_animation("brandish_alternate") -- overwrite the default brandish animation for this particular item
    game:set_pause_allowed(true)
    hero:set_direction(entity:get_direction())
    open = true
    end)

    elseif not open then
      game:start_dialog("gameplay.cannot_open_chest_side")
end
end


It works fine when loaded in-game (though it can be optimized), the chest, animation, interraction and treasure works fine, same for the logic (if it is open then you can't re-open it), the issue is, if I place some copies of the same entity on the same map / another map, it acts as it was opened because it re-use the same way than the 1st chest do. And I want this script to be  copied, used and functionnal on many dungeon maps without recreating a code for each chest

I don't have many idea so I don't really know if that would work and I don't really know how to render this possible, i'm stuck with this issue, if someone have any idea, I'm on.
#542
Bugs & Feature requests / Re: set_traversable_by issue
October 16, 2015, 01:13:40 PM
Quote from: Christopho on October 16, 2015, 01:49:45 AM
- The scripted hookshot and arrows are custom entities, they are not entities of built-in type "hookshot" or "arrow". So you need self:set_traversable_by("custom_entity", function() ........ end), passing a callback that decides.
- There might be a bug if destructibles can traverse your entity. However, it is not usual to move destructibles (recall that destructibles are bushes/pots/skulls).
- There is a function game:set_pause_allowed (see the doc).

Ah, everything works great now, thanks  ;)
#543
Hello

I'm facing a issue with a basic custom entity (rewriting the chests), in on_created, i do follow the instructions by adding

Code (lua) Select
  self:set_can_traverse("hero", false)
  self:set_traversable_by("hero", false)
  self:set_traversable_by("hookshot", false)
  self:set_traversable_by("arrow", false)
  self:set_traversable_by("destructible", false)


the thing is, the hero cannot traverse the door, except if he has a certain item, but the hookshot,arrow and destructible don't work, they go through the entity, even if set_traversable_by is false.

I'm using Christopho's LUAs'd hookshot and bow scripts, that might be the issue, but I don't understand why it don't work for the destructible

Oh by the way, do you know a way to disable menu access during a cutscene ? hero:freeze() still allow to access the pause menu  ???

thanks for the answer
#544
Development / Re: Camera zooming function ?
October 15, 2015, 03:59:19 PM
Quote from: zutokaza on October 15, 2015, 03:37:38 PM
Can you give a link to a YouTube video of this Script being used in Love Engine? It helps developers know exactly what the code is doing.

There is no Youtube link about this script, but as the title says, the script allow zooming / change camera angle on the map by rescaling it, there is nothing much else, it's pretty much a basic function.
#545
Your projects / Re: The Legend of Zelda
October 15, 2015, 01:11:36 PM
Quote from: Diarandor on October 14, 2015, 10:59:09 PM
I like those cloud shadows of your game. It's a cool effect and seems easy to do with surfaces.  :)

Yeah it's quite easy to put in game and to make it scroll, the hardest thing is to make the surfae repeating itself, the lost wood one is the easiest because it's a static surface. This is just temporary at the moment, it will be totally replaced (I hope) by a dynamic generated cloud surface in the WIP weather script. Or the non-cannonial solution is to wait until Solarus allows shaders, but this is (maybe) gonna take a while before Solarus have Shader support

Quote from: wrightmat on October 14, 2015, 02:06:07 PM
I knew your "life bar" sounded/looked familiar ;)
This is looking really good - great work!

It does look the same but it was repurposed for something else. ^^

------------------------------------------------


Beside, the Elementary arrows (Fire, Ice, Light) are on the way, they are still in the experimental work, but I'm whilling to add these to the engine, they will work the same way as Wind Waker do.
That being said, the bow will have a new mechanic, comparable to the 3d Zelda, or FSA, user will get the possibility to switch between elemental arrows with a key before arming the bow
The pic bellow is a mockup, it will look like this when it will be finished, the Hookshot will have this mechanic as well

#546
Quote from: Diarandor on October 13, 2015, 07:15:17 PM
To choose a random sound, you can easily do it with the Lua random functions, like math.random(...), although maybe you already know that. Probably you need a random seed to make  the result a random number. This part should be a piece of cake. I put a link about the random function: http://www.lua.org/pil/18.html

This is quite useful indeed
Thanks ^^
#547
Quote from: Diarandor on October 13, 2015, 04:33:08 PM
I think there is already a sound for the sword. Something like sword.ogg (or maybe with a different extension). You can try to replace that file with your sound, it could work. But that only works for the sword that is implemented in the engine. You can always fully script your own sword.

Edit: in your case, if you don't hear a sound, maybe the problem is that the event item:on_using() is not being called for some reason (maybe something is missing in your code).

I'm using the default sword.lua in the "item" folder, that's maybe because the hardcoded sword can't interract with the sword.lua which is simply a call event. And thus can't call on_using() (I tried with MoS hookshot and bow which are too hardcoded and same thing occurs, nothing is played and no error are displayed (in the console and/or in the error.txt)
Your solution of the sword sounds sounds great, but I'm searching something to play 1 random sound each time you use that sword, I'll try to LUA the whole sword process (or do some hardcore modification directly from source code and re-compile), it might be more handy for what I'm searching  ;D
#548
Quote from: Diarandor on October 13, 2015, 04:13:41 PM
For the sound, it's actually sol.audio.play_sound(sound_id). If you open the error.txt file, you will probably see that the function you called does not exist. Check the Lua API to know the functions you have:
http://www.solarus-games.org/doc/latest/index.html

To customize the use of the sword you can use some functions like:
game:on_command_pressed(command)
but it will take some work to script the desired behaviour. (I don't have time to make your script, but you can always ask for others help on the forum.)

Fot the sol.audio i didn't see my mistake, it is indeed sol.audio.play_sound(sound_id) in item:on_using() as you called (I did a mistake while writing this thread :() but still don't work
For the sword thanks, I'll try asap
#549
Hi
I was wondering if there is a way to add sound like random listed sound when using the sword ? I've tried to add sol.audio.sound_play in the sword item script with 'item:on_using()' but it doen't play the sound at all.
Oh and also is there a chance of someone to re-code in LUA the sword for making sword skills easily ?
#550
Your projects / The Legend of Zelda
October 13, 2015, 03:10:54 PM
THIS THREAD IS SUBJECT TO CHANGE, RESERVED

This is a port of a old running fan game I was developping in the past 4 years in RPG Maker XP, and I succeed to get to it's limit, so I discovered Solarus and so I decided to port the game on this engine with amelioration, gameplay and mapping wise.
There is still not so much to show yet, as I am mostly porting the tilesets /  musics and remaking every maps, there are some finished maps with working stuffs currently.
Here's a sneek peak.

Water Temple, everyone loves Water Temple right ?
The blue bar is sort of "life bar" while plunging, if the bar is empty while being under water, without the Zora tunic, you'll drawn and insta death, the bar replenishes itself when you're out of the water, instantly after surfacing if you have the zora tunic watchout for that. The lengh of the bar depend on which version of flippers you have.

This dugeon was cut in the RPG Maker version due to layers and eventing limitation, it is returning in the Solarus version.




Exterior graphic
Castle Entrance with a nice bug, the water bar spawn whereas it shouldn't spawn here, same as the bars


Deep in the woods

Some village


Some place from previous Zelda games are presents (the Sanctuary from ALTTP) but showing them while they does already exist is a non-sense

I'll update some info soon.

Some ressources comes from wrightmat's project atm, I'm using and modifying some of his thing to learn and to save time (mostly the reconvertion of the stamina to a alternate life bar)
Graphics are from Parallel Worlds + mods, Solarus, various Zelda and Nintendo, some are personnal
#551
Development / Camera zooming function ?
October 13, 2015, 03:07:59 PM
I was thinking if a system of that sort is do-able in the solarus engie, you know, a zooming function, mostly useful for cutscenes, puzzle enigma hint, etc

I found a script of this sort, but for the LOVE engine, if someone is interested of porting it to Solarus, here it is :
https://github.com/vrld/hump/blob/master/camera.lua

I'm not experienced enough with the engine to port it :(