Fallout Wiki
Fallout Wiki
Details
Type Decompiled script
SCRIPTS.LST comment Random fisherman's son.
MSG file FISHRSON.MSG

This script governs a random fisherman’s son NPC, managing dialogue, reactions, and hostility with the Vault Dweller.

procedure start;
procedure critter_p_proc;
procedure damage_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure FishrSon00;
procedure FishrSon01;
procedure FishrSon02;
procedure FishrSon02a;
procedure FishrSon03;
procedure FishrSon04;
procedure FishrSon05;
procedure FishrSon05a;
procedure FishrSon06;
procedure FishrSon07;
procedure FishrSon08;
procedure FishrSon09;
procedure FishrSon10;
procedure FishrSon11;
procedure FishrSon11a;
procedure FishrSon12;
procedure FishrSon13;
procedure FishrSon14;
procedure FishrSon15;
procedure FishrSon16;
procedure FishrSon17;
procedure FishrSon18;
procedure FishrSon19;
procedure FishrSon20;
procedure FishrSon21;
procedure flee_dude;
variable initialized;
variable known;
import variable dude_enemy;
procedure get_reaction;
procedure ReactToLevel;
procedure LevelToReact;
procedure UpReact;
procedure DownReact;
procedure BottomReact;
procedure TopReact;
procedure BigUpReact;
procedure BigDownReact;
procedure UpReactLevel;
procedure DownReactLevel;
procedure Goodbyes;
variable exit_line;
procedure start
begin
        if (not(initialized)) then begin
                critter_add_trait(self_obj, 1, 6, 2);
                critter_add_trait(self_obj, 1, 5, 68);
                dude_enemy := global_var(334);
                initialized := 1;
        end
        else begin
                if (script_action == 12) then begin
                        call critter_p_proc;
                end
                else begin
                        if (script_action == 14) then begin
                                call damage_p_proc;
                        end
                        else begin
                                if (script_action == 18) then begin
                                        call destroy_p_proc;
                                end
                                else begin
                                        if (script_action == 21) then begin
                                                call look_at_p_proc;
                                        end
                                        else begin
                                                if (script_action == 4) then begin
                                                        call pickup_p_proc;
                                                end
                                                else begin
                                                        if (script_action == 11) then begin
                                                                call talk_p_proc;
                                                        end
                                                end
                                        end
                                end
                        end
                end
        end
end
procedure critter_p_proc
begin
        if (dude_enemy and (tile_distance_objs(dude_obj, self_obj) < 8)) then begin
                call flee_dude;
        end
end
procedure damage_p_proc
begin
        if (source_obj == dude_obj) then begin
                dude_enemy := 1;
                set_global_var(334, 1);
        end
end
procedure destroy_p_proc
begin
        if (source_obj == dude_obj) then begin
                if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
                        set_global_var(156, 1);
                        set_global_var(157, 0);
                end
                if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
                        set_global_var(157, 1);
                        set_global_var(156, 0);
                end
                set_global_var(159, global_var(159) + 1);
                if ((global_var(159) % 2) == 0) then begin
                        set_global_var(155, global_var(155) - 1);
                end
        end
end
procedure look_at_p_proc
begin
        script_overrides;
        display_msg(message_str(645, 100));
end
procedure pickup_p_proc
begin
        dude_enemy := 1;
        set_global_var(334, 1);
end
procedure talk_p_proc
begin
        call get_reaction;
        if (dude_enemy) then begin
                float_msg(self_obj, message_str(669, 103), 0);
        end
        else begin
                if ((global_var(158) > 2) or (local_var(1) < 2) or (global_var(155) < -30)) then begin
                        call FishrSon00;
                end
                else begin
                        if ((obj_item_subtype(critter_inven_obj(dude_obj, 1)) == 3) or (obj_item_subtype(critter_inven_obj(dude_obj, 2)) == 3)) then begin
                                call FishrSon01;
                        end
                        else begin
                                start_gdialog(645, self_obj, 4, -1, -1);
                                gsay_start;
                                if (known or (global_var(155) < 30)) then begin
                                        call FishrSon04;
                                end
                                else begin
                                        call FishrSon02;
                                end
                                gsay_end;
                                end_dialogue;
                        end
                end
        end
