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

Pages: [1] 2 3 ... 5
1
Development / Re: Editing the HUD - Action Button Icon always shows up
« on: April 29, 2020, 08:46:50 pm »
an easy solution i can think of to your HUD issue would be to draw the action button sprite that you want to be always there seperate to the words you want to show up, then just make your words pop up with no background.
the pause button never showing, you could just not draw it? you can do that in scripts/hud_config, in that same script you could add your extra "fake action" sprite, in the same location as the action sprite you already have. your magic_bar should be in the same script aswell...if its not then try adding it?

Code: [Select]
  -- Magic bar.
  {
    menu_script = "scripts/hud/magic_bar",
    x = -90,
    y = 27,
  },

that will show the magic bar, delete the bit that says Pause icon and that should never appear

2
Development / Re: how do you save a number?
« on: March 31, 2020, 06:14:36 pm »
that didn't seem to work either, I've only seen this about 5 mins ago though and only tried a couple of attempts, heres a much shorter version of what im trying to do, thanks for all the help from both of you by the way, its much appreciated. didn't want either of you to think id ignored your replies, for the moment i just made a new function called check_win() and call that whenever its needed and just save to that instance, seems to work. Wasnt that much work but would be if i had numbers for all possible numbers from 1-?...and not just from 6-10 (atm)

Code: [Select]
function man:on_interaction()
  local max_num = 6
  local min_num = 10
  local size = math.random(min_num, max_num)
  if size > 0 then
    win = tonumber(game:get_value(size))
    sol.timer.start(100, function()
      print(size)
      print(win)
    end)
  end
end

this gives the same errror about not being able to be a number:
: bad argument #2 to get_value (Invalid savegame variable '8': the name should only contain alphanumeric characters or '_' and cannot start with a digit)

and with -
    win = tonumber(game:get_value("size"))
it is just nil

If i'm not doing something correctly its because i don't actually know what is correct. and ive never been taught anything. I learn better watching and deconstructing things and i havent found anything that works like this, not that ive been able to read and understand anyway. So ive been writing things to just work...then when ive learnt more ive gone back and rewritten things

3
Development / Re: how do you save a number?
« on: March 30, 2020, 05:32:42 am »
yeah ive read that and i understand how to save something. but i wanted to make it a number...which im assuming you cant do then? Because this is the error doing that brings. (9 was the number that was randomly generated to become win)

Code: [Select]
Error: In timer callback: maps/Fishing.lua:138: bad argument #2 to set_value (Invalid savegame variable '9': the name should only contain alphanumeric characters or '_' and cannot start with a digit)

Code: [Select]
      game:start_dialog("fisherman.young.talk.weight.woah", size, function()
            win = size print(win, "=", size)
            sol.timer.start(01, function()
              sol.audio.play_sound("oot/fanfare/item")
              hero:start_treasure("heart_piece", 1)
              game:set_value("hylia_fish_young", true)
              size = 0
 138       win = game:get_value(win)
              game:set_hud_enabled(true)
              game:set_pause_allowed(true)
            end)
          end)

i get that i can use loads of:
if win = 1 then
  game:set_value("win_is_one", true)
elseif win = 2 then
  game:set_value("win_is_two", true)
etc...

and then to call them its:

if game:get_value("win_is_one") then
  game:start_dialog("fisherman.open.won.win_is_one", win, function()
  end)
elseif game:get_value("win_is_two") then
  game:start_dialog("fisherman.open.won.win_is_two", win, function()
  end)
etc...

but i didnt want to have to write out dialogs for each condition and script for each condition. thought it would be easier to just call $v in the dialog and have that be win:
game:start_dialog("fisherman.open.won", win, function()
end)

which works initially, and then continues to work when walking inbetween maps and carrying on with the game, but as soon as the game is saved and reloaded the values are nil again.

4
Development / Re: how do you save a number?
« on: March 30, 2020, 04:16:53 am »
hmmm...that didnt work, not the way im trying things anyway. i dont get how that is saved tbh.

the size is obtained by the fish. i catch a fish and it randomly generates a weight (size) based on its species, i need that size to then become a saved value (which i have called win) and then the size can just reset...but the number will be saved as win. the value of win can be changed at any time...well anytime the player catches a "heavier" fish.

