Recent Posts

Pages: [1] 2 3 ... 10
1
Your projects / Re: Zelda's Adventure: Solarus Edition
« Last post by CrookiNari on June 15, 2018, 12:36:03 am »
 Ok, I've finally got it working :) So I can put this issue to bed.
2
Development / Re: Freezing/locking keyboard during specific event?
« Last post by Diarandor on June 14, 2018, 07:37:04 pm »
To do it in a clean way you'll need to modify the event on_command_pressed and do nothing if the item is being used. That will avoid annoying built-in stuff like the hero state and animations being restarted. As Max says, it is convenient to define item:is_being_used() (or item:can_be_used()) for all items.
3
Development / Re: Freezing/locking keyboard during specific event?
« Last post by Eyth on June 14, 2018, 05:09:12 pm »
Yes, makes sense. Didn't think of that ^^
I'll have to try, to see how it fits best.

Thanks for the fast reply  ;)
4
Development / Re: Freezing/locking keyboard during specific event?
« Last post by Max on June 14, 2018, 04:39:11 pm »
I've tackled similar problems this way:

I create a variable, "using_item", for example. This should probably be a variable local to the item's script, set it to false when the item is created. For the item:on_using() event, or the on_key_pressed, start it with the condition of if using_item ~= true. Then set the variable using_item to true first thing, and once you're done using the item (after a timer, or on_item_finished or whatever) set using_item back to false.

I think I might have some of the events referred to improperly here, but does the idea make sense?
5
Development / Freezing/locking keyboard during specific event?
« Last post by Eyth on June 14, 2018, 04:26:57 pm »
Hi there again  ;)

Today I have a quick question. Hope I can describe it the right way:
I made a custom item with animations and all of that, the hero can use with the "item_1" command key (x). Works - so far so good ^^
But when I press the key, while the animation of the item used is running - the animation stops and starts new. In further consequence errors occur obviously...

Is it possible to lock the keyboard input, til item:on_using is finished, or you may have another idea?
Thanks for your advises in advance  :)
6
Your projects / Re: Zelda's Adventure: Solarus Edition
« Last post by PhoenixII54 on June 14, 2018, 04:21:26 pm »
i tried using your script on my own test map, and it worked perfectly*. The only warning for you is that the movement will stop if your NPC reaches an obstacle. And i have to correct myself : the parenthesis are actually optionnal for a function call with a raw table data for only argument.

*using an already fully configured sprite (ALTTP Zelda)

PS, that means something is likely wrong on your sprite data, and of course your path is wrong : for a back-and-forth movement, you should use opposite directions, (0+4,1+5, 2+6 or 3+7).
7
Your projects / Re: Zelda's Adventure: Solarus Edition
« Last post by CrookiNari on June 14, 2018, 03:13:14 pm »
Nope, the origin is exactly the same on all of them and the guy is set to be a "somebody". And I tried using that path direction setting, it just resulted in the illegal direction error.
8
Your projects / Re: Zelda's Adventure: Solarus Edition
« Last post by PhoenixII54 on June 14, 2018, 02:33:00 pm »
i think the final problem in your script is that you didn't add the parenthesis around the path data table, and as a consequence the movement:set_path function is not called, resulting in the movement path to not be set at all (note : each path direction is numbered from 0 (east) to 7 (south-east), using the trigonometric rotation (or if you prefer the anti-clockwise rotation))

PS : as max said, using
Code: [Select]
[code= lua]  at start of your code is helpful indeed
9
Your projects / Re: Zelda's Adventure: Solarus Edition
« Last post by Max on June 14, 2018, 02:29:12 pm »
Holy hell how did I not even make a walking animation I feel so dumb
He still doesn't move like he should, kinda sliding upwards a bit before stopping, but there's no error messages this time.

I don't see any issues with your most recent code, so I'm guessing that sliding up a bit is caused by your walking and stopped animation sets having different origins. Origin is a value you set for every direction of a sprite, and for something simple like an NPC, I think the best practice is to set the origin's x value to half the sprite's width (right in the middle) and the y value to 3 px above the bottom of the sprite (generally, height - 3). I'm guessing that might be the problem because I've done that kind of mistake plenty of times.

In general, NPC sprites need a "stopped" and a "walking" animation, you can get away with just stopped if you know they'll never move. I'm pretty sure the engine wants those exact names if it's applying a movement to an NPC entity.

It's also important to make sure in a case like this where the NPC entity is a person, to have the option in the NPC's settings set to "someone", so the engine knows to apply special rules for how people move- for example, automatically calling the "walking" animation when they move, and making them face toward you when the hero speaks to them.


Finally, when you post code on the forums, it's helpful for us helping you if you do the first tag as "["code=Lua"]", with no quotation marks. For one thing, this adds line numbers, which are important for error messages.
10
Your projects / Re: Zelda's Adventure: Solarus Edition
« Last post by CrookiNari on June 14, 2018, 02:13:48 pm »
Oh, ok. It doesn't appear to be making any difference to the code now, though.
Code: [Select]
local map = ...
local game = map:get_game()

function map:on_started()
local movement = sol.movement.create("path")
  movement:set_path{2,2,2,2,2,0,0,0,0,0}
  movement:set_speed(20)
  movement:set_loop(true)
  movement:start(traveller2)

end

function traveller2:on_interaction()
game:start_dialog ("plains_traveller")

end

function map:on_opening_transition_finished()

end
Pages: [1] 2 3 ... 10