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.


Messages - PeterB

Pages: [1] 2 3
1
Your scripts / Re: New rain script
« on: 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.

2
Your scripts / Re: New rain script
« on: 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

Code: [Select]
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.

3
Your scripts / Re: New rain script
« on: 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

4
Your scripts / Magic Mirror (ALTTP) warp script
« on: 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

Code: [Select]
-- 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


5
Your scripts / Re: Default Destination Checker
« on: January 29, 2021, 08:29:17 pm »
Great catch llamazing, thanks for posting this.

6
Development / Re: Outward separator problem with interaction
« on: January 10, 2021, 11:08:34 am »
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



7
Development / Re: Ground sprite changed on map change
« on: 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().
 

8
Development / Re: Outward separator problem with interaction
« on: November 14, 2020, 10:03:06 am »
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.

9
Development / Re: Is there a Launcher version for windows 32xbit?
« on: November 14, 2020, 09:58:20 am »
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!!

10
Development / Re: Outward separator problem with interaction
« on: August 24, 2020, 05:39:09 pm »
Hi, for me the most obvious way to solve this would be to split the map into smaller areas and use side of map transporters to link them together  :)

11
Hi,

I have had a look at the source code and it is the vase.dat file that is your problem

As you can see from the attached image it is looking for the vase_broken.png when you destroy it.

To fix it you can go into the sprite in the folder view in the editor and choose another 8 frame image to use for the broken vase image.

Perhaps use the stone.png and use the brown sequence.


12
Development / Re: Help with name display code
« on: January 08, 2020, 05:02:22 pm »
Ok, brilliant thanks, thanks for the discord tip too.

13
Development / Re: Help with name display code
« on: January 05, 2020, 10:47:49 pm »
Hey Llamazing,

Struggling with the - EMPTY - name if no save game present section. Any help gladly received as I am pulling my hair out with this one today. It doesn't seem to want to run the two lines
Code: [Select]
                local name = "- " .. sol.language.get_string("savegames_menu.empty") .. " -"
player_name_text:set_text(name)

For some reason!!! Here is the full section.

Code: [Select]
-- Reads the existing savegames and creates the savegames surfaces.
local function read_savegames()

  for i = 1, 3 do
    local file_name = get_savegame_file_name(i)
    local surface = sol.surface.create(272, 16)
    surface:set_xy(24, 8 + i * 48)
    savegames_surfaces[i] = surface

player_name_text = sol.text_surface.create{
      font = "alttp",
      font_size = 11,
    }

    if not sol.game.exists(file_name) then
      games[i] = nil
    else
      -- Existing file.
local game = game_manager:create(file_name)
games[i] = game

-- Player name get or use EMPTY
if sol.game.exists(file_name) then
player_name_text:set_text(game:get_value("player_name"))
else
                local name = "- " .. sol.language.get_string("savegames_menu.empty") .. " -"
player_name_text:set_text(name)
end
    -- Draw hearts and player name.
draw_hearts(game, surface)
player_name_text:draw(surface, 64, 8)
    end
  end
end 

full lua file and screen capture attached, shame you can't see the fairy's wings moving though. Thanks for any help.


14
Development / Re: Help with name display code
« on: January 05, 2020, 10:47:19 am »
Brilliant thanks Llamazing, i hadn't even thought about that. I thought it was probably that line, but as there weren't any errors i got sidetracked on font colours.

It all works now, i used

Code: [Select]
player_name_text:draw(surface, 64, 8)
which works a treat. Now on to the - Empty - file name problem!!!

15
Development / Help with name display code
« on: January 04, 2020, 09:20:50 pm »
Hey guys,

I am after some help with my savegames.lua. I am trying to get the players name from the save1.dat file (or 2 or 3) and print it on the game select screen.

I can't see what I am doing wrong with drawing it on the screen, so am after some help please.

Here is the relevant section of code, and I have attached the savegames.lua file.

Thanks in advance.

Peter

Code: [Select]
local function read_savegames()

  for i = 1, 3 do
    local file_name = get_savegame_file_name(i)
    local surface = sol.surface.create(272, 16)
    surface:set_xy(24, 8 + i * 48)
    savegames_surfaces[i] = surface

player_name_text = sol.text_surface.create{
      font = "alttp",
      font_size = 11,
    }

    if not sol.game.exists(file_name) then
      games[i] = nil
  local name = "- " .. sol.language.get_string("savegames_menu.empty") .. " -"
      player_name_text:set_text(name)
    else
      -- Existing file.
    local game = game_manager:create(file_name)
    games[i] = game

-- Player name get and display
player_name_text:set_text(game:get_value("player_name"))
player_name_text:draw(surface, 90, 16 + i * 48)

    -- Hearts.
    draw_hearts(game, surface)
    end
  end
end

Pages: [1] 2 3