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

Pages: [1] 2 3 ... 49
1
Development / Re: Zelda Roth Reproduced Intro Help
« on: Today at 11:09:12 am »
Thanks.

Ok, the error is exactly in line:
Code: Lua
  1. frescos[i]:set_xy(0, 16)
which means that
Code: [Select]
frescos[i] is nil, or in other words, your image has not been created in the previous line:
Code: Lua
  1. frescos[i] = sol.surface.create("menus/intro/intro" .. i .. ".png")
which in turn means that the id of the image (this one: "menus/intro/intro" .. i .. ".png") is not correct.
(The image has not been created by the engine since that file does not exist; there is something wrong in that string.)

2
Development / Re: Zelda Roth Reproduced Intro Help
« on: Today at 09:56:57 am »
The error is in line 33 of your script (could you post the code of all the script?).
It says that you are trying to index (access an attribute) of a nil variable (the variable has nothing attached so you cannot access the attribute and hence you get an error; you need a list to access an attribute).

3
Development / Re: Jump movement direction4 error?
« on: June 24, 2017, 08:16:57 am »
I found the problem. The problem is that the facing direction will not change because function entity:on_movement_changed() is inside the function entity:on_created().
It is good to see that there is no engine bug this time and all is fixed. (The less bugs it has, the sooner we will have new features added by Chris.  ;D) Yes, we should close the github issue.

4
Development / Re: Jump movement direction4 error?
« on: June 24, 2017, 06:09:37 am »
Sorry for my arrogance before, but I am under too much stress these days.
I have now tried the script directly (I didn't before, I had only read the code).

After "cleaning" the code a bit, it works, so I confirm that there is no bug (unless someone can prove that I am wrong  :P).
The problem is just that the script is not well coded, in the following parts:

I tested it with a custom_entity script. There is a line of code missing since "metatable_entity" is not defined, but I guess that it is
Code: Lua
  1. metatable_entity = ...

and in that case "metatable_entity" is not really a metatable in the formal sense (I think).

1) Your events on_interaction() and on_movement_changed() are not called the first time you create a jump, because they are defined inside your function "metatable_entity:jump". These events should be defined outside that function. Although the variable quick_movement is not defined outside the function "jump", you can still access the movement with entity:get_movement().

2) This part is really confusing and gives problems:
Code: Lua
  1.   sol.timer.start(450, function()
  2.  
  3.     function quick_movement:on_finished()
  4.       set_stop_aniamtion = true
  5.     end
  6.  
  7.     if set_stop_aniamtion == true then
  8.      sol.audio.play_sound(finish_jump_sound)
  9.                  self:get_sprite():set_animation(finish_animation) --finish_animation
  10.    return false
  11.     end
  12.  
  13.    return true
  14.   end)
  15.  
If your jump ends in less than 450 ms, the event quick_movement:on_finished() would never be called since it would be defined after the movement has ended. Actually you do not need a timer, and should probably write something like this instead of the above code:
Code: Lua
  1.     function quick_movement:on_finished()
  2.       sol.audio.play_sound(finish_jump_sound)
  3.       entity:get_sprite():set_animation(finish_animation)
  4.     end
  5.  

I can paste a copy of the modified script if you want. It works and the sprite of the custom entity is always facing the direction of the jump, which I believe is what you wanted (otherwise I did not understand your final purpose).

And I insist that having a clean code is more important that it may appear, not only for finding bugs, but also to make the code understandable to others who want to help you.

5
Development / Re: Jump movement direction4 error?
« on: June 23, 2017, 07:23:53 pm »
I cannot understand anything. You did not explain properly what you are doing and what is the problem. And there is too much unnecessary information in the explanations.

-The image does not help at all. We cannot even know which entity is the hero, or what you are doing.
-In your explanations I cannot understand "what" is facing "what". All is unclear.
-You should learn to debug properly before we get crazy with your code.

Try this function instead:
Code: Lua
  1.   function self:on_movement_changed()
  2.      print("Movement Direction: " .. quick_movement:get_direction4())
  3.      print("Entity Initial Direction: " .. self:get_direction())
  4.      self:set_direction(quick_movement:get_direction4())
  5.      print("Entity Final Direction: " .. self:get_direction())
  6.   end
  7.  

Now, tell us the printed values that you get in the console, and what really happens in the game when you test it.
(We need more information. But only the useful one.)
I have tested the function custom_entity:set_direction() and it works perfectly for me, at least with the main sprite, so I cannot find functions that work in a wrong way as you say.

If you can write a new script with the MINIMAL and SIMPLEST code necessary to reproduce the bug, that would help a lot.

6
Development / Re: Jump movement direction4 error?
« on: June 23, 2017, 05:42:19 pm »
I will try to find out what is the problem.