end
procedure FishrSon00
begin
        float_msg(self_obj, message_str(645, 101), 0);
end
procedure FishrSon01
begin
        float_msg(self_obj, message_str(645, 102), 0);
end
procedure FishrSon02
begin
        known := 1;
        gsay_reply(645, 103);
        call FishrSon02a;
end
procedure FishrSon02a
begin
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 106, FishrSon08, 50);
        giq_option(4, 645, 107, FishrSon10, 50);
        giq_option(-3, 645, 108, FishrSon09, 50);
end
procedure FishrSon03
begin
        known := 1;
        gsay_reply(645, 109);
        giq_option(4, 645, 110, FishrSon05, 50);
        call FishrSon02a;
end
procedure FishrSon04
begin
        gsay_reply(645, 111);
        giq_option(4, 645, 110, FishrSon05, 50);
        call FishrSon02a;
end
procedure FishrSon05
begin
        gsay_reply(645, 112);
        giq_option(0, 634, 106, FishrSon05a, 50);
end
procedure FishrSon05a
begin
        gsay_reply(645, 113);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 106, FishrSon08, 50);
        giq_option(4, 645, 114, FishrSon12, 50);
        giq_option(4, 645, 115, FishrSon13, 50);
end
procedure FishrSon06
begin
        gsay_reply(645, 116);
        giq_option(4, 645, 117, FishrSon14, 50);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 106, FishrSon08, 50);
        giq_option(4, 645, 114, FishrSon12, 50);
end
procedure FishrSon07
begin
        gsay_message(645, 118, 50);
end
procedure FishrSon08
begin
        gsay_reply(645, 119);
        giq_option(4, 645, 110, FishrSon05, 50);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 106, FishrSon08, 50);
        giq_option(4, 645, 120, FishrSon15, 50);
end
procedure FishrSon09
begin
        gsay_message(645, 121, 50);
end
procedure FishrSon10
begin
        gsay_reply(645, 122);
        giq_option(4, 645, 123, FishrSon16, 49);
        giq_option(4, 645, 124, FishrSon16, 49);
        giq_option(4, 645, 125, FishrSon16, 49);
end
procedure FishrSon11
begin
        gsay_reply(645, 126);
        giq_option(0, 634, 106, FishrSon11a, 49);
end
procedure FishrSon11a
begin
        gsay_message(645, 127, 49);
end
procedure FishrSon12
begin
        gsay_reply(645, 128);
        giq_option(4, 645, 110, FishrSon05, 50);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 106, FishrSon08, 50);
end
procedure FishrSon13
begin
        gsay_reply(645, 129);
        giq_option(4, 645, 110, FishrSon05, 50);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 106, FishrSon08, 50);
        giq_option(4, 645, 130, FishrSon17, 50);
end
procedure FishrSon14
begin
        gsay_message(645, 131, 50);
end
procedure FishrSon15
begin
        gsay_reply(645, 132);
        giq_option(4, 645, 110, FishrSon05, 50);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 133, FishrSon18, 50);
        giq_option(4, 645, 134, FishrSon19, 50);
end
procedure FishrSon16
begin
        gsay_message(645, 135, 49);
end
procedure FishrSon17
begin
        gsay_reply(645, 136);
        giq_option(4, 645, 137, FishrSon20, 50);
        if (global_var(74) > 0) then begin
                giq_option(4, 645, 138, FishrSon21, 50);
        end
end
procedure FishrSon18
begin
        gsay_reply(645, 139);
        giq_option(4, 645, 110, FishrSon05, 50);
        giq_option(4, 645, 104, FishrSon06, 50);
        giq_option(4, 645, 105, FishrSon07, 50);
        giq_option(4, 645, 134, FishrSon18, 50);
