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

Topics - ponderitus

#1
Development / how do you save a number?
March 29, 2020, 11:21:12 AM
I've made a little script/ fishing game where your fish wins you prizes...everything works fine until i save and reopen the file...its basically:

if size <= 6 then
blah
elseif size >
win = size
size reset to 0

and then theres a seperate npc with a dialog stating the win number:-

game:start_dialog("fisherman.young.talk.weight.tank", win, function()


now if i move maps and come back in it all works fine...but if i save the game and return...the value of "win" is set back to nil, how do i get the value of win to save?

or do i need to make save variables for each outcome..ie

if win = 1 then
game:set_value("win_is_1", true)
else if win 2 then.....


and then write out a dialog for each outcome?
#2
Development / does anyone know what this means?
March 17, 2020, 05:45:06 PM
When i close the game on certain maps, this pops up...


libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB


does anyone know what it means?
#3
Development / how to make a 'code/password'
September 21, 2019, 01:57:38 AM
Hey Guys, I was wondering how to make a sort of code or password, as in enemy must be killed in a certain order to open a door/make a chest appear..so that if they are killed in the right order then x will happen but if the wrong order then everything is reset....

where would i start with this?

so that (1,2,3) opens the door but all other variants eg, (3,2,1) (2,1,3) ect would reset?

literally stuck at the start with this one...

would i have to make a bunch of save variables for each on_killed? depending on which have been killed before it?
#4
Development / :on_interaction_item(item_used)
September 06, 2019, 05:35:02 PM
I was wondering if you can make this item specific? it seems to activate if any item is used..eg.

function custom_sensor_1:on_interaction_item(boomerang)
sol.audio.play_sound("secret")
end

function npc_1:on_interaction_item(boomerang)
sol.audio.play_sound("secret")
end


this would be activated if i used a bow or any item at all.

is there a different way to have something happen when an certain item is used in a specific place? maybe im looking in the wrong place?
#5
Development / Seach for an entity?
August 09, 2019, 11:13:20 AM
Hey, long time. I was working on an item the other day and wondered if there is a way to check for entities on the map on use..I was trying to make something that would freeze an enemy if it exists

ie.

function item:on_using()
  item:check_enemy()
  if entity type enemy then
    enemy:freeze()
    --function of item, function()
     enemy:unfreeze()
    end)
  else
    --function of item
  end
  self:set_finished()
end

function item:check_enemy()
--check map for enemies
end
#6
Development / stop_dialog
March 07, 2019, 09:28:28 PM
hey, how do you get a dialog box to close itself rather than having to have an action pressed? is this possible? Id only want to use this in "cutscenes" and such, not in regular interactions with npc's

eg
game:start_dialog("this_needs_interupting", function()
  sol.timer.start(map, 1000, function()
  game:stop_dialog()
  end)
end)


according to the documentation this is possible but i cant seem to make it work, would it also need a different function if the dialog was more than 3 lines? (not a problem to make things 3 lines if dialogs can be "auto closed")
#7
Development / combos...again
February 11, 2019, 09:10:11 AM
I've been thinking about combo's again like many other before and i was wondering whether its possible to have one item call another within a timer to kind of...pretend its a combo

eg... 'item A' on use
       create timer, if 'item A' used again within timer then
        use 'item B'

would this be possible?
is this a stupid way to do it?
is there a better way?
#8
Development / video mode
February 07, 2019, 09:51:14 AM
hey, i used to run this at the start of game set the video mode.
function sol.main:on_started()
-- Set Video Mode.
sol.video.set_mode("hq2x")


but now in 1.6 i get this :-
"Warning: The function sol.video.set_mode() is deprecated since Solarus 1.6. Use sol.video.set_shader() instead."

but when i change this :-
-- This function is called when Solarus starts.
function sol.main:on_started()
-- Set Video Mode.
sol.video.set_shader("hq2x")


i now get this :-
"Error: In on_started: main.lua:15: bad argument #2 to set_shader (shader or nil expected, got no value)
stack traceback:
[C]: at 0x01a54540
[C]: in function 'set_shader'
main.lua:15: in function <main.lua:13>"