Anyway, some advices that you should take seriously into account to write better code:

1) This was already pointed out by MetalZelda but you did not change it:
Lines 121-136 of your "Entity Create Jump Method" and lines 174-189 of your "Entity Jump Method" can be shortened in a clearer way with only 2 lines:
Code: Lua
  1. self:set_direction((hero:get_direction() + 2) % 4)
  2. game:start_dialog(dialog)
  3.  
(You were repeating too much code unnecessarily.) If you don't understand the math, just ask.

2) This is just a matter of taste(not so important), but lines like:
Code: Lua
  1.   if speed == nil then
  2.     speed = 40
  3.   end
  4.  
can be also written (in a shorter way) like
Code: Lua
  1.   speed = speed or 40
  2.  
(Check the "or" and "and" operators in the Lua maual for more info.)

7
Development / Re: On_interaction error?
« on: June 23, 2017, 07:35:27 am »
I confirm the bug. Check the github issue for more info.

8
Development / Re: Jump movement direction4 error?
« on: June 23, 2017, 07:07:39 am »
Could you post the full code of each script again? (The newest version.)

Also, indicate the filename of each script above its code. Then, if you want to comment something about the code, you only need to give the script name and the line number. (Copy-pasting isolated pieces of code does not help at all!!!)

9
Game art & music / Re: Original art
« on: June 23, 2017, 04:15:45 am »
Ahoy there! Not much progress yet, but you may like this: the remastered "bow" animation for Eldran.
https://youtu.be/C7sos901PH8

A newer version will include the arrows in the shooting animation. Also, walking with the bow is a planned feature, so there will be new animations for Eldran stopped/walking while he is aiming with the bow.

10
Development / Re: Heart Fully Replenished - Help
« on: June 22, 2017, 12:22:53 am »
Hello! What would be the command to restore all life when you pick up a heart container? I know the logic but not the command = /

Ahoy there! There is not a single command to do that.
But if you already know the logic, you can easily do it.

You will find here the tools and commands that you may need:
http://www.solarus-games.org/doc/1.5/lua_api_game.html
The rest is just Lua, but I leave it as a programming exercise for you. ;)

PS: you can also find the code you need in any Solarus game made by Christopho.  :)

11
Game art & music / Re: Tilesets for Oni-Link Begins: Solarus Edition
« on: June 21, 2017, 09:47:09 pm »
Chris has confirmed that he has already uploaded a snapshot in the dev version 1.6 with the feature. :D

12
Game art & music / Re: Tilesets for Oni-Link Begins: Solarus Edition
« on: June 21, 2017, 05:23:37 pm »
Hi @ffomega! I inform you about these good news:

Check this: https://github.com/solarus-games/solarus-quest-editor/issues/171

Maxs1789 has already coded the feature to move several tile patterns simultaneously, selected by using a rectangle, in the tileset editor (and Chris will soon upload a snapshot with this feature for the dev version 1.6). This feature is very useful for two purposes:

1) Creation of art of new tilesets, including both the tileset and png images. (This is my case, because I may decide to relocate tile patterns during the art creation.)

2) Creation of huge tilesets (just like yours, @ffomega). In case you decide to move/relocate some group of tile patterns to other part of the image/tileset, this feature may save many hours (or even weeks) of your life!!!! So take this feature into account when you work with tilesets :)

13
Development / Re: [QUESTION] Traversable prickles?
« on: June 21, 2017, 04:58:16 pm »
Maybe using dynamic tiles metatable and apply bad ground if id = spikes

http://www.solarus-games.org/doc/latest/lua_api_dynamic_tile.html#lua_api_dynamic_tile_get_pattern_id

Since dynamic tiles are entities, you can redefine it's behavious on creation time

I agree with MetalZelda: this is probably one of the most elegant ways to code it. (Create normal tiles and replace them with custom entities immediately after their creation, which can be done from the tiles metatable.)

Note that you can allow the spike tiles to be resizable, but in this case you need the custom entity to create as many sprites as 16x16 rectangles you have in your spikes tile.

14
Development / Re: Item command held on item?
« on: June 21, 2017, 04:48:59 pm »
To make the hero controllable just call item:set_fiinished()

But, you might want to control the hero and having the item to work.

You can directly unfreeze the hero (which allows to control him) before calling item:set_finished(), which is probably what he needs. This is what I use for my "custom jump", which allows to control the hero during the jump. But don't forget to call item:set_finished() when you finish using the item! :)

15
Development / Re: [QUESTION] Traversable prickles?
« on: June 20, 2017, 01:09:02 pm »
This is another example of why we need more ground customization (allowing custom tiles, especially for bad grounds).

Pages: [1] 2 3 ... 49