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

#661
You can also use the function "item:add_amount(amount)",
which should be equivalent to "item:add_amount(item:get_amount() + 1)".
#662
I don't know because I have never used the key-door system. But what MetalZelda says is surely the correct thing to do.
#663
Quote from: dpro_games on August 03, 2016, 01:38:46 AM
It does not work...
Where I need to add this ligne ?

local item = ...

function item:on_created()

  item:set_savegame_variable("small_key_save")
  self:set_amount_savegame_variable("small_key_save")
  item:set_shadow("small")
  item:set_can_disappear(false)
  item:set_brandish_when_picked(true)
  item:set_sound_when_picked("picked_small_key")

end


You should use a different variable for the amount, so you should not use the same variable for both things (the variable "small_key_save").
#664
I was wrong in what I said before:
"item:set_savegame_variable(savegame_variable)" is used for the possesion, not the amount. For the amount the engine uses:
"item:set_amount_savegame_variable(savegame_variable)"
#665
Yes. In that variable the engine saves the amount of keys you have.
You should take a look to the functions in the Lua API:
Code (Lua) Select
item:get_amount_savegame_variable()
item:set_amount_savegame_variable()

here
http://www.solarus-games.org/doc/1.5/lua_api_item.html#lua_api_item_methods

By the way, @Christopho: there is something wrong in the API, for the function "item:set_amount_savegame_variable()", where it says:
"Returns the name of the integer savegame value that stores the amount of this item."
I think that line should be removed, the last paragraph
"Return value (string): The savegame variable that should store the possessed amount of this item, or nil to make this item have no associated amount."
seems to be wrong too, and the function should appear as
"item:set_amount_savegame_variable(savegame_variable)",
if I am not wrong.

EDIT: whoops, I posted too late. You already read the API.
#666
Ok, I found the problem (I have never used a built-in door since I use my custom ones, so I did not know about this thing).

The problem is that the amount of keys you have has to be saved in some variable, and you have not indicated to the engine in which variable (this has to be done for any type of item, so you may get the same problem for other items you create).
You just need to add something like this
item:set_savegame_variable("id_for_the_amount_of_keys")
inside the function "item:on_created()".
(you can use there any string you want (so change the string to a shorter one if you want), and that variable will be used for all keys of your game).

You will have something like this:
function item:on_created()

  item:set_savegame_variable("id_for_the_amount_of_keys")   
  item:set_shadow("small")
  item:set_can_disappear(false)
  item:set_brandish_when_picked(true)
  item:set_sound_when_picked("picked_small_key")
end


You can now delete the previous link to your data in mediafire.

PS: you can also ask on the IRC chat whenever you want, and don't hesitate to ask if you have any problem. :)
#667
Nope, I was wrong, hehe, it is not in your map script, or at least not in this one.
Since you got this error:
Error: In create_door: bad argument #1 to ? (Bad field 'opening_condition' (equipment item 'small_key' is not saved))
we need to find the script where the function create_door is being used, because the error is happening there.
Does the error indicate in which file the error is it happening? (If so, that will be the script that we need to check.)