I have the same issue in options_menu
      if self.cursor_position == 1 then
        -- Change the video mode.
        sol.video.switch_mode()
        self.video_mode_text:set_text(sol.video.get_mode())
      else


Warning: The function sol.video.switch_mode() is deprecated since Solarus 1.6. Use sol.video.set_shader() instead.
Warning: The function sol.video.get_mode() is deprecated since Solarus 1.6. Use sol.video.get_shader() instead.

but when i change that to :-
      if self.cursor_position == 1 then
        -- Change the video mode.
--        sol.video.switch_mode()
sol.video.set_shader()
    --    self.video_mode_text:set_text(sol.video.get_mode())
self.video_mode_text:set_text(sol.video.get_shader())
      else


i now get this error :-
"Error: In on_command_pressed: scripts/menus/pause_options.lua:229: bad argument #2 to set_shader (shader or nil expected, got no value)
stack traceback:
[C]: at 0x018d4540
[C]: in function 'set_shader'
scripts/menus/pause_options.lua:229: in function <scripts/menus/pause_options.lua:200>"

I looked at the scripts for the development games and on github and they have the same script in pause_options.
#9
Development / help with 1.6
February 06, 2019, 02:09:04 PM
Hey, I've been away for the longest time but the 1.6 update piqued my interest again. anyway i cant seem to get rid of this error message since updating, can anyone point me in the right path?
Info: Simulation started
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 0x018a4540
[C]: in function 'start'
scripts/hud/hud.lua:179: in function 'set_enabled'
scripts/hud/hud.lua:213: in function 'callback'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function <scripts/multi_events.lua:40>
(Thread 0x9f301c0)
Info: Simulation finished

#10
Development / entity sounds
May 13, 2017, 07:31:09 PM
Does anyone know where the code is which selects the sounds entities make? I want to change the noise the chest makes when opening, I know how to change it for a chest on a map (as below), but i wanted to change all the sounds from the Alttp ones, like I also want to change the noise a block makes when pushed and so on.

function chest:on_opened()
  sol.audio.play_sound("chest_small")
end
#11
Development / Script working part of the time
May 12, 2017, 06:16:53 PM
Hey, I've tried to make a simple npc script, but for some reason it only seems to work half the time....i can load the map and it will work....then literally close and re-open the console and it wont work anymore...then next time it might. It seems like it works about 20% of the time, can anyone tell me the reason for this? Just trying to make her walk at the 1st time on the map up to her point she will be at for the rest of the game and freeze the hero until she is there and has spoken her initial dialog, its the interaction bit at the end which seems to be failing i should mention

Code ( lua) Select

local map = ...
local game = map:get_game()
local hero = map:get_hero()

if game:get_value("open_walk") then
  girl:set_visible(true)
  fake_girl:set_visible(false)
  else
  girl:set_visible(false)
  fake_girl:set_visible(true)

local npc_movement_2 = sol.movement.create("target")
  npc_movement_2:set_speed(64)
--  npc_movement_2:set_smooth(true)
  npc_movement_2:set_ignore_obstacles(true)
  npc_movement_2:set_target(girl)
  npc_movement_2:set_ignore_obstacles(true)
  npc_movement_2:start(fake_girl, function()
  girl:set_visible(true)
  fake_girl:set_visible(false)
  game:start_dialog("girl.down_here")
  game:set_value("open_walk", true)
end)
end

function girl:on_interaction()
    game:start_dialog("girl.hello")
end


I also wanted to make the hero freeze on map start until this quest but I haven't been able to make that function yet, i know its hero:freeze() then hero:unfreeze()

I moved the end at line 24 to 29 and that seemed to help a little but it's still failing about 60% of the time
#12
Hi guys, I've been trying to make a sensor which on activated a dialog will load from an NPC who will then walk off and vanish, I've tried to make it a save game variable so that the sensor and the NPC are gone forever after this. I can't seem to get my NPC to disappear when the map reloads, I realize the below will make him disappear when the sensor is activated again (which is what it is doing). Can anyone show me how to make it do what I need it to do. I tried lots of things but I can't seem to get it to work

