5
number_owned="size(filter(level.player.vars.items_owned, 'item', item = type))"
6
final_price="consts.price * (1 + number_owned)"
13
on_create="[if(number_owned >= consts.max_owned, die())]"
15
on_interact="[fire_event(level.player, 'start_interact')]"
16
on_talk="[set(level.player.time_in_animation_delta, 0),
17
if(level.player.vars.coins < final_price,
19
speech_dialog(self, consts.description + [~The price is ~ + final_price + ~ coins.~, ~You don't have enough money.~]),
22
speech_dialog(self, consts.description + [~The price is ~ + final_price + ~ coins.~]),
23
speech_dialog(self, [~Do you want to buy the ~ + consts.name + ~?~,
24
'Yes', [fire_event('bought'), die(), set(level.player.vars.items_owned, level.player.vars.items_owned + [type]), set(level.player.vars.coins, level.player.vars.coins - final_price)],
27
set(level.player.time_in_animation_delta, 1)]"
29
on_end_normal_anim="animation('normal')"