end
procedure FishrSon19
begin
        gsay_message(645, 140, 50);
end
procedure FishrSon20
begin
        gsay_message(645, 141, 49);
end
procedure FishrSon21
begin
        gsay_message(645, 142, 50);
end
procedure flee_dude
begin
        variable LVar0 := 0;
        variable LVar1 := 0;
        variable LVar2 := 0;
        while(LVar1 < 5) do begin
                if (tile_distance(tile_num(dude_obj), tile_num_in_direction(tile_num(self_obj), LVar1, 3)) > LVar2) then begin
                        LVar0 := tile_num_in_direction(tile_num(self_obj), LVar1, 3);
                        LVar2 := tile_distance(tile_num(dude_obj), LVar0);
                end
                LVar1 := LVar1 + 1;
        end
        animate_move_obj_to_tile(self_obj, LVar0, 1);
end
procedure get_reaction
begin
        if (local_var(2) == 0) then begin
                set_local_var(0, 50);
                set_local_var(1, 2);
                set_local_var(2, 1);
                set_local_var(0, local_var(0) + (5 * get_critter_stat(dude_obj, 3)) - 25);
                set_local_var(0, local_var(0) + (10 * has_trait(0, dude_obj, 10)));
                if (has_trait(0, dude_obj, 39)) then begin
                        if (global_var(155) > 0) then begin
                                set_local_var(0, local_var(0) + global_var(155));
                        end
                        else begin
                                set_local_var(0, local_var(0) - global_var(155));
                        end
                end
                else begin
                        if (local_var(3) == 1) then begin
                                set_local_var(0, local_var(0) - global_var(155));
                        end
                        else begin
                                set_local_var(0, local_var(0) + global_var(155));
                        end
                end
                if (global_var(158) > 2) then begin
                        set_local_var(0, local_var(0) - 30);
                end
                if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
                        set_local_var(0, local_var(0) + 20);
                end
                if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
                        set_local_var(0, local_var(0) - 20);
                end
                call ReactToLevel;
        end
end
procedure ReactToLevel
begin
        if (local_var(0) <= 25) then begin
                set_local_var(1, 1);
        end
        else begin
                if (local_var(0) <= 75) then begin
                        set_local_var(1, 2);
                end
                else begin
                        set_local_var(1, 3);
                end
        end
end
procedure LevelToReact
begin
        if (local_var(1) == 1) then begin
                set_local_var(0, random(1, 25));
        end
        else begin
                if (local_var(1) == 2) then begin
                        set_local_var(0, random(26, 75));
                end
                else begin
                        set_local_var(0, random(76, 100));
                end
        end
end
procedure UpReact
begin
        set_local_var(0, local_var(0) + 10);
        call ReactToLevel;
end
procedure DownReact
begin
        set_local_var(0, local_var(0) - 10);
        call ReactToLevel;
end
procedure BottomReact
begin
        set_local_var(1, 1);
        set_local_var(0, 1);
end
procedure TopReact
begin
        set_local_var(0, 100);
        set_local_var(1, 3);
end
procedure BigUpReact
begin
        set_local_var(0, local_var(0) + 25);
        call ReactToLevel;
end
procedure BigDownReact
begin
        set_local_var(0, local_var(0) - 25);
        call ReactToLevel;
end
procedure UpReactLevel
begin
        set_local_var(1, local_var(1) + 1);
        if (local_var(1) > 3) then begin
                set_local_var(1, 3);
        end
        call LevelToReact;
end
procedure DownReactLevel
begin
        set_local_var(1, local_var(1) - 1);
        if (local_var(1) < 1) then begin
                set_local_var(1, 1);
        end
        call LevelToReact;
end
procedure Goodbyes
begin
        exit_line := message_str(634, random(100, 105));
end