Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_create_player_attack

(view raw script w/o annotations or w/e)
1
function scr_create_player_attack
scr_create_player_attack

function scr_create_player_attack() //gml_Script_scr_create_player_attack { if (global.battle_enemy_name == "macro froggit" && global.turns_passed == 0) { global.enemy_attacking = true return; } var player_weapon = global.player_weapon var player_weapon_modifier = global.player_weapon_modifier switch player_weapon { case "Toy Gun": switch player_weapon_modifier { case "Pebble Ammo": case "Cff Bean Ammo": case "Glass Ammo": case "Super Ammo": case "Silver Ammo": instance_create(319, 319, obj_toy_gun_circle) break case "Ice Pellets": instance_create(319, 319, obj_toy_gun_circle_multi) with (obj_toy_gun_circle_multi) { circle_count = 2 event_user(1) } break case "Flint": case "Friendliness Pellets": case "Nails": instance_create(319, 319, obj_toy_gun_circle_multi) with (obj_toy_gun_circle_multi) { circle_count = 3 event_user(1) } break default: instance_create(319, 319, obj_toy_gun_circle) } instance_create(320, 320, obj_toy_gun_battle_circle) break case "Wild Revolver": instance_create(320, 320, obj_wild_revolver_battle_outline) switch player_weapon_modifier { case "Pebble Ammo": case "Cff Bean Ammo": case "Glass Ammo": case "Silver Ammo": instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle) break case "Ice Pellets": instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle_multi) with (obj_wild_revolver_circle_multi) { circle_count = 2 event_user(1) } break case "Flint": case "Friendliness Pellets": case "Nails": instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle_multi) with (obj_wild_revolver_circle_multi) { circle_count = 3 event_user(1) } break default: instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle) } with (obj_wild_revolver_battle_outline) event_user(0) break default: var random_generator = irandom_range(1, 2) if (random_generator == 1) instance_create(44, 255, obj_target_bar_battle) else if (random_generator == 2) instance_create(594, 255, obj_target_bar_battle_2) instance_create(319, 320, obj_target_battle) } }
() //gml_Script_scr_create_player_attack
2
{
3
    if (global.battle_enemy_name == "macro froggit" && global.turns_passed == 0)
4
    {
5
        global.enemy_attacking = true
6
        return;
7
    }
8
    var player_weapon = global.player_weapon
9
    var player_weapon_modifier = global.player_weapon_modifier
10
    switch player_weapon
11
    {
12
        case "Toy Gun":
13
            switch player_weapon_modifier
14
            {
15
                case "Pebble Ammo":
16
                case "Cff Bean Ammo":
17
                case "Glass Ammo":
18
                case "Super Ammo":
19
                case "Silver Ammo":
20
                    instance_create(319, 319, obj_toy_gun_circle)
21
                    break
22
                case "Ice Pellets":
23
                    instance_create(319, 319, obj_toy_gun_circle_multi)
24
                    with (obj_toy_gun_circle_multi)
25
                    {
26
                        circle_count = 2
27
                        event_user(1)
28
                    }
29
                    break
30
                case "Flint":
31
                case "Friendliness Pellets":
32
                case "Nails":
33
                    instance_create(319, 319, obj_toy_gun_circle_multi)
34
                    with (obj_toy_gun_circle_multi)
35
                    {
36
                        circle_count = 3
37
                        event_user(1)
38
                    }
39
                    break
40
                default:
41
                    instance_create(319, 319, obj_toy_gun_circle)
42
            }
43
44
            instance_create(320, 320, obj_toy_gun_battle_circle)
45
            break
46
        case "Wild Revolver":
47
            instance_create(320, 320, obj_wild_revolver_battle_outline)
48
            switch player_weapon_modifier
49
            {
50
                case "Pebble Ammo":
51
                case "Cff Bean Ammo":
52
                case "Glass Ammo":
53
                case "Silver Ammo":
54
                    instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle)
55
                    break
56
                case "Ice Pellets":
57
                    instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle_multi)
58
                    with (obj_wild_revolver_circle_multi)
59
                    {
60
                        circle_count = 2
61
                        event_user(1)
62
                    }
63
                    break
64
                case "Flint":
65
                case "Friendliness Pellets":
66
                case "Nails":
67
                    instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle_multi)
68
                    with (obj_wild_revolver_circle_multi)
69
                    {
70
                        circle_count = 3
71
                        event_user(1)
72
                    }
73
                    break
74
                default:
75
                    instance_create(319, (319 - obj_wild_revolver_battle_outline.target_radius), obj_wild_revolver_circle)
76
            }
77
78
            with (obj_wild_revolver_battle_outline)
79
                event_user(0)
80
            break
81
        default:
82
            var random_generator = irandom_range(1, 2)
83
            if (random_generator == 1)
84
                instance_create(44, 255, obj_target_bar_battle)
85
            else if (random_generator == 2)
86
                instance_create(594, 255, obj_target_bar_battle_2)
87
            instance_create(319, 320, obj_target_battle)
88
    }
89
90
}