Code ( lua) Select

local meeting_quest_1 = false

function meeting_sensor:on_activated()
   if game:get_value("meeting_quest_1") then
   worker_npc:remove()
   else
      game:start_dialog("meeting.1")
      hero:freeze()
      local path_movement = sol.movement.create("path")
      path_movement:set_path({ 2, 2, 2, 2, 2, 1, 1, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0 })
      path_movement:set_ignore_obstacles(true)
      worker_npc:is_traversable()
      path_movement:set_speed(64)
      path_movement:start(worker_npc, function()
      worker_npc:remove()
      game:set_value("meeting_quest_1", true)
      hero:unfreeze() 
      end)
   end
end


I kept getting these errors when i tried to get it working outside the sensor:on_activated
Error: attempt to index global 'worker_npc' (a nil value)
Error: attempt to index global 'meeting_sensor' (a nil value)
but as those are names of entities on my map...isnt that enough to use them just as : worker_npc:remove() ?

as in
Code ( lua) Select

map:on_started(function()
if game:get_value("meeting_quest_1") then
worker_npc:remove()

#13
Development / [Solved] Trying to make an NPC dialog
April 26, 2017, 04:00:40 AM
does anyone know how to make a dialog where the npc will respond 4 ways based on whether i have neither item, 1 of the required items or both.

none     -   need both
sword  -   need shield
shield  -   need sword
both     -   have both!

ive been able to get it so that if i have neither and then one item it works. but when i try to get both, or either, i either cant get it to work or i get 2 dialogs trying to play at the same time (need this and need both)

ive tried setting things like below, but after this i dont know where im going, or if this even right to begin with
Code ( lua) Select

local shield_search_quest_started = false
local sword_search_quest_started = false
local items_search_quest_started = false

  local has_sword = game:has_item("sword")
  if has_sword then
  game:set_value("sword_search_quest_started", true)
  end

  local has_shield = game:has_item("shield")
  if has_shield then
  game:set_value("shield_search_quest_started", true)
  end

  local has_both = game:has_item("shield" and "sword")
  if has_both then
  game:set_value("items_search_quest_started", true)
  end

-- Guy3
function Guy3:on_interaction()

if game:get_value("sword_search_quest_started") then
    game:start_dialog("Guy3.has_sword")
    else
         game:start_dialog("Guy3.search")
  end
end

-- the other 2 dialogs would be
-- "Guy3.has_shield"
-- "Guy3.found"


If anyone can help I'd appreciate it
#14
Development / [Solved] Item icons
April 06, 2017, 06:30:45 AM
In languages when making a new dialog for an item, you have the properties section. Where are the icons kept/what determines what makes icon 2 a bow for example? I changed the entities/icons.png but still the old zelda icon comes up when the dialog is showing.
#15
Development / get_variant in inventory
March 16, 2017, 02:25:51 AM
Im making changes to my inventory names table and i was wondering whether it is possible to call a variant of an item from there? Could i call tunic variant 1 from there so i can also call variant 2/3 to be able to change tunic on pressed? Or would i have to just make 3 seperate tunic items? I know making the 3 seperate tunics would be easier.

Everything i have tried so far has resulted in errors
#16
Development / Inventory
March 03, 2017, 09:00:17 PM
Can anyone explain how to get a pause menu (inventory and such) to work?

I'm only trying to get the one that Christopho uses in his French tutorial, I cant understand French so I'm just following what he does on his screen. I would be happy with the ALTTP inventory. I just need something which will enable me to switch between items.

Any help is greatly appreciated.
#17
Development / [SOLVED] Help please? dialog and water
February 15, 2017, 03:02:28 AM
Could anyone help please I've got a couple issues since I've updated to 1.5.2

1. I can't get any dialog to load even though it is 100% there
Eg
Error: Missing treasure dialog '_treasure.flippers.1'

2. On collision with water (without flippers) the hero doesn't jump anymore he just drowns. He used on jump on collision with water (or lava)

Any help will be greatly appreciated