Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Your scripts / Re: A chest created when all the enemies are killed
« Last post by Starlock on October 10, 2017, 08:24:56 pm »
Hey, could you post your current code?

You might have to make the declaration in the map:on_started() function It would be something like this

Code: Lua
  1.   if game:get_value("chestsavevalue") then yourchestname:set_enabled(true) else yourchestname:set_enabled(false) end

The functions you are talking about should look something like this:

Code: Lua
  1. for enemy in map:get_entities("yourenemy") do
  2.   enemy.on_dead = function()
  3.     if not map:has_entities("yourenemy") then
  4.       yourchestname:set_enabled(true)
  5.       sol.audio.play_sound("chest_appears")
  6.     end
  7.   end
  8. end
22
Your scripts / A chest created when all the enemies are killed
« Last post by Minefran12 on October 10, 2017, 06:42:38 pm »
I'm having a problem becaose i want to do to what the title says but i'm don't know how to do it exactly, Christopho say to me that i have to use the map:has_entities(prefix) and the enemy:on_dead(), and i start to do it following the docs and solving the errors that i saw in the console but in one point, i don' see any errors but it still dont work.

Please, could somebody tell me how i must do it, thanks.



PD: Sorry if I make mistakes of spealing or something else, i dont have a very high level of English. :)
23
Bugs & Feature requests / Re: Hero scaling
« Last post by GregoryMcGregerson on October 10, 2017, 05:52:34 am »
Alright I'll try to put together something this weekend. Gotta go through it and get rid of all the duplicate tiles, etc.
24
Development / Re: Removing a sprite created through sol.sprite.create ?
« Last post by Christopho on October 08, 2017, 05:26:46 pm »
entity:remove() removes the entity from the map. That's why sprites have no method remove(): they are not on the map.

If you want to stop displaying a sprite, simply stop calling sprite:draw() in your draw event. A good practice is also to assign nil to the sprite so that its memory gets freed.
25
Development / Removing a sprite created through sol.sprite.create ?
« Last post by MetalZelda on October 08, 2017, 05:18:54 pm »
Hi

I'm having troubble with cutscenes and sprites management.
I am currently making sage cutscenes with as inspiration ALTTP, but, after a while, the crystal around the sage needs to be removed



The sprite creation is a bit different because the cutscene starts immediately after the boss died, a surface fades to accomplish the black background, a menu handles the whole cutscene (mostly to overwrite and avoid pausing / moving, doing actions during cutscene)

Sprites are created in this order

black surface
Link sprite
Sage sprite
Crystal sprite

All created by sol.surface / sprite.create

But, calling

Code: [Select]
sprite:remove()
this happen

Code: [Select]
Error: In timer callback: [string "maps/cutscene_data/SageScene_0.lua"]:95: attempt to call method 'remove' (a nil value)
I can't use map entities because the menu is started above everything on the map, entities are not visible during the cutscene because of the background surface
Which confuse me a bit, we can't remove a sprite ?
26
Game art & music / Re: A Free Music / SFX Resource - Over 1000 Tracks
« Last post by Eric Matyas on October 04, 2017, 01:05:58 am »
I'm finally back to work on music for clients this week, but I did manage to create some new free tracks  for everyone:

On Dark/Ominous Page:
"Strangeness" (Looping)
http://soundimage.org/dark-ominous/

On the Puzzle Music 2 page:
"Cryptic Puzzler" (Looping)
"Cryptic Puzzler 2" (Looping)
"Bell Puzzler" (Looping)
http://soundimage.org/puzzle-music-2/

Have a great week!  :-)
27
Your scripts / [WIP] Ceiling dropping effect (ALTTP)
« Last post by PhoenixII54 on October 02, 2017, 10:01:07 pm »
Hi, in my attempts to reproduce famous effects from ALTTP to compensate the missing effects in Zelda : Mystery of Solarus, here is one of the major ones :

When you fall in e hole that has a floor below, you end up in the said room, falling from the ceiling and dropping onto the floor, after doing a few turns oaround yourself.

