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

#1
Development / [Solved]Hero state question
August 09, 2018, 11:47:50 PM
I was wondering if there was a way to set the hero's state? All I noticed in the documentation was hero:get_state().

Sometimes the hero gets stuck on a certain state in my scripts and something like the following would be useful.

Code ( lua) Select
hero:set_state("free")
#2
To begin with, this issue does not affect the game play at all and everything works. It is just an annoying warning.

I have this code on a different map.
Code ( lua) Select
  function slime:on_removed()
    bookcase:set_enabled(false)
  end


When I leave the map and go to a different map, I get a warning from the previous map: (I checked and "bookcase" does not exist on the new map.)
Error: In on_removed: [string "maps/chain_village/zark_house.lua"]:17: attempt to index global 'bookcase' (a nil value)

Please note: I did not remove the bookcase and it does the same thing when I tested it with a chest entity.

Code ( lua) Select
function slime:on_removed()   
    if not chest:is_open() then
      sol.audio.play_sound("secret")
    end
end


Error: In on_removed: [string "maps/chain_village/zark_house.lua"]:21: attempt to index global 'chest' (a nil value)


I get around the warning by using a save variable.

Code ( lua) Select
  function slime:on_removed()
    if not game:get_value("zark_house_enemy_defeated") == true then
      bookcase:set_enabled(false)
    end
   
    if not game:get_value("zark_house_enemy_defeated") == true then
      if not chest:is_open() then
        sol.audio.play_sound("secret")
      end
    end

    game:set_value("zark_house_enemy_defeated",true)
  end
#3
Version: Solarus 1.5.3
OS: Linux

This might be a bug?

I tried using door:on_opened(), but it seems to not be working. I double checked the name and everything. This function is called during an opening of a door, right?

Code ( lua) Select
function door_1:on_opened()
  print("opened door")
  hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
end


The same occurred with door:is_open(). The door is indeed open, but nothing happens.

Code ( lua) Select
 
sol.timer.start(1000, function()
  if door_1:is_open() == true then
    hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
  end
  return true
end)


The function door:is_opening() worked.

Code ( lua) Select
 
sol.timer.start(1000, function()
  if door_1:is_opening() == true then
    hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
  end
  return true
end)


#4
Development / [Solved]Pass multiple entities?
July 22, 2018, 01:14:15 AM
Would it be possible to pass more than one entity through a method?

For example,
Code ( lua) Select
entity:overlaps(entity)

Code ( lua) Select
map:get_entites("bomb"):overlaps(test)
#5
Development / [Solved]Bomb overlap assistance
July 21, 2018, 09:58:18 AM
Okay, I want an entity to be disabled when a bomb is placed on it. I am guessing that it is not working because the bomb is not created before the start of the map.
Code ( lua) Select
--bomb test
sol.timer.start(1000, function()
    if bomb_1:overlaps(test) then
      test:set_enabled(false)
    end
  return true  -- To call the timer again (with the same delay).
end)


Error: In on_started: [string "maps/soulia_forest/soulia_forest.lua"]:57: attempt to index local 'bomb_1' (a nil value)


#6
Development / [Solved]Timer problem
July 16, 2018, 12:00:52 AM
I have a problem with my script. The switches are suppose to reset after 5 seconds when they are all activated. They do reset, but the one second timer is already running through again and I cannot activate any switches for another 5 seconds.

Code ( lua) Select
function map:on_started()

  sol.timer.start(1000, function()
    if solid_1:is_activated() == true and solid_2:is_activated() == true and solid_3:is_activated() == true and solid_4:is_activated() == true then
      sol.timer.start(5000, function()
        solid_1:set_activated(false)
        solid_2:set_activated(false)
        solid_3:set_activated(false)
        solid_4:set_activated(false)
      end)
    end
    return true
  end)

end


#7
Game art & music / Project Heroine Sprites
July 11, 2018, 04:13:51 AM
I am showing off the sprites I mentioned in the Female Character Hairstyles topic. So far I got the front, back, and side views finished, but I still need to modify the sprites colors + make the other animations.

These sprites are based off of the Eldrina Sprite I made. Eldrina is a mod of Diarandor's Eldran v1.1 Sprite. This sprites project would not even exist if it was not for Diarandor and I am thankful for his amazing art that just keeps getting better.

Project Heroine Sprites: (Login to view)



For history purposes: Plexa

Update:

Sword animations in progress for 40+ sprites.

-----------
Finished:
-----------
-walking
-carrying
-carrying walking
-lifting
-pushing
-pulling
-grabbing
-plunging
-bubbles
-miscellaneous (Death & Hurt)
-jumping
-falling
-swimming
-sword loading