so if the size > 6 then nothing really happens
but if the size is greater than 6 then size value (anything above 6) becomes the win value...which is saved forever and then the size is discarded as normal.

i have never used game:save() before i only tried it because you suggested it, i would usually use game:set_value("", true). but thanks. I was going to look into an "autosave" function at some point.

I write this assuming you understood all this already, and it is me who isn't understanding the reply you gave lol. I keep trying different things though and im not getting much success

5
Development / Re: how do you save a number?
« on: March 30, 2020, 02:44:35 am »
yeah ive got prints for when the map starts to tell me the values, it says 8 for example if i go in and out the map but back to 0 if the game is reloaded...the game is saved but the value of win isnt. I have no idea how to save it is the problem. the lines "game:save(win)" were added after i read this but still didnt save the value...but the print said it did.

Heres the full code, the part which needs win saving is seperated below aswell.

Code: [Select]
function fisherman:on_interaction()
  hero:set_animation("stopped")
  if size == nil then
    size = 0
  else
  end
  if fisherman_talk == nil then
    fisherman_talk = 0
  else
  end
  if win == nil then
    win = 0
  else
  end
  game:set_hud_enabled(false)
  game:set_pause_allowed(false)
  if game_is_active then print("game_is_active", game_is_active)  ------------------ if the game is active
    print(size)
    game:start_dialog("fisherman.young.talk", function(answer)
      if answer == 1 then -- weigh fish
        if game:get_value("hylia_fish_young") then print("hylia_fish_young", hylia_fish_young)
          if size == 0 then
            game:start_dialog("fisherman.young.talk.weight.no_fish", function()
              game:set_hud_enabled(true)
              game:set_pause_allowed(true)
            end)
          elseif size > 0 and size < win then
            game:start_dialog("fisherman.young.talk.weight.small", size, function()
              game:set_hud_enabled(true)
              game:set_pause_allowed(true)
            end)
          else
            game:start_dialog("fisherman.young.talk.weight.woah", size, function()
              if size > win then
                game:set_hud_enabled(true)
                game:set_pause_allowed(true)
                win = size print(win, "=", scale)
                game:save(win) print("save win", win)
                local win = size print("local", win, "=", scale)
                sol.timer.start(01, function()
                  size = 0
                end)
              else
                game:set_hud_enabled(true)
                game:set_pause_allowed(true)
              end
            end)
          end
        elseif size == 0 then  print("size", size, "win", win)
          game:start_dialog("fisherman.young.talk.weight.no_fish", function()
            game:set_hud_enabled(true)
            game:set_pause_allowed(true)
          end)
        elseif size > 0 and size < 6 then
          game:start_dialog("fisherman.young.talk.weight.small", size, function()
            game:set_hud_enabled(true)
            game:set_pause_allowed(true)
          end)
        else
          game:start_dialog("fisherman.young.talk.weight.woah", size, function()
            win = size print(win, "=", scale)
            game:save(win) print("save win", win)
            local win = size print("local", win, "=", scale)
            sol.timer.start(01, function()
              sol.audio.play_sound("oot/fanfare/item")
              hero:start_treasure("heart_piece", 1)
              game:set_value("hylia_fish_young", true)
              size = 0
              game:set_hud_enabled(true)
              game:set_pause_allowed(true)
            end)
          end)
        end
      else  -- other
        game:start_dialog("fisherman.young.talk.other", function(answer)
          if answer == 1 then  -- talk to fisherman
            if fisherman_talk == 0 then print(fisherman_talk)
              fisherman_talk = 1 print(fisherman_talk)
              game:start_dialog("fisherman.young.talk.talk1", function()
                game:set_hud_enabled(true)
                game:set_pause_allowed(true)
              end)
            elseif fisherman_talk == 1 then
              fisherman_talk = 2 print(fisherman_talk)
              game:start_dialog("fisherman.young.talk.talk2", function()
                game:set_hud_enabled(true)
                game:set_pause_allowed(true)
              end)
            elseif fisherman_talk == 2 then
              fisherman_talk = 0 print(fisherman_talk)
              game:start_dialog("fisherman.young.talk.talk3", function()
                game:set_hud_enabled(true)
                game:set_pause_allowed(true)
              end)
            end
          else  -- exit fishing "game"
            game:set_hud_enabled(true)
            game:set_pause_allowed(true)
            game_is_active = false
          end
        end)
      end
    end)
  else print("game_is_active", game_is_active)  ------------------ if the game is NOT active
    game:start_dialog("fisherman.young.open", function(answer)
      if answer == 1 then -- Yes would like to play
        if game:get_money() < 20 then
          game:start_dialog("_shop.not_enough_money", function()
            game:set_hud_enabled(true)
            game:set_pause_allowed(true)
          end)
        else
          game:remove_money(20)
          phase_1()
        end
      else -- No wouldn't like to play
        game:start_dialog("fisherman.young.open.no", function()
          game:set_hud_enabled(true)
          game:set_pause_allowed(true)
        end)
      end
    end)
  end