Be prepared, besause this is the puropse of this script.
Code: Lua
  1. --Ceiling dropping system (WIP)
  2. --Reproduces the "fall from uper floors" effects
  3.  
  4. --Usage : Call this script from any game launching system or use the event manager script to set the metatables then do your maps as usuel
  5. --IMPORTANT : you need to add a "dropping_from_ceiling" animation in the tunic sprites for the spinning effect to work.
  6.  
  7. --Extracting actual destination and ground from teletransporters since map;on_started(destination) dosen't take special destinations in account, then stirong it to a savegame variable lCan be useful for dungeons like Skull Dungeon (Level 3 of ALTTP, which has many hole entrances).
  8. --Note, here, everything is in a single script, but in a real project you may have multiple file (one for each metatable)
  9.  
  10. local teletransporter_meta=sol.main.get_metatable("teletransporter")
  11. local map_meta=sol.main.get_metatable("map")
  12.  
  13. function teletransporter_meta:on_activated()
  14.   local game=self:get_game()
  15.   local ground=self:get_map():get_ground(game:get_hero():get_position())
  16.   game:set_value("tp_ground",ground)
  17. end
  18.  
  19. --the actual trigger
  20. function map_meta:on_started(destination)
  21.   local hero=self:get_hero()
  22.   local game=self:get_game()
  23.   local x,y=hero:get_position()
  24.   local ground=game:get_value("tp_ground")
  25.   if ground=="hole" then
  26.     --Falling from the ceiling
  27.     hero:set_visible(false)
  28.     hero:freeze()
  29.     --disabling teletransoprters to avoid
  30.     local disabled_teletransoprters={}
  31.     for t in self:get_entities_by_type("teletransporter") do
  32.       if t:is_enabled() then
  33.         disabled_teletransporters[#disabled_teletransporters+1]=v
  34.         t:set_enabled(false)
  35.       end
  36.     end
  37.     --Creating a "stunt actor" moving vertically from the ceiling
  38.     local falling_hero=self:create_custom_entity({
  39.       name="falling_link",
  40.       x=x,
  41.       y=math.max(y-100,24),
  42.       direction=0,
  43.       layer=self:get_max_layer(),
  44.       sprite=hero:get_tunic_sprite_id(),
  45.       width=24,
  46.       height=24,
  47.     })
  48.     falling_hero:get_sprite():set_animation("dropping_from_ceiling")
  49.     falling_hero:set_can_traverse_ground("wall",true)
  50.     falling_hero:set_can_traverse_ground("empty",true)
  51.     falling_hero:set_can_traverse_ground("traversable",true)
  52.  
  53.     --Creating a reception platform (prevents the hero from falling into consecutive holes during the animation)
  54.     local platform=self:create_custom_entity({
  55.       name="platform",
  56.       direction=0,
  57.       layer=layer,
  58.       x=x,
  59.       y=y,
  60.       width=32,
  61.       height=32,
  62.       sprite="entities/shadow",
  63.     })
  64.     platform:bring_to_front()
  65.     platform:get_sprite():set_animation("big")
  66.     platform:set_modified_ground("traversable")
  67.  
  68.     --Creating the actual movement for the stunt actor
  69.     local movement=sol.movement.create("target")
  70.     movement:set_target(x,y)
  71.     movement:set_speed(127)
  72.     movement:start(falling_hero, function()
  73.       --Movement is now complete, restoring the disabled teletransoprters and getting rid of the temporary entities
  74.       sol.audio.play_sound("hero_lands")
  75.       platform:remove()
  76.       falling_hero:remove()
  77.       hero:set_visible(true)
  78.       hero:unfreeze()
  79.       for _,t in pairs(disabled_teletransporters) do
  80.         t:set_enabled(true)
  81.       end
  82.     end)
  83.     --]]
  84.   end
  85. end
  86.  

Hope it will be useful, but it may have have bugs, so don't hasitate to report them to me. And remember, it is not fully finished so expect changes to happpen.

edit#1 : Actually finished the v1.0 version, with ground detection on teletransportation.
28
Development / Re: Animated falling block ?
« Last post by FacciaBianca on September 27, 2017, 06:43:10 pm »
Thank you both for helping out. Now that I think about it, I should have named this thread "Animated falling vase/item/enemy", since this kind of block I'm using normally can't be pushed into holes unlike blocks created by the Cane of Somaria.
29
Development / Re: Animated falling block ?
« Last post by Christopho on September 27, 2017, 04:40:32 pm »
To keep things simple, I'd start by making it local to the one block you want to make fall.
And only later do some refactoring with metatables to make the code reusable.
30
Development / Re: Animated falling block ?
« Last post by FacciaBianca on September 27, 2017, 04:37:02 pm »
(Sorry for the late answer, I prefer trying to fix things myself before asking for help.)

Do what Chris says. You only need to define the events once, for the block metatable.
Alright I'll do this. Though am I brainstorming too much, or does it actually work with local variables ?
Pages: 1 2 [3] 4 5 ... 10