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

#1
Development / Re: How to Receive an Item From an NPC
December 18, 2023, 07:51:48 AM
You have to do that with the map lua script.

npc:on_interaction() then do the dialog and finally give the item to the hero with hero:start_treasure(treasure_name, [treasure_variant, [treasure_savegame_variable, [callback]]])

You can have a look in the Manual for further help on these :)
#2
Development / Re: Hero Invisibilty
November 07, 2023, 10:54:16 PM
Yes that is what I would have suggested, i.e. creating a new hero animation in each tunic variant so when using the cape item so you just see a shadow.

You could change the hero's tunic animation to just show an outline and shadow and change it back once a timer ran out if it was powered by magic for example.
#3
Development / Re: How to Change an Entity's Sprite
November 07, 2023, 10:45:16 PM
Yes it would, as long as you replicate it in all the tunic variants. It can then be called with hero:set_animation(animation, [callback]) from the relevant game, item, map script etc depending on what or where the new animation was called or initiated.

If it is a permanent change then using the hero metatable may be the best way to do it :)
#4
Development / Re: How to Change the Hero's Sprite
October 28, 2023, 10:00:46 PM
Hi,

Tunic level relates to the Hero's defense level.

For example in Zelda Tunic level 1 is green, level 2 is blue and level 3 is red.

You therefore need to have a different colour sprite for each tunic level for every hero sprite.

That way when you upgrade your tunic in your game you can automatically change all your hero sprites to the next colour.

If you have a look in the sample quest that comes with the Quest Editor, in the sprites/hero folder you can see the three tunic sprite sets. It is the items/tunic script then then calls the relevant variant and updates the hero's sprite colour.

If you want to set up a different sprite then you just need to add a new animation to tunic1, tunic2 and tunic3 and call that animation from a script, at least i think that is the easiest way to do it.
#5
https://forum.solarus-games.org/en/index.php/topic,1044.0.html

This thread in Your Scripts also details this, there are also many other scripts here which may help you out as well.
#6
You also can drag and move around maps by holding down the mouses scroll wheel, well that's what mine does  ;)
#7
Your scripts / Re: New rain script
February 25, 2021, 09:46:16 PM
Hi,

I am no lua expert but it looks as though timers is not getting any value assigned to it.

Have you tried snow or hail, do they throw up errors as well?

I assume you are calling require("scripts/weather/rain_manager") from your game_manager script otherwise you wouldn't get an error.

If you copied the scripts across they should work so what else have you got in your map.lua script?

The scripts work for me in my game so I am at a loss.
#8
Your scripts / Re: New rain script
February 23, 2021, 09:12:35 PM
Hi,

Here is a link to a newer version of Children of Solarus rather than the old one in this post https://gitlab.com/solarus-games/children-of-solarus/-/tree/dev/data

I didn't add anything to main.lua so that may be part of the problem. I kept the same folder structure to save changing paths in the scripts and copied across -

scripts/teletransporter_meta (although i don't think this is required so could be commented out in the scripts?)
scripts/weather/hail, rain, snow and weather_manager
sprites/weather/rain and snow.png and dat

I also made sure that my scripts/multi_events wasn't missing anything from the Children of Solarus scripts/multi_events one (which it wasn't)

Then in the map.lua file of the map where you want the weather to appear you have to add


function map:on_started()

    game:set_world_rain_mode("your_world", "storm") or
    game:set_hail_mode("hail")

end


If you have a look at the snow, rain or hail manager scripts they all have examples of how to get the effect you are after.

But only do one effect.

I hope that helps.
#9
Your scripts / Re: New rain script
February 21, 2021, 08:15:13 AM
Hi,

I assume you added the rain_manger script to your scripts as well?

Also does your map have the world as outside_world?

Thanks,

PeterB
#10
Your scripts / Magic Mirror (ALTTP) warp script
February 21, 2021, 08:10:27 AM
Hi Guys,

Just thought I would share my script for my Magic Mirror item.

It allows you to transport between maps as in ALTTP.

Hopefully it should be self explanatory but if not please let me know.

PeterB

-- Allows you to travel from Dark world maps to Light world maps
-- Maps need to have the same name or you need to work out how to
-- change to new map. My maps have the same world layout so you can
-- go to the same place/co-ordinates. The map id's however are slightly
-- different, i.e. dark_world/castle versus light_world/castle. Hence the
-- string.sub 11 characters to remove dark_world and add light_world
-- back in the teleport statement.


local item = ...
local game = item:get_game()
 
function item:on_started()
  item:set_savegame_variable("possession_magic_mirror")
  item:set_assignable(true)
end

function item:on_using()
  local hero = game:get_hero()
  local map = item:get_map()
  local map_id = map:get_id()
  if map:get_world() == "dark_world" then -- go from dark_world back to light_world
    new_map = string.sub(map_id, 11)
    -- Teleport.
    sol.audio.play_sound("warp")
    hero:teleport("light_world" .. new_map .. "", "_same", "fade") -- takes you to same position on light_world map
  else
    sol.audio.play_sound("wrong")
  end
  item:set_finished()
end

#11
Your scripts / Re: Default Destination Checker
January 29, 2021, 08:29:17 PM
Great catch llamazing, thanks for posting this.
#12
Just had a thought on this, if you don't want the player to see the area you may be able to blank/fade out the area with MetalZeldas script.

http://forum.solarus-games.org/index.php/topic,1130.msg6593.html#msg6593

Peter


#13
Development / Re: Ground sprite changed on map change
January 10, 2021, 10:58:15 AM
I have seen in another post that there is a delay at the start of the map with map:on_started(). So If you have set this up in function map:on_started() it would be better to call it in function map:on_opening_transition_finished().
#14
I know what you mean, i have been doing ALTTP remake for a few years now!!

All the maps are done, enemies about 70% complete, just trying to learn lua and scripting now to sort out interactions with NPC's, objects etc.
#15
I don't suppose anyone has a 1.7 Windows version of Solarus and the editor. 32 or 64bit is fine

I have been trying to compile them from the source code in QT and Mys but have given up!!