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 - gmanplays@gmail.com

#1
Your scripts / Re: Generate map images
September 22, 2019, 01:22:14 AM
Whoa, this is mind blowing
#2
Hey guys, sorry for a late response; I've been busy lately.

So I finally figured out how to import assets, and I've promptly imported the small key scripts, but I couldn't find the .png files OR the sprite files for those various items in the Children of Solarus github. I therefore found third-hand pngs and dropped those into their proper file destination. Upon doing so, I booted the quest editor to go and press the "Add to quest" button, but when I right clicked on each png, there wasn't one. I booted the quest, and I got the same error message:

Error: In create_door: bad argument #1 to ? (Bad field 'opening_condition' (equipment item 'dungeons/small_key' is not saved))

What might be going wrong now that I've imported those scripts?

IMPORTANT ADDENDUM: I've tested one of locked doors by setting their unlock condition to rupees instead of keys, and I get the very same error message, except with rupees not being saved instead of small keys. Given this, I think that it'd be more important for me to learn how to get my quest to save the states of these items. I've double-checked both scripts, and I found the line
item:on_obtaining(variant, savegame_variable) in both. Is this supposed to save the items?
#3
So I don't see the option to add these items to the quest; nor can I import them from another quest. Should I go back to the CoS github and download the entire thing so I can import it from there?
#4
So I added an animation for it now, checked the file and saw the new .dat file, double checked for naming, and then ran the quest, but no changes in the exception changed. I required the key sprite, but it said that the file still didn't exist? I don't know how to tell the engine that this sprite exists any better than I already am. Any ideas?
#5
I've printed the diagnostic you suggested, and it returned false. However, in on_created, I can't find any method looking for that sprite either. Other than that, it stopped generating that exception for some reason and replaced it with the In create_door exception upon booting the project. This is just so bizzare, I don't know where to even start. Also, where's the script the governs doors? I can't find it in the entities directory.

Anyway's here's the script for the small keys I'm using. Thanks again for all your help.

local item = ...


function item:on_created()
  require("scripts/equipment")
  self:set_shadow("small")
  self:set_brandish_when_picked(false)
  self:set_sound_when_picked("picked_small_key")
end

function item:on_obtaining(variant, savegame_variable)

  self:get_game():add_small_key()
end
#6
That sprite already exists in that directory, correctly named, and in the correct directory though.
#7
Hey again,

So I'm starting to near the end of my first dungeon, but just when I thought it was safe to move on, all of my locked doors broke (they no longer load in the game as an entity, as if they never existed), and what really confounds me is that a cutscene event I wrote that was working just fine before no longer works as well. Doors that are locked by switches are still functioning normally. There are multiple exceptions generated upon loading the game, none of which existed for most of the development process thus far. Below's an exhaustive list of those exceptions. If this has happened to you, I beg that you let me know what I need to go in and edit. Thanks much for your time.

1) Error: In on_created: items/dungeons/small_key.lua:6: module 'sprites/items/dungeons/small_key' not found:

2) Error: In create_door: bad argument #1 to ? (Bad field 'opening_condition' (equipment item 'dungeons/small_key' is not saved))

3) Error: In on_created: enemies/bosses/armos_knight.lua:18: attempt to call method 'set_arrow_reaction' (a nil value)

4) Error: In on_pickable_created: items/consumables/heart.lua:50: bad argument #1 to set_animation (Animation 'heart_falling' does not exist in sprite 'entities/items')

Important note: I have not tampered with any of the files pertaining to doors, pickables, or items. I have checked, and heart_falling & dungeons/small_key indeed exist and do so in their proper placement in the directory.
#8
There we go, now I got it forreal this time. Thanks everyone very much for their time.
#9
So I've tried whatcha suggested, but it seems like a whole new error arose even still, and I think it's because I'm putting what you suggested in the wrong place. I was also unclear whether or not the text property was supposed to draw the dialog on the screen or print that text in the console. What am I missing here? Where can I find the info you used to get this straight? Here's the script, do you see anything wrong with it? Oh, and just for context, it's generating an exception that says it's trying to index a global variable called "dialog" that's nil.

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

-- Event called at initialization time, as soon as this map is loaded.
function map:on_started()
  map.small_keys_savegame_variable = "Underwell"
  require("scripts/language_manager")
  require("debug_dialog.lua")
  require("scripts/menus/dialog_box")
  require("scripts/menus/alttp_dialog_box")
end

function sensor:on_activated()
  game:set_ability("sword", 1)
  hero:start_victory(hero:freeze())
  hero:set_direction(3)
  sol.audio.play_sound("treasure")
  sol.timer.start(1000,function()
    sol.audio.play_music("sanctuary", true)
    dialog{
      id = "sword.first",
      next = "sword.second",
      text = [[
      show this dialog first.
      ]]}
    dialog{
      id = "sword.second",
      text = [[
      Then show this dialog.
      ]]}
    sol.audio.stop_music()
    sol.audio.play_music("light_world_dungeon", true)
    hero:unfreeze()
  end)
end
#10
Wait, you can do that? I totally didn't think of that. I should probably start being more creative with the API reference info, huh? Anyways, thank you much.

--EDIT: It appears that when I put the second start_dialog command in the callback, it just skips the first dialog. Odd.
#11
Hey again,

