Author Topic: New rain script  (Read 2126 times)

Diarandor

  • Hero Member
  • *****
  • Posts: 1026
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #15 on: November 18, 2017, 05:02:02 pm »
It is much better now, this is awesome, thanks for this awesome script !

You are welcome! ;D
And here goes the first version of the hail script:
https://youtu.be/H1M4t04eQ78
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Diarandor

  • Hero Member
  • *****
  • Posts: 1026
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #16 on: November 18, 2017, 09:38:22 pm »
The fog script, and maybe other weather scripts, will have to wait. :P
No more weather scripts for now.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

froggy77

  • Full Member
  • ***
  • Posts: 108
    • View Profile
Re: New rain script
« Reply #17 on: November 19, 2017, 12:06:08 am »
wow, amazing what Solarus engine can do!

Your scripts are awesome, very well commented and quite easy to change to create new effects, that's why I follow your GitHub.

So, I created a fall (autumn) effect with orange leaves from your "snow manager" script. The "fall manager" is a first version, but I like the result.



(I specify the location of files to help newbies. ;)
  • Add these lines in ..\solarus\data\scripts\weather\weather_manager.lua
Code: [Select]
local fall_script_enabled = true
...

Code: [Select]
if fall_script_enabled then
  require("scripts/weather/fall_manager")
else -- Redefine methods to avoid errors.
  function game_meta:get_fall_mode() return nil end
  function game_meta:set_fall_mode(fall_mode) end
  function game_meta:get_world_fall_mode(world) return nil end
  function game_meta:set_world_fall_mode(world, fall_mode) end
end

You can find it here: https://github.com/solarus-games/children-of-solarus/blob/master/data/scripts/weather/weather_manager.lua

  • ..\solarus\data\project_db.dat  (Change it via the editor)
Code: [Select]
sprite{ id = "weather/leaf", description = "weather/leaf" }
  • Don't forget ..\solarus\data\scripts\meta\teletransporter_meta.lua
You can find it here: https://github.com/solarus-games/children-of-solarus/blob/master/data/scripts/meta/teletransporter_meta.lua
  • Also ..\solarus\data\script\multi_events.lua
You can find it here: https://github.com/solarus-games/children-of-solarus/blob/master/data/scripts/multi_events.lua

  • In ..\solarus\data\script\features.lua, add this line:
Code: [Select]
require("scripts/weather/weather_manager")You can find it here: https://github.com/solarus-games/children-of-solarus/blob/master/data/scripts/features.lua
You may need to delete some lines depending on your project, but you must add at least the line. I say that, because myself, I searched to find out why the weather scripts did not work.
  • In your "map".lua, add this line to trigger the effect in the "function map:on_started()"
Code: [Select]
game:set_world_fall_mode("outside", "fall") or "fall_storm" mode instead of "fall" mode.



Note that the current version of the snow manager is already far superior to the one of RPGshit RPGmaker.
lol  ;D
« Last Edit: November 19, 2017, 01:22:44 am by froggy77 »

yankscally

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: New rain script
« Reply #18 on: January 07, 2018, 10:52:46 am »
Hi, I'm trying to impelement this into my project, but run into problems with putting it into my game manager, I'm still learning lua so the code I'm trying to put in game manager is this


Code: [Select]
-- Rain manager script.
-- Author: Diarandor (Solarus Team).
-- License: GPL v3-or-later.
-- Donations: solarus-games.org, diarandor at gmail dot com.

--[[   Instructions:
To add this script to your game, call from game_manager script:
    require("scripts/weather/rain_manager")
The functions here defined are:
    game:get_rain_mode()
    game:set_rain_mode(rain_mode)
    game:get_world_rain_mode(world)
    game:set_world_rain_mode(world, rain_mode)
Rain modes: "rain", "storm", nil (no rain).
--]]

-- This script requires the multi_event script and the teleporters meta:
require("scripts/multi_events")
local rain_manager = {}

local game_meta = sol.main.get_metatable("game")
local map_meta = sol.main.get_metatable("map")

--- ECT


 in the instructions part, it doesnt say where to put it in game manager. I used to have a bit more lua knowledge last year after you guys showed me how to set up a P2 control and custom entity....

Diarandor

  • Hero Member
  • *****
  • Posts: 1026
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: New rain script
« Reply #19 on: January 07, 2018, 06:27:01 pm »
@yankscally: You can put it above of your script "game_manager.lua". Make sure that the "require" line is called once, or the weather scripts will not work. Just study the scripts of CoS to understand how it works.

More important: make sure that the events that are registered in the weather scripts (with the multievents script) are also registered with the multievents script in your other scripts (in case they are defined); otherwise your definitions will override mine and the weather scripts will break and give you an error. (Two people had this problem before, so I should probably explain this better in the comments of the weather scripts in a future version.)

@froggy77: I like a lot your falling-leaves effects! ;D
« Last Edit: January 07, 2018, 06:29:26 pm by Diarandor »
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”