----------------
Progressing:
----------------
-sword tapping

-------
Next:
-------
-sword brandish
-sword tapping
-spin attack

--------------
Unfinished:
--------------
-sword brandish
-sword tapping
-spin attack


----------------
Might do:
----------------
-bow
-hookshot
-boomerang
-brandish
-victory
#8
General discussion / A funny thing about forums
July 04, 2018, 01:21:36 AM
A lot of messager services were discontinued, but a space for them still exist on forums. I found it odd that there is no option to just add the type of service one uses.

Discontinued:
AOL Instant Messenger (Discontinued (December 15, 2017)) Wiki
MSN Messenger (Discontinued, 2013) Wiki

Still Exist:
ICQ
YIM




#9
Bugs & Feature requests / Forum: Storage Full
July 03, 2018, 12:58:00 AM
The upload folder is full. Please try a smaller file and/or contact an administrator.

My file was 1.4 KB

Should we go through our attachments and free up storage?
#10
Game art & music / Gimp Script: deep-float-copy
July 03, 2018, 12:37:33 AM
Okay, I decided to put the deep-float-copy script in this section because it is related to Gimp. Feel free to move it.

The deep-float-copy script is something I found online, but it was broken for gimp 2.8, so I fixed it. Gimp still has not improved its layers as far as I know.

It is useful for copying link layers that are selected. Make sure to select the area of the linked layers or a few error messages will appear. The preview below shows the character being selected. Float Linked Layers (Copy) will instantly copy all the linked layers.

Install:
Linux: Put it in /home/YourName/.gimp-2.8/scripts
Other: https://en.wikibooks.org/wiki/GIMP/Installing_Plugins#Copying_the_plugin_to_the_GIMP_plugin_directory

Image Example + sneak peak:
Preview

Downloads:
Download (Login to download)
Alternative Download

#11
Solarus Website > Games > By the community > Tunics!

It seems the Tunics DokuWiki no longer exists, but it can still be seen on WaybackMachine.
https://web.archive.org/web/20171028100334/http://tunics.legofarmen.se:80/start
https://github.com/Legofarmen/tunics/tree/master/data
#12
Game art & music / Female character hairstyles
May 13, 2018, 07:24:22 AM
Hi everyone,

It has been awhile.

I am making a bunch of free female characters. I am wondering if I missed a major hair style?

Ponytail is covered by the way...just have not made the view points. Also, I aware that overlaying the styles can make new ones.




~Zefk
#13
General discussion / [Debug] Pokemon Original Games
June 18, 2017, 07:13:28 AM
I thought this video was interesting. It could help a game creator to think of ways to prevent bugs that pros made in the past.
https://youtu.be/VGlZu2hoAiE?t=92

In my opinion, key items will prevent these bugs from occurring for quests.
#14
General discussion / 19 transitions
May 18, 2017, 10:37:10 AM
I made many transitions in Gimp from scratch. I still have some tweaking to do, but I plan to have these 320x240 transitions setup as animations. Of course, I plan to have these as CC0, so they will be free for any usage.

What does everyone think? Did I miss any basic transition?

Gimp Playback Previews:





































#15
Development / [Solved]Screen vs entity position?
May 15, 2017, 01:51:17 PM
Is there a formula I could use to calculate screen image x,y coordinates to the entity position? For example, drawing an image at the hero. I am not sure that entity:get_position() is related to this because is not that position different than image x,y coordinates?
#16
Development / [Solved]Array in function?
May 15, 2017, 06:07:00 AM
I get the following error:
0] Error: Failed to load script 'scripts/lib/zefk_entity_lib.lua': [string "scripts/lib/zefk_entity_lib.lua"]:2093: '(' expected near '['

when trying this:

Code ( lua) Select
  function sprites[index]:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end


The following function will only work if I convert my array to a normal variable.

Code ( lua) Select
    sprites2 = sprites[2]
  function sprites2:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end


Is there a way around this because I'd like to on_animation_finish() without having a limit set. I do not want to do something like this:

Code ( lua) Select
   
sprites2 = sprites[2]
  function sprites2:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end

sprites1 = sprites[1]
  function sprites1:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end

sprites3 = sprites[3]
  function sprites3:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end

sprites4 = sprites[4]
  function sprites4:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end

sprites5 = sprites[5]
  function sprites5:on_animation_finished()
    sprites[index]:set_animation(end_anime)
    sol.audio.play_sound(end_sound)
  end
#17
I made the following two functions. The bug happens with my entity:jump function. It seems not to want to change the facing direction.

Code ( lua) Select
entity:jump_create() -- default jump sprite Eldran is created for this one.

and

Code ( lua) Select
entity:jump() -- no sprite set to be created