end

more specifically this part, this is the "winning" function.
Code: [Select]
        else
          game:start_dialog("fisherman.young.talk.weight.woah", size, function()
            win = size print(win, "=", size)
            game:save(win) print("save win", win)
            local win = size print("local", win, "=", size)
            sol.timer.start(01, function()
              sol.audio.play_sound("oot/fanfare/item")
              hero:start_treasure("heart_piece", 1)
              game:set_value("hylia_fish_young", true)
              size = 0
              game:set_hud_enabled(true)
              game:set_pause_allowed(true)
            end)
          end)
        end

6
Development / Re: does anyone know what this means?
« on: March 29, 2020, 07:21:13 pm »
would't know how to test it mate, the link above gives a 403 Forbidden error, I ended up just opening all png's with ImageMagick and saving them.....didn't take toooooooo long. only a few thousand files lmao.

if you tell me how to use it ill test it for you

7
Development / how do you save a number?
« on: 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:

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

8
Development / Re: does anyone know what this means?
« on: March 18, 2020, 09:07:15 pm »
sweet man cheers for the info, I wasn't able to download imagemagick i think the site is down so i tried just making a new blank sheet and copying the sprites over and overwriting it...it worked. was a png i had as an overlay the "map name" png i have pop up on start. which is why it wasnt happening on any of the other maps with the same tileset ect.

my project isnt online anywhere atm ive been looking into how to do it, made a github account today so it might be up soon

9
Development / does anyone know what this means?
« on: March 17, 2020, 05:45:06 pm »
When i close the game on certain maps, this pops up...

Code: [Select]
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: cHRM chunk does not match sRGB

does anyone know what it means?

10
Development / how to make a 'code/password'
« on: 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?

11
Development / Re: Text box appearing when getting an item
« on: September 12, 2019, 04:11:58 am »
i dont know what you're doing but you shouldn't have to do anything like this, where have you started from? id suggest redownloading solarus and the resource pack if thats what you are using

12
Development / Re: Text box appearing when getting an item
« on: September 12, 2019, 12:53:47 am »
have you tried with an npc? the text for the save and quit is most probably a menu not a dialog so thats why that would still show.

make an npc and set it to speak...see if that brings an error

13
Development / Re: Text box appearing when getting an item
« on: September 09, 2019, 11:51:37 am »
do you get an error when you open the chest?

what does your main.lua look like? paste it after clicking the hashtag icon "insert code" button. (12th button 2nd row)

in the quest editor when you click on languages there will be an "en"...right click that and "open dialogs" to get to the dialog editor and if you havent got a dialog for that item..the rest are under _treasure.sword.1, _treasure.shield.1, ect...

14
Development / Re: :on_interaction_item(item_used)
« on: September 09, 2019, 11:37:15 am »
Cheers bro I totally get what you're saying.

I did try a variation of this but i never got the "game:get_item("boomerang")" part of it.

what you wrote makes perfect sense thought and I've used that so many times on other things, nice explanation for anyone else that gets stuck on something like this.

and...yes those last 2 lines are indeed what i needed. thanks :)

15
Development / Re: :on_interaction_item(item_used)
« on: September 06, 2019, 08:09:47 pm »
so...

Code: [Select]
function npc_1:on_interaction_item(item_used)
  if item_used == boomerang then
    sol.audio.play_sound("secret")
  end
end

i just tried that and that doesn't work either....

Pages: [1] 2 3 ... 5