1 |
var player_gold = global.player_gold |
2 |
var buy_shop_screen_number = global.buy_shop_screen_number |
3 |
script_execute(gml_Script_scr_controls_shop_response) |
4 |
if key_select |
5 |
{ |
6 |
if (response_shop_screen_number == 1) |
7 |
{ |
8 |
if (global.item_slot[8] != "Nothing") |
9 |
{ |
10 |
global.player_response = 1 |
11 |
global.able_to_buy = 2 |
12 |
audio_play_sound(snd_fail, 1, 0) |
13 |
} |
14 |
else |
15 |
{ |
16 |
global.player_response = 1 |
17 |
global.able_to_buy = 0 |
18 |
var i = 1 |
19 |
while (i <= 8) |
20 |
{ |
21 |
if (global.item_slot[i] == "Nothing") |
22 |
{ |
23 |
global.item_slot[i] = global.shop_item[buy_shop_screen_number] |
24 |
global.player_gold -= global.shop_gold_requirement[buy_shop_screen_number] |
25 |
break |
26 |
} |
27 |
else |
28 |
{ |
29 |
i += 1 |
30 |
continue |
31 |
} |
32 |
} |
33 |
global.item_stock[global.shop_stock[buy_shop_screen_number]] -= 1 |
34 |
audio_play_sound(snd_shop_purchase, 20, false) |
35 |
var selected_item = global.shop_item[buy_shop_screen_number] |
36 |
scr_item_set_unstealablescr_item_set_unstealablefunction scr_item_set_unstealable() //gml_Script_scr_item_set_unstealable
{
var selection = argument[0]
switch selection
{
case "Wild Revolver":
case "Silver Ammo":
case "Fancy Holster":
case "Honeydew Pin":
ds_list_add(global.steal_list, selection)
return true;
default:
return true;
}
} (selected_item) |
37 |
} |
38 |
event_user(0) |
39 |
return; |
40 |
} |
41 |
else if (response_shop_screen_number == 2) |
42 |
{ |
43 |
global.player_response = 2 |
44 |
event_user(0) |
45 |
return; |
46 |
} |
47 |
} |
48 |
if (key_revert && key_select == 0) |
49 |
{ |
50 |
global.player_response = 2 |
51 |
event_user(0) |
52 |
return; |
53 |
} |
54 |
if (key_select == 0 && key_revert == 0) |
55 |
{ |
56 |
if (key_down && key_up == 0) |
57 |
{ |
58 |
if (response_shop_screen_number == 2) |
59 |
response_shop_screen_number = 1 |
60 |
else |
61 |
response_shop_screen_number += 1 |
62 |
} |
63 |
if (key_up && key_down == 0) |
64 |
{ |
65 |
if (response_shop_screen_number == 1) |
66 |
response_shop_screen_number = 2 |
67 |
else |
68 |
response_shop_screen_number -= 1 |
69 |
} |
70 |
} |
71 |
if (response_shop_screen_number == 1) |
72 |
{ |
73 |
x = obj_main_screen_shop.x + 229 |
74 |
y = obj_main_screen_shop.y + 59 |
75 |
} |
76 |
else if (response_shop_screen_number == 2) |
77 |
{ |
78 |
x = obj_main_screen_shop.x + 229 |
79 |
y = obj_main_screen_shop.y + 74 |
80 |
} |