The direction does not change even though I set:

Code ( lua) Select
  function self:on_movement_changed()
     self:set_direction(quick_movement:get_direction4())   
  end


The problem only occurs if I do not manually create the sprite with script. (If I do not pick the sprite from the custom entity.)

Code ( lua) Select
   
  function self:on_created()
     sprite = self:create_sprite(sprite_directory) -- sprite_directory
  end

  function self:on_movement_changed()
     sprite:set_direction(quick_movement:get_direction4())   
  end


What makes no sense is I have other functions with identical code. For example, entity:wander() and entity:follow(). Both those functions use a sprite I picked from the custom entity and work perfectly.

I used "self:set_direction(quick_movement:get_direction4())" on both of those functions and they change direction correctly.

Code ( lua) Select
  function self:on_movement_changed()
     self:set_direction(quick_movement:get_direction4())   
  end


My only solution was to manually check.
Code ( lua) Select
if direction8 == 0 or direction8 == 1 then
    if self:get_direction() == 1 then -- up
      self:set_direction(0)
    end

    if self:get_direction() == 2 then -- left
      self:set_direction(0)
    end

    if self:get_direction() == 3 then -- down
      self:set_direction(0)   
    end

    if self:get_direction() == 0 then-- right
      self:set_direction(0)
    end
  end

  if direction8 == 2 or direction8 == 3  then
    if self:get_direction() == 1 then -- up
      self:set_direction(1)
    end

    if self:get_direction() == 2 then -- left
      self:set_direction(1)
    end

    if self:get_direction() == 3 then -- down
      self:set_direction(1)   
    end

    if self:get_direction() == 0 then-- right
      self:set_direction(1)
    end
  end

  if direction8 == 4 or direction8 == 6 then
    if self:get_direction() == 1 then -- up
      self:set_direction(2)
    end

    if self:get_direction() == 2 then -- left
      self:set_direction(2)
    end

    if self:get_direction() == 3 then -- down
      self:set_direction(2)   
    end

    if self:get_direction() == 0 then-- right
      self:set_direction(2)
    end
  end

  if direction8 == 6 or direction8 == 7 then
    if self:get_direction() == 1 then -- up
      self:set_direction(3)
    end

    if self:get_direction() == 2 then -- left
      self:set_direction(3)
    end

    if self:get_direction() == 3 then -- down
      self:set_direction(3)   
    end

    if self:get_direction() == 0 then-- right
      self:set_direction(3)
    end
  end

#18
Development / On_interaction error?
May 08, 2017, 12:08:12 PM
I did the following with a custom entity, but the dialog is still called (if I keep pressing the spacebar) when the entity is far away unless I move the hero. How can I fix this?

Edit: This is probably a bug. A quick solaution is to check the distance with on_interaction() Here

Code ( lua) Select
  function self:on_interaction()
    if hero:get_direction() == 0 then
      self:set_direction(2)
      map:get_game():start_dialog(dialog)
    end
    if hero:get_direction() == 1 then
      self:set_direction(3)
      map:get_game():start_dialog(dialog)
    end
    if hero:get_direction() == 2 then
      self:set_direction(0)
      map:get_game():start_dialog(dialog)
    end
    if hero:get_direction() == 3 then
      self:set_direction(1)
      map:get_game():start_dialog(dialog)
    end
  end


#19
Development / Debug.info with pcall question?
May 07, 2017, 06:31:01 AM
My problem is that I do not know how to pcall my function "Error()". Error() needs to be inside the entity:example() to work.

Lib.lua
Code ( lua) Select

local metatable_entity = sol.main.get_metatable("custom_entity")

function metatable_entity:example()
  Error()
end

function Error()
    local level_1 = debug.getinfo(1) --Error() is level 1
    local level_2 = debug.getinfo(2) --Name of function being called from is level 2
    local level_3 = debug.getinfo(3) -- Return from where ever the function was declared is level 3
    print ("-----------------------------------------------------------------------------------------------------------")
    print(level_3.short_src.." => "..level_1.name.. " was called by function [".. level_2.name.. "] at line " .. level_3.currentline)
    print ("-----------------------------------------------------------------------------------------------------------")
end


Entity script:

Code ( lua) Select

entity:example()


Output:

-----------------------------------------------------------------------------------------------------------
[string "entities/follower.lua"] => Error was called by function [example] at line 1
-----------------------------------------------------------------------------------------------------------
#20
Development / [Solved]pcall metatable?
May 05, 2017, 09:30:23 AM
How does a pcall or xpcall error message work with a metatable?
http://www.solarus-games.org/doc/latest/lua_api_main.html#lua_api_main_get_metatable