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

#1
I don't know how to link scripts... :/
#2
Thank you for the answer !

Here's the new error message
Error: In on_map_changed: scripts/multi_events.lua:39: callback must be a function!
stack traceback:
[C]: at 0x017de150
[C]: in function 'assert'
scripts/multi_events.lua:39: in function 'register_event'
scripts/fsa_effect.lua:210: in function 'setup_inside_lights'
scripts/fsa_effect.lua:225: in function 'on_map_changed'
scripts/effect_manager.lua:7: in function 'apply_effect'
scripts/effect_manager.lua:22: in function 'callback'
scripts/multi_events.lua:42: in function <scripts/multi_events.lua:41>
#3
This is the code for the light :

local light = ...
local game = light:get_game()
local map = light:get_map()
local light_mgr = require('scripts/lights/light_manager')

local radius = tonumber(light:get_property('radius')) or 120
local size = radius*2
local color_str = light:get_property('color') or '255,255,255'
local color = {color_str:match('(%d+),(%d+),(%d+)')}
for i,k in ipairs(color) do
  color[i] = k/256.0
end

local sqrt2radius = 1.41 * radius

light:set_can_traverse(true)

--set light properties
light.radius = radius
light.color = color
light.excluded_occs = {}
light.halo = tonumber(light:get_property('halo'))
local dir_str = light:get_property('direction')
if dir_str then
  light.direction = {dir_str:match('(-?%d+),(-?%d+)')}
  for i,k in ipairs(light.direction) do
    light.direction[i] = k*1
  end
end
light.cut = tonumber(light:get_property('cut'))
light.aperture = tonumber(light:get_property('aperture'))

local angle = light:get_property('angle')
if angle then
  light.aperture = math.cos((math.pi/180)* tonumber(angle))
end

local x,y = light:get_position()

local fire_dist = sol.shader.create('fire_dist')
local fire_sprite = light:get_sprite()
if fire_sprite then
  light:remove_sprite(fire_sprite)
  fire_sprite:set_shader(fire_dist)
end


-- Event called when the custom light is initialized.
function light:on_created()
  -- Initialize the properties of your custom light here,
  -- like the sprite, the size, and whether it can traverse other
  -- entities and be traversed by them.
  light_mgr:add_light(self,light:get_name())
  light:set_origin(radius,radius)
  local size8 = math.ceil(size/8)*8
  light:set_size(size8,size8)
end

function light:draw_visual(dst,drawable,x,y)
  local cx,cy = map:get_camera():get_position()
  drawable:draw(dst,x-cx,y-cy)
end

function light:get_topleft()
  local lx,ly,ll = self:get_position()
  return lx-radius,ly-radius,ll
end

function light:draw_light(dst, camera)

  --dont draw light if disabled
  if not self:is_enabled() then
    return
  end

  --dont draw light if outside of the camera
  camera:set_layer(self:get_layer()) --TODO verify if this is not a shitty idea
  if not camera:overlaps(self) then
    return
  end

  -- get the shadow_map for this light
  local shad_map = light_mgr:compute_light_shadow_map(light)

  --draw 1D shadow as additive shadows
  self:draw_visual(dst,shad_map, self:get_topleft())
end

function light:draw_disturb(dst)
  self:draw_visual(dst,fire_sprite,self:get_position())
end

function light:track_entity(ent,dx,dy,dl)
  ent:register_event("on_position_changed",function(ent,x,y,l)
    light:set_position(x+(dx or 0),y+(dy or 0), l+(dl or 0))
  end)
end


This is the one from "Le defi de Zeldo"
#4
Development / Strange problem with a "set_enabled()"
January 15, 2020, 09:39:33 PM
Hello ! I have a strange problem with my code. I want to enable my custom entitiy "light" after a timer, it works but I have an error message in the consol... I really don't understand what this is about

Here's the code :
local map = ...
local game = map:get_game()


-- Explode the door and Kimos enter the room
local function animation()
  sol.timer.start(4000, function()
    map:create_explosion({
      name = "ex",
      layer = 2,
      x = 160,
      y = 208})
    sol.audio.play_sound("explosion")
    light_door:set_enabled(true)
    door:set_enabled(false)
  end)
end


-- Event called at initialization time, as soon as this map is loaded.
function map:on_started()
  game:set_value("dark_room",true)
  light_door:set_enabled(false)

  game:set_hud_enabled(false)
  game:set_pause_allowed(false)
  hero:set_visible(false)
  animation()
