Yes that works great thanks! Still going through the Lua API for ideas on the arrow code ..
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.
#17
Development / Re: get amount
February 19, 2018, 06:11:46 AM
Actually, I am wrong. (Or even more wrong.) With less than full hearts, the heart script still calls for dialog:"already_have" and won't sell a heart. Hmm...
#18
Development / get amount
February 19, 2018, 04:16:29 AM
Hi guys! I am making a shop, with NPCs for the items. The map script for the small heart works great for now.
but I am not sure how to properly use syntax to get the amount of the arrows item (the first "if" line).
Thanks so much.
Code ( lua) Select
function shop_heart:on_interaction()
if game:get_life(max)
then game:start_dialog("already_have")
sol.audio.play_sound("bounce")
elseif game:get_money() < 10 then
game:start_dialog("cant_buy")
sol.audio.play_sound("bounce")
else game:start_dialog("empty" , function()
hero:start_treasure("heart" , 1)
game:remove_money(10)
end)
end
end
but I am not sure how to properly use syntax to get the amount of the arrows item (the first "if" line).
Code ( lua) Select
function shop_arrows:on_interaction()
if item:get_amount("arrow" , 30)
then game:start_dialog("already_have")
elseif game:get_money() < 80 then
game:start_dialog("cant_buy")
sol.audio.play_sound("bounce")
else game:start_dialog("empty" , function()
hero:start_treasure("arrow" , 3)
game:remove_money(80)
end)
end
end
Thanks so much.
#20
Development / NPC Dialogue
February 09, 2018, 02:47:08 AM
Hello, I am trying to replicate Solarus Tutorial [en] - Basics #18: Dialogs with a non-playing characteracter https://www.youtube.com/watch?v=KyF4LB1YOSY&list=PLzJ4jb-Y0ufxwkj7IlfURcvCxaDCSecJY&index=18 and for some reason, it is just not working. I am a real beginner so thanks for any help. Here is three screenshots.
- The NPC Window
- The Dialogue Window
- The game running with the error message below
#21
Development / World Location, & Separators
February 08, 2018, 04:48:17 AM
Hello,
I am curious as to how important setting the world location is. For example if there were three standard screens in a world scrolling left to right, you may set them at 0, 320, and 640. Or not. When layering multiple floors (say, replicating the tower with the Moldorm) this seems very important. But otherwise?
Also, what are the advantages/hazards of using separators instead of multiple screens?
Thanks for any insight.
I am curious as to how important setting the world location is. For example if there were three standard screens in a world scrolling left to right, you may set them at 0, 320, and 640. Or not. When layering multiple floors (say, replicating the tower with the Moldorm) this seems very important. But otherwise?
Also, what are the advantages/hazards of using separators instead of multiple screens?
Thanks for any insight.