Edit: maybe the script we need is the script of another map, and not that one.
#668
Hi again. This is not the script I was asking for (but it may help too).
We need to see the script where the function "create_door" is defined (it's probably your map script).
#669
Pouvez-vous coller ici une copie de tout le code de votre script où la fonction "create_door" se trouve ? Ça nous aidera trouver le problème.
Translation: could you paste a copy here of all code of the script where the function "create_door" is defined? That will help us to find the problem.

PS: il serait mieux si vouz écrivez en anglais (si vous pouvez) parce que la plupart des gens d'ici ne parlent pas le français, et plus de gens pourrait vous aider.
Translation: PS: it would be better if you write in English (if you can) because most people here do not speak French, and more people would be able to help you.
#670
Yeah. Besides, red and purple ones put one egg by default, so they duplicate. You can download all the new slimes in the sample quest of the development version! I uploaded them today. :D
#671
They actually do not spawn, they hide if you are far, heheh!  ;D
#672
New types of slimes and improved ones! :D New video here:
https://www.youtube.com/watch?v=QTbf4k_PAfg&feature=youtu.be
#673
Another problem that may appear:

-When the hero moves to the left or right, some throwable weapons could collision with your invisible walls. But this can be avoided if we use only two custom entities (and no more), which should move along with the hero as he moves. However, if you throw a bomb or arrow (or bomb-arrow :P) in left or right direction and then you change to up or down direction too quick, the arrow/bomb would be stuck and stop its movement, which could be weird, although it is unprobable that the player would notice this, heheh. (Another possible solution would be to disable the use of weapons while being on the stairs, but this would be a bad solution giving more problems than solutions, so I do not recommend to do this.)
#674
Quote from: Satoh on July 06, 2016, 08:31:41 AM
Diagonal walls only work when the player is actually rubbing up against the wall though.
It may not be clear what I'm trying to accomplish... but for example, if I had a sloped area that was 16 pixels wide, and 256 pixels from diagonal edge to diagonal edge, I wouldn't want the player to just walk straight across it without moving diagonally, but at that size it would be entirely possible to miss both edges, which is where the walls would be.

Its difficult to explain exactly what circumstances this would be used aside from simply pointing out that I need some raised platforms on a section of floor, and it won't look right if the player traverses them as if they were flat.

This problem seems really hard because it requires to modify the input direction and use a different one. In order to avoid a lot of complicated code and to accomplish this, we could try to use some tricky trick, or at least that is what I would do. I propose the following trick, which is not perfect but it is quite close to be so:

1) The idea is, again, to use some of the four diagonal walls to make the hero rub against them: "wall_top_right", "wall_top_left", "wall_bottom_left", "wall_bottom_right". In this example I am gonna assume that the hero enters the stairs from the left (so he has right direction) and the stairs go in direction top-right.

2) Since we want to allow the hero to enter from any possible coordinate, we should disable those tiles and enable them in the correct position when the hero enters the stairs, i.e., when he starts overlapping them. To do that, you can use two (or more if necessary) custom entities, with no sprite, with modified ground of diagonal type; you just add them the type of solid diagonal ground you need and enable them in the correct position. The hero would be stuck between these two entities and would walk in the correct direction because he would be rubbing them when walking to the left or right. Note that custom entities can have any position, not only multiples of 8, so this should be doable.

3) To allow the hero move in "up" and "down" directions, we could use a collision test or timer to check the direction of the hero. If he is "up" or "down", then we change the position of the custom entities, one to the left and one to the right of the hero, and we change their modified ground to "wall", so that the hero is again stuck between them but this time he is only allowed to move up and down. In the same manner, if we detect that the hero has changed direction to left or right, then we restore the position and ground type of the custom entities to the previous case (the diagonal one). (When testing/debugging this solution, I recommend you to add a sprite to the custom entities to see them and check if they are in the correct position.)

Possible issues:
-The hero cannot walk diagonally if he is facing up or down direction. In particular, there would be a wrong behavior if the hero is walking laterally, for instance when he is in "loading_walking" animation with the sword.
-Enemies that follow the hero could be stuck between these custom entities when they appear. So you should put some barrier at the entrance of the stairs that cannot be traversed by enemies, which would obstruct them entering the stairs.

Possible advantage:
-The Pegasus built-in boots could work to run through the stairs.
#675
Quote from: wrightmat on July 31, 2016, 04:15:32 PM
These are really cool - loved the video! Great work!

Thanks for the feedback wrightmat!
There will be more new types of slimes for sure, like ice slimes that can freeze you, and other types.

I hope these things attract the attention of people and make them use Solarus. One of the things that Solarus needs the most is to have more free art, and I am helping as much as possible for this goal: adding free enemies and NPCs, and someday in the next years more tilesets too.