end


And here's the error message :

Error: In on_enabled: scripts/multi_events.lua:41: attempt to call upvalue 'callback' (a boolean value)
stack traceback:
[C]: in function 'callback'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function <scripts/multi_events.lua:40>
[C]: in function 'set_enabled'
maps/cutscenes/intro_1.lua:14: in function <maps/cutscenes/intro_1.lua:7>


I know how to read error message but I don't understand why this happen only with my custom entity.. No probleme with the door:set_enabled(false)

Thank you
#5
Thank you for the answers
I actually make it work I don't know how but that's cool ^^
#6
Hello, I am searching where is the pause menu started in the scripts files of XD2 and how to launch it by myself ?
I'm currently trying to use the pause menu of XD2 with the some of the scripts of "Le defi de Zeldo". So I replaced the files for the menu and now, when I'm pausing the game, the game is paused but no menu are opening... Where do I need to say to the game where starting the pause menu ?

Thanks
#7
Development / Re: Error 1.5 -> 1.6
December 27, 2018, 12:36:27 PM
Okay, I will see what I can do

Thank you
#8
Development / Error 1.5 -> 1.6
December 27, 2018, 12:18:15 PM
Hello, I have error since I updated my quest to 1.6... I don't know why, maybe some function has changed ? What I need to do

Error: bad argument #1 to sol.timer.start (game, item, map, entity, menu or sol.main expected, got table), will use a default context instead
stack traceback:
[C]: at 0x017e4540
[C]: in function 'start'
scripts/hud/hearts.lua:93: in function 'check'
scripts/hud/hearts.lua:158: in function 'new'
scripts/menus/savegames.lua:347: in function 'read_savegames'
scripts/menus/savegames.lua:51: in function <scripts/menus/savegames.lua:9>
[C]: in function 'start'
main.lua:53: in function <main.lua:50>
[C]: in function 'stop'
scripts/menus/title.lua:345: in function 'skip_menu'
scripts/menus/title.lua:218: in function <scripts/menus/title.lua:217>
(Thread 0xefc01c0)


Thank for the help
#9
Development / Re: solarus-run.exe icon
March 08, 2018, 01:38:05 AM
Sorry but I'm going to speak French.


J'ai pas mal regarder dans le github de solarus par moi même. Pour changer l'icone lors de la compilation il me suffirait de changer le "default_icon.png" (gui/ressources/images) avant de recompiler ?
J'ai une autre question : c'est le gitub de la 1.6, non ? -> Je ne vais pas avoir des problème à cause de ça après ?
Merci d'avance
#10
Development / Re: solarus-run.exe icon
March 07, 2018, 08:41:48 PM
Ok thanks for the answer. The idea of the shorcut is not what I am wanted.

So what is the esiest way to recompile it? With what compiler (code blocks)? I'am a total beginner, do you think I can do it?
#11
Development / solarus-run.exe icon
March 07, 2018, 08:19:01 PM
Hello, I don't know how to change the .exe icon. I have already done the pics with all the needed size but I don't know how to set it to the .exe which launch the game directly.
Thank to help me  :)
#12
Development / Re: Convert US colour to PAL
February 21, 2018, 10:04:58 PM
Thank you so much ! This is exactly the type of answer I wanted !
#13
Development / Convert US colour to PAL
February 20, 2018, 11:45:02 AM
Hello I'm using a Pal version of the big Hyrule tileset availible on the forum, but the entities are still in the US colour, how can I fix that ?

Thank you
#14
Development / Compile for RETROPIE ?
January 09, 2018, 08:09:21 PM
Hello there,
I have already all setup on my raspberry pi 3 to create a solarus console with retropie. All work, I mean there are the main project which work pretty well. As mentioned here https://github.com/RetroPie/RetroPie-Setup/wiki/Solarus I can add my own game. BUT, how can I do that? I developed my game on windows with solarus 1.5.3. I have my "data.solarus" and now... What do I am supposed to do with all this?

Thanks for your help!  :)
#15
Development / Re: Save file ?
November 24, 2017, 09:22:13 AM
Okay thank for the answer  :)
But I think I will bring my computer to school, it will be easier than ask someone to create the file from an administrator session... Moreover, I'm not sure than the problem come from there.
I mean when I run the game the console show:

Info: Solarus 1.5.3
Info: Opening quest 'C:/Users/--my_name--.TLPU090/Desktop/solarus'


And stop here, but I don't really know what happened