I've been playing around with the dialog scripts from Children of Solarus, in particular debug_dialog, dialog_box, and language_manager (I think that's right..?). However, upon inspection I can't figure out how to index the dialog ids I need to in order to start the loop, which I think is the function that'll let me rattle off multiple dialog boxes without generating the "dialog already active" exception. Maybe I've skimmed over some comment that gives instructions on that matter, but upon close inspection I don't think I have. I've also referenced back to the original tutorials, but those didn't help because all of the dialog boxes shown there are separated by input, whereas I just need to show two consecutive dialog boxes. Here's a link to each of those scripts, I was hoping I could reference the experience of someone who's already figured it out though.

dialog_box.lua: https://github.com/solarus-games/children-of-solarus/blob/dev/data/scripts/menus/dialog_box.lua
debug_dialog.lua: https://github.com/solarus-games/children-of-solarus/blob/dev/data/scripts/debug_dialogs.lua
language_manager.lua: https://github.com/solarus-games/children-of-solarus/blob/dev/data/scripts/language_manager.lua

Hope I don't waste anybody's time. Thanks much for reading.
#12
Bugs & Feature requests / Re: Cut Vines
March 04, 2019, 06:44:07 AM
See, that's why I come here. I would've never thought to use another type of enemy because of my association of (practically) inanimate vines with the inanimate hammer pegs. No, there wasn't I was just making an effort. Thanks for giving me the perspective, and I'll make sure to color-code next time.
#13
Bugs & Feature requests / Cut Vines
March 04, 2019, 12:48:11 AM
Hey again,

So I've been making significant progress in the development of my little project, but I've been caught up in yet another snag that's going to have to be straightened out before I move on. That said, the snag involves an entity script (largely based on/rips off the hammer peg script) which is supposed to first make sure the vine entity (32x32px) is not traversable, then test if the hero is there (I think? It was a part of the hammer peg script), then see if player has obtained a sword (As it's the dungeon item) and then to see if the player is using the sword by testing for the animation "sword1". Then, if the player is calling that animation, then test whether or not the sword is within [arbitrary amount of pixels yet to be established, but 32 for now]. If it is, set the animation to "cut_vines".

When I run the script, I get no exception message, which is awfully confusing seeing as the vines aren't being cut. If you can see how I'm being lua-illiterate, I'd be more than obliged. Thanks much again for your time.

-- Lua script of custom entity vines.
-- This script is executed every time a custom entity with this model is created.

-- Feel free to modify the code below.
-- You can add more events and remove the ones you don't need.

-- See the Solarus Lua API documentation for the full specification
-- of types, events and methods:
-- http://www.solarus-games.org/doc/latest

local vines = ...
local game = vines:get_game()
local map = game:get_map()
-- Event called when the custom entity is initialized.

function vines:on_created()
  vines:set_traversable_by(false)
  -- Initially, the vines are an obstacle for any entity.

local function test_collision_with_hero_sword(sword, entity)

  if entity:get_type() ~= "hero" then
    --If it's not the hero, don't heck with it
    return false
  end
  if game:has_item("equipment/sword") ~= true then
    -- If he doesn't have the sword, heck him
    return false
  end
    if hero:get_animation() ~= "sword1" then
    -- Don't bother testing collisions if the hero is not currently swinging his sword
    return false
  end

  -- The hero is using the sword. Determine the exact point to test.
  local hero_direction = entity:get_direction()
  local x, y = entity:get_center_position()
  if hero_direction == 0 then
    -- Right.
    x = x + 32
  elseif hero_direction == 1 then
    -- Up.
    y = y - 32
  elseif hero_direction == 2 then
    -- Left.
    x = x - 32
  else
    -- Down.
    y = y + 32
  end

  -- Test if this point is inside the vines.
  return vines:overlaps(x, y)
end

vines:add_collision_test(test_collision_with_hero_sword, function(vines, entity)

  --change animation to broken
  vines:get_sprite():set_animation("cut_vines")

-- Allow entities to traverse this.
  vines:set_traversable_by(true)

  -- Disable collision detection, this is no longer needed.
  vines:clear_collision_tests()

  -- Notify people.
  if vines.on_cut ~= nil then
    vines:on_cut()
  end
end)
end
#14
Oh jesus, you can search for specific terms on Github? God, I wish I was more observant. Thanks much my guy.
#15
Hey again,

    Firstly I'd like to thank everyone on the server for being so helpful whenever I come with an amateurish problem I don't know how to solve. Really lively community around here and I genuinely appreciate the help. Anyways, moving on.
I've recently been studying up via the Tutorials, and I started using some of the resources provided there, in one instance in particular: In the episode covering the hud, in the description lies a link to some scripts used in Oni-Link Begins, which I promptly downloaded and installed, as an easy solution to a problem that I've spent more than two days on. However, when I ran it, I got one exception from each the key item script, and the key hud script, respectively. From what the error entailed, it looks like the engine doesn't seem to be recognizing any method that includes keys as a non-nil value. I checked the documentation, and I couldn't find any of those methods myself either, which indicates to me that there must be another script which defines those methods. I proceeded to sift through the directory where I got those scripts, looking for any code that mentions "keys", other than the ones I found and installed already.

Here's the exceptions:

1) Error: In on_started: scripts/hud/small_key.lua:19: attempt to call method 'are_small_keys_enabled' (a nil value)
2) Error: In on_obtaining: items/consumables/small_key.lua:12: attempt to call method 'add_small_key' (a nil value)

If anyone could help me sort out defining those methods, I'd be much obliged. Thanks much for your time.