Help with scripting

Discussion in 'Fallout General Modding' started by Frank Horrigan@BIS, Jul 19, 2004.

  1. Frank Horrigan@BIS

    Frank Horrigan@BIS Still Mildly Glowing

    241
    Apr 3, 2003
    Hey

    I'm willing to create a new script file for a new NPC that I'm creating for Fallout 1. While reading through the int files of Ian, Katja and Tycho and trying to figure out as much as possible, I encountered some values which I believe as important but can't figure out their ways of importance/working.

    I've pasted some functions from Ian's int file and marked the values by making their text bold looking.

    -------------------------------------------------------------------------------------
    procedure description_p_proc
    begin
    if (op_success(op_do_check(op_dude_obj(), 1, op_has_trait(0, op_dude_obj(), 0)))) then
    begin
    op_script_overrides();
    op_display_msg(op_msg_string(235, 130));
    end
    -------------------------------------------------------------------------------------

    The value for Katja was 623 and the value for Tycho was 389. I'm pretty sure that those values are linked to the dialog files which the scripts are using. I guess I need to edit some sort of lst file for adding new dialogs right?

    -------------------------------------------------------------------------------------

    procedure destroy_p_proc
    begin
    op_set_global_var(118, 3);
    if (op_source_obj() == op_dude_obj()) then
    begin

    Katjas global_var value was 244 and Tychos 121. I've no idea of their meanings. Please tell me.

    -------------------------------------------------------------------------------------

    procedure map_enter_p_proc
    begin
    if (op_global_var(???) == 2) then
    begin
    op_critter_add_trait(op_self_obj(), 1, 6, 0);
    op_add_timer_event(op_self_obj(), op_game_ticks(1), 1);
    end
    else
    op_critter_add_trait(op_self_obj(), 1, 6, 2);
    end

    Tychos value was 26 and Katjas was 49. Again no idea what those values mean again so please inform me even here.
     
  2. Ashmo

    Ashmo Half-way Through My Half-life
    Orderite

    Jul 2, 2004
    Correct, it seems:

    -------------------------------------------------------------------------------------

    It's the index of the global var (whichever that would be in this case...):

    -------------------------------------------------------------------------------------

    It's the amount, apparently:

     
  3. Frank Horrigan@BIS

    Frank Horrigan@BIS Still Mildly Glowing

    241
    Apr 3, 2003
    I already figured out

    files that needed to be edited were vault13.gam and scrname.msg
     
  4. Frank Horrigan@BIS

    Frank Horrigan@BIS Still Mildly Glowing

    241
    Apr 3, 2003
    So I now even to the compiler to work.

    also when I try to compile my own ssl it starts of with:

    syntax error on line 1 near ´{`.

    Well since ssl dosen't contain any { it must be in the dialog file the error lies...right?
     
  5. Ashmo

    Ashmo Half-way Through My Half-life
    Orderite

    Jul 2, 2004
    I would say so?
     
  6. jargo

    jargo Where'd That 6th Toe Come From?

    492
    May 25, 2003
    nope, compiler don't check dialog files. It parse only script + header files(if using precompiler)
     
  7. Frank Horrigan@BIS

    Frank Horrigan@BIS Still Mildly Glowing

    241
    Apr 3, 2003
    yeah, well got it working now, don't know where the error came from...

    However I've a new problem again: I edited the armor.int file which is used for the power armor parts in the BOS in Fallout.

    Now I managed to set a skill requirement for repairing the armor.

    procedure chance
    begin
    if (op_has_skill(op_dude_obj(), 13) >= 140) then
    call fixed();
    else
    call failure();
    end

    So when your character has gotten a repair of 140 or more you will repair the armor. However, this feature in the script is totally left out.

    procedure use_obj_on_p_proc
    begin
    if (op_obj_pid(op_obj_being_used_with()) == 75) then
    begin
    bonus := 10;
    use_skill := 13;
    call use_skill_on_p_proc();
    end
    else
    op_display_msg(op_msg_string(936, 105));
    end

    What it does is that if you use a tool on the armor parts you should get a bonus of 10% to your repair skill I guess.

    Although how many times if tried to edit this, the tool never did any use on the armor parts. I tried for example entering functions like use_obj_on_p_proc(); in the produce chance feature and lots more but I didn't get it work. Please tell me how to write this correctly.

    EDIT: Also the compiler was able to compile my own script for my new NPC. However, when holding the pointer over the critter the game says "Error" and shuts down whenever trying to open a dialog. Any suggestions on what may cause this?

    I really don't understand why it doesn't work.

    1) I've added a line in Vault.gam at the bottom that says

    "DEMAN_STATUS :=0; // 618" were 618 is the global var value for this new critter.

    2) I've edited Scripts.lst and Scrname.msg. While doing further studies I determined that used the same "arrangement" of lines. Now as it seems that SCRNAME.msg is the "storage" file for the game the "codes" of the dialogs that the script files are using.

    The last code was 950 given to Kenny's msg file (in the Scrname.msg the code was 1050, but all those values seem to be substract with -100 by some function in the game).

    Now I changed the arrangement of SCRNAME.MSG so it looks like this:

    {1051}{}{Deman} # Deman.int
    {1052}{}{Brotherhood Guard} # SuplyGrd.int
    {1053}{}{Hub} # HubMis1.int
    {1054}{}{} # RndEcGen.int
    {1055}{}{Locker} # GenLock.int
    {1056}{}{Holodisk} # RegDisk.int
    {1057}{}{Prisoner} # HubPris.int
    {1058}{}{Followers} # LAFollwr.int
    {1031}{}{Door} # RaidDoor.int
    {1059}{}{Damaged Force Field Emitter} # GenEmit.int

    1051 (951) should be the msg code for my critter.

    Now I did the similar thing with SCRIPTS.LST

    Deman.int ;Deman # local_vars=0
    SuplyGrd.int ; supply guards for 1s # local_vars=8
    HubMis1.int ; map script for HubMis1.map # local_vars=0
    RndEcGen.int ;Generic Randomen counter monsters # local_vars=4
    GenLock.int ; generic foot locker which is locked # local_vars=4
    RegDisk.int ; Rugulator holodisk # local_vars=4
    HubPris.int ; Prisoner in the Hub # local_vars=5
    LAFollwr.int ; map script for the followers # local_vars=0
    RaidDoor.int ; the cell door for tandi in the raiders # local_vars=4
    GenEmit.int ; generic damaged force field emitter # local_vars=4
    Test.int ; testing scripts

    I don't know what the #local_vars mean here though.

    Now for testing I edited assblow.int (Kalnor's Script file).

    op_display_msg(op_msg_string(135, 100));

    In this line the dialog is used for the first time.

    Firstly I typed: op_display_msg(op_msg_string(950, 100)); to see if Kenny's discerption would turn up and it did.

    Afterward I typed: op_display_msg(op_msg_string(951, 100));
    to see my critters (Deman) description would turn up. Again only an error message appeared.
     
  8. Frank Horrigan@BIS

    Frank Horrigan@BIS Still Mildly Glowing

    241
    Apr 3, 2003
    Nevermind fixed it myself, besides for the power armor parts.
     
  9. jona0

    jona0 First time out of the vault

    94
    Apr 4, 2003
    Hello

    Its me again....
    Can someone please compile this:
    (Sorry - I couldnt find a way to add a file....)

    =======


    /* Include Files */
    #include "..\headers\define.h"
    #include "..\headers\den.h"

    #define NAME SCRIPT_DCJOEY
    #define TOWN_REP_VAR GVAR_TOWN_REP_THE_DEN

    #include "..\headers\command.h"
    #include "..\headers\ModReact.h"
    #include "..\headers\DenRes1.h"

    /* Standard Script Procedures */
    procedure start;
    procedure critter_p_proc;
    procedure pickup_p_proc;
    procedure talk_p_proc;
    procedure destroy_p_proc;
    procedure look_at_p_proc;
    procedure description_p_proc;
    procedure use_skill_on_p_proc;
    procedure damage_p_proc;
    procedure map_enter_p_proc;
    procedure timed_event_p_proc;

    // dialog nodes
    procedure Node000;
    procedure Node001;
    procedure Node002;
    procedure Node003;
    procedure Node004;
    procedure Node005;
    procedure Node006;
    procedure Node007;
    procedure Node008;
    procedure Node009;
    procedure Node010;
    procedure Node011;
    procedure Node012;
    procedure Node013;
    procedure Node014;
    procedure Node015;
    procedure Node016;
    procedure Node017;
    procedure Node018;
    procedure Node019;
    procedure Node020;
    procedure Node021;
    procedure Node022;
    procedure Node023;
    procedure Node024;
    procedure Node025;
    /*
    procedure Node026;
    procedure Node027;
    procedure Node028;
    */

    procedure Node998; // This Node is Always Combat

    procedure Node996;
    procedure Node995;
    procedure Node994;
    procedure Node993;
    procedure Node992;
    procedure Node991;
    procedure Node990;
    procedure Node989;
    procedure Node988;
    procedure Node987;
    procedure Node986;
    procedure Node985;
    procedure Node984;
    procedure Node983;
    procedure Node982;
    procedure Node981;
    procedure Node980;
    procedure Node979;
    procedure Node978;
    procedure Node977;

    #define LVAR_Flags (4)
    #define LVAR_Next_Sex_Time (5)
    #define LVAR_Home_Tile (6)

    #define gave_locket_bit bit_10

    #define gave_locket lvar_bit(LVAR_Flags, gave_locket_bit)
    #define set_gave_locket set_lvar_bit_on(LVAR_Flags, gave_locket_bit)

    variable locket_cost := 0;
    variable home_tile := 23667;
    import variable joey_obj;

    procedure start begin
    end

    procedure timed_event_p_proc begin
    if (fixed_param == timed_event_post_sex) then begin
    force_dialog_start("Node014");
    end
    end

    procedure map_enter_p_proc begin
    if (is_loading_game == false) then begin
    if (map_first_run) then begin
    set_local_var(LVAR_Home_Tile, tile_num(self_obj));
    critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_TEAM_NUM, TEAM_DEN_THUG);
    critter_add_trait(self_obj, TRAIT_OBJECT, OBJECT_AI_PACKET, AI_THUG);
    end else if ((tile_num(self_obj)) != local_var(LVAR_Home_Tile)) then begin
    critter_attempt_placement(self_obj, home_tile, self_elevation);
    end
    end
    joey_obj := self_obj;
    end

    procedure critter_p_proc begin
    if (self_can_see_dude) then begin
    if ((hostile) or (thugs_hostile)) then begin
    self_attack_dude;
    end
    end
    end

    procedure damage_p_proc begin
    if (source_obj == dude_obj) then begin
    call Node998;
    end
    end

    procedure pickup_p_proc begin
    if (source_obj == dude_obj) then begin
    call Node998;
    end
    end

    procedure talk_p_proc begin
    check_forced_dialog
    else begin
    GetReaction;
    start_gdialog(NAME,self_obj,4,-1,-1);
    gSay_Start;
    if ((hostile) or (mom_attacked) or (mom_dead)) then begin
    call Node001;
    end else if (herebefore) then begin
    if (bad_critter_reaction) then begin
    call Node002;
    end else begin
    call Node009;
    end
    end else begin
    call Node000;
    end
    gSay_End;
    end_dialogue;
    script_overrides;
    set_herebefore;
    end
    end

    procedure destroy_p_proc begin
    inc_evil_critter
    joey_obj := 0;
    set_joey_dead;
    if (gave_locket == false) then begin
    give_pid_qty(self_obj, PID_ANNA_GOLD_LOCKET, 1)
    set_gave_locket;
    end
    end

    procedure look_at_p_proc begin
    script_overrides;
    display_mstr(100 + herebefore);
    end

    procedure description_p_proc begin
    script_overrides;
    display_mstr(150);
    end

    procedure use_skill_on_p_proc begin
    end

    procedure Node999 begin
    // to exit dialogs
    end
    procedure Node998 begin
    // sets up combat
    set_thugs_hostile;
    set_hostile;
    end

    // dialog nodes that make changes/skill checks from options
    procedure Node996 begin
    // check speech, if successful goto 2, else start combat
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,0))) and (dude_strength > self_strength)) then begin
    call Node002;
    end else call Node998;
    end
    procedure Node995 begin
    // check speech at +10%, if successful goto 2, else start combat
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,10))) and (dude_strength > self_strength)) then begin
    call Node002;
    end else call Node998;
    end
    procedure Node994 begin
    // go to propper node for male or female
    if (dude_is_male) then call Node010;
    else call Node011;
    end
    procedure Node993 begin
    // roll speech, on success goto 7, on failure start combat
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,0))) and (dude_strength > self_strength)) then begin
    call Node007;
    end else call Node998;
    end
    procedure Node992 begin
    // roll speech, on success goto 7, on failure goto 6
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,0))) and (dude_strength > self_strength)) then begin
    call Node007;
    end else call Node006;
    end
    procedure Node991 begin
    // if player has money($50) take money and goto 7, else goto 8
    if (dude_caps >= 50) then begin
    locket_cost := 50;
    item_caps_adjust(self_obj,50);
    item_caps_adjust(dude_obj,-50);
    call Node007;
    end else begin
    call Node008;
    end
    end
    procedure Node990 begin
    // roll barter, if successful and player has money(20), take money and goto 7,
    // else if no money goto 8, else if fail barter start combat
    if (is_success(roll_vs_skill(dude_obj,SKILL_BARTER,0))) then begin
    if (dude_caps >= 20) then begin
    locket_cost := 20;
    item_caps_adjust(self_obj,20);
    item_caps_adjust(dude_obj,-20);
    call Node007;
    end else begin
    call Node008;
    end
    end else begin
    call Node998;
    end
    end
    procedure Node989 begin
    set_gave_locket;
    give_pid_qty(dude_obj, PID_ANNA_GOLD_LOCKET, 1)
    end
    procedure Node988 begin
    // if male, goto 12, if female goto 13
    if (dude_is_male) then call Node012;
    else call Node013;
    end
    procedure Node987 begin
    // lower reaction, goto 4
    DownReactMinor;
    call Node004;
    end
    procedure Node986 begin
    // roll speech, if successful goto 14, else 15
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,0))) and (dude_strength > self_strength)) then begin
    call Node014;
    end else call Node015;
    end
    procedure Node985 begin
    // if player alone and charisma > 5 goto 13, else 12
    if ((true_party_size > 0) and (dude_charisma > 5)) then begin
    call Node013;
    end else begin
    call Node012;
    end
    end
    procedure Node984 begin
    // setup sex
    gfade_out(ONE_GAME_SECOND);
    do_default_sex;
    UpReact;
    set_local_var(LVAR_Next_Sex_Time, game_time + ONE_GAME_DAY);
    critter_attempt_placement(self_obj, joey_sex_tile, self_elevation);
    critter_attempt_placement(dude_obj, joey_player_sex_tile, self_elevation);
    Face_Critter(dude_obj,self_obj);
    Face_Critter(self_obj,dude_obj);
    gfade_in(ONE_GAME_SECOND);
    flush_add_timer_event_sec(self_obj, 1, timed_event_post_sex);
    end
    procedure Node983 begin
    // roll speech. if successful, goto 14, else lower reaction and start combat
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,0))) and (dude_strength > self_strength)) then begin
    call Node014;
    end else begin
    DownReactMinor;
    call Node998;
    end
    end
    procedure Node982 begin
    // lower reaction and start combat
    DownReactMinor;
    call Node998;
    end
    procedure Node981 begin
    // roll speech, if successful, goto 12, else lower reaction and start combat
    if ((is_success(roll_vs_skill(dude_obj,SKILL_CONVERSANT,0))) and (dude_strength > self_strength)) then begin
    call Node012;
    end else begin
    DownReactMinor;
    call Node998;
    end
    end
    procedure Node980 begin
    // roll barter, if successful goto 24, else 23
    if (is_success(roll_vs_skill(dude_obj,SKILL_BARTER,0))) then begin
    call Node024;
    end else begin
    call Node023;
    end
    end
    procedure Node979 begin
    // if player has money($500) take it and give jet and goto 14, else goto 23
    if (dude_caps >= 500) then begin
    give_pid_qty(dude_obj, PID_JET, 1)
    item_caps_adjust(self_obj,500);
    item_caps_adjust(dude_obj,-500);
    call Node014;
    end else begin
    call Node023;
    end
    end
    procedure Node978 begin
    // take money ($500) and give jet and goto 14
    if (dude_caps >= 500) then begin
    give_pid_qty(dude_obj, PID_JET, 1)
    item_caps_adjust(self_obj,500);
    item_caps_adjust(dude_obj,-500);
    call Node014;
    end else begin
    call Node023;
    end
    end
    procedure Node977 begin
    variable jet := 0;
    // if player has money (350), take money and give jet and goto 14.
    // else goto 23
    if (dude_caps >= 350) then begin
    item_caps_adjust(self_obj,350);
    item_caps_adjust(dude_obj,-350);
    give_pid_qty(dude_obj, PID_JET, 1)
    call Node014;
    end else begin
    call Node023;
    end
    end


    procedure Node000 begin
    call Node994;
    end
    procedure Node001 begin
    debug_msg("Node001");
    Reply(152);
    NOption(153,Node998,004);
    NOption(154,Node996,004);
    NOption(155,Node995,006);
    end
    procedure Node002 begin
    Reply(156);
    debug_msg("Node002");
    debug_msg("gave_locket == "+gave_locket+" / get_anna_locket_pip(anna_locket_pip_assigned) == "+get_anna_locket_pip(anna_locket_pip_assigned)+" / mom_fingered_joey == "+mom_fingered_joey);
    if (get_anna_locket_pip(anna_locket_pip_done) == false) then begin
    if (gave_locket == false) then begin
    if ((get_anna_locket_pip(anna_locket_pip_assigned)) and (mom_fingered_joey)) then begin
    NOption(157,Node003,004);
    end
    end
    end
    NOption(159,Node998,004);
    NOption(160,Node999,004);
    end
    procedure Node003 begin
    debug_msg("Node003");
    Reply(161);
    if (mom_fingered_joey) then begin
    NOption(162,Node004,004);
    end
    NOption(163,Node999,004);
    NOption(164,Node998,007);
    end
    procedure Node004 begin
    debug_msg("Node004");
    Reply(165);
    NOption(166, Node005, 004);
    NOption(167, Node998, 004);
    NOption(300, Node999, 004);
    end
    procedure Node005 begin
    debug_msg("Node005");
    Reply(168);
    NOption(169,Node006,004);
    NOption(170,Node993,004);
    NOption(171,Node992,006);
    end
    procedure Node006 begin
    debug_msg("Node006");
    Reply(172);
    NOption(173,Node991,004);
    NOption(174,Node990,004);
    NOption(175,Node999,004);
    NOption(176,Node993,004);
    end
    procedure Node007 begin
    debug_msg("Node007");
    Reply(177);
    NOption(178,Node989,004);
    NOption(179,Node989,006);
    end
    procedure Node008 begin
    debug_msg("Node008");
    Reply(180);
    NOption(181,Node999,004);
    NOption(182,Node993,004);
    end
    procedure Node009 begin
    debug_msg("Node009");
    Reply(183);
    NOption(184,Node988,004);
    NOption(185,Node012,004);
    debug_msg("gave_locket == "+gave_locket+" / get_anna_locket_pip(anna_locket_pip_assigned) == "+get_anna_locket_pip(anna_locket_pip_assigned)+" / mom_fingered_joey == "+mom_fingered_joey);
    if (get_anna_locket_pip(anna_locket_pip_done) == false) then begin
    if (gave_locket == false) then begin
    if ((get_anna_locket_pip(anna_locket_pip_assigned)) and (mom_fingered_joey)) then begin
    NOption(186,Node003,004);
    end
    end
    end
    end
    procedure Node010 begin
    debug_msg("Node010");
    Reply(188);
    NOption(189,Node015,004);
    NOption(190,Node012,004);
    NOption(191,Node999,004);
    NOption(192,Node016,004);
    end
    procedure Node011 begin
    debug_msg("Node011");
    Reply(193);
    NOption(194,Node986,004);
    NOption(195,Node985,004);
    NOption(196,Node016,004);
    NOption(197,Node014,004);
    end
    procedure Node012 begin
    debug_msg("Node012");
    Reply(198);
    NOption(199,Node014,004);
    NOption(200,Node022,004);
    NOption(201,Node016,004);
    NOption(202,Node999,004);
    end
    procedure Node013 begin
    debug_msg("Node013");
    Reply(203);
    NOption(204,Node984,004);
    NOption(205,Node983,004);
    NOption(206,Node016,004);
    end
    procedure Node014 begin
    debug_msg("Node014");
    Reply(207);
    NOption(208,Node999,004);
    NOption(209,Node999,004);
    NOption(210,Node016,004);
    end
    procedure Node015 begin
    debug_msg("Node015");
    Reply(211);
    NOption(212,Node982,004);
    NOption(213,Node981,004);
    NOption(214,Node012,004);
    end
    procedure Node016 begin
    debug_msg("Node016");
    Reply(215);
    debug_msg("gave_locket == "+gave_locket+" / get_anna_locket_pip(anna_locket_pip_assigned) == "+get_anna_locket_pip(anna_locket_pip_assigned)+" / mom_fingered_joey == "+mom_fingered_joey);
    if (get_anna_locket_pip(anna_locket_pip_done) == false) then begin
    if (gave_locket == false) then begin
    if ((get_anna_locket_pip(anna_locket_pip_assigned)) and (mom_fingered_joey)) then begin
    NOption(157,Node003,004);
    end
    end
    end
    if (know_church) then begin
    NOption(218,Node017,004);
    end
    NOption(219,Node015,004);
    if (vault_13_visible_on_map == false) then begin
    NOption(220,Node025,004);
    end
    NOption(221,Node999,004);
    end
    procedure Node017 begin
    debug_msg("Node017");
    Reply(222);
    NOption(223,Node018,004);
    NOption(224,Node016,004);
    NOption(225,Node999,004);
    end
    procedure Node018 begin
    debug_msg("Node018");
    if (gangwar(state_gangwar_2won)) then begin
    Reply(350 + lara_dead);
    end else begin
    Reply(226);
    end
    NOption(227,Node019,004);
    if (new_reno_visible_on_map == false) then begin
    NOption(228,Node020,004);
    end
    NOption(229,Node021,004);
    NOption(230,Node016,004);
    NOption(231,Node999,004);
    end
    procedure Node019 begin
    debug_msg("Node019");
    Reply(232);
    NOption(233,Node018,004);
    NOption(234,Node016,004);
    NOption(235,Node999,004);
    end
    procedure Node020 begin
    debug_msg("Node020");
    mark_new_reno_on_map
    Reply(236);
    NOption(237,Node018,004);
    NOption(238,Node016,004);
    NOption(239,Node999,004);
    end
    procedure Node021 begin
    debug_msg("Node021");
    Reply(240);
    NOption(241,Node018,004);
    NOption(242,Node016,004);
    NOption(243,Node999,004);
    end
    procedure Node022 begin
    debug_msg("Node022");
    Reply(244);
    NOption(245,Node014,004);
    NOption(246,Node016,004);
    NOption(247,Node980,004);
    NOption(248,Node979,004);
    end
    procedure Node023 begin
    debug_msg("Node023");
    Reply(249);
    NOption(250,Node978,004);
    NOption(251,Node016,004);
    NOption(252,Node999,004);
    end
    procedure Node024 begin
    debug_msg("Node024");
    Reply(253);
    NOption(254,Node016,004);
    NOption(255,Node977,004);
    NOption(256,Node999,004);
    end
    procedure Node025 begin
    debug_msg("Node025");
    Reply(257);
    NOption(258,Node015,004);
    NOption(259,Node016,004);
    NOption(260,Node012,004);
    NOption(261,Node999,004);
    end


    =====


    Thanks a lot!



    Greetings
    Jona
     
  10. jargo

    jargo Where'd That 6th Toe Come From?

    492
    May 25, 2003
  11. jona0

    jona0 First time out of the vault

    94
    Apr 4, 2003
    @Jargo
    Thanks a lot!
    It works as it should....

    Perhaps you can give me another help ????
    Heres another script:

    ========
    /*
    Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
    */

    /*
    Name: Kaga Encounter 5
    Location: Random Encounter
    Description:

    Log:
    Please note any changes that have been made to the file in Updated. Then comment
    the code which you have changed/altered/commented out. Please, do not delete any
    code which was written.

    Created:

    Updated:
    */

    /* Include Files */

    /* Note, the Following Lines need to be in this order so that
    the script will be compilable. The define Name is referenced
    in a module from define.h and used in command.h. Please do
    not change the ordering.
    -rwh2 11/13/97
    */
    #include "..\headers\define.h"
    //#include "..\headers\<TownName.h>"

    #define NAME SCRIPT_ECKAGA5
    //#define TOWN_REP_VAR (GVAR_TOWN_REP_)

    #include "..\headers\command.h"
    #include "..\headers\ModReact.h"


    /* Standard Script Procedures */
    procedure start;
    procedure critter_p_proc;
    procedure pickup_p_proc;
    procedure talk_p_proc;
    procedure destroy_p_proc;
    procedure look_at_p_proc;
    procedure description_p_proc;
    procedure use_skill_on_p_proc;
    procedure damage_p_proc;
    procedure map_enter_p_proc;
    procedure combat_p_proc;

    /* Script Specific Procedure Calls */
    procedure Node998; // This Node is Always Combat
    procedure Node999; // This Node is Always Ending


    // The next lines are added in by the Designer Tool.
    // Do NOT add in any lines here.
    //~~~~~~~~~~~~~~~~ DESIGNER TOOL STARTS HERE
    #define TAUNT_CHANCE 50

    procedure Node001;
    procedure NodeFleeing;
    procedure NodeFighting;

    //~~~~~~~~~~~~~~~~ DESIGN TOOL ENDS HERE
    // The Following lines are for anything that is not needed to be
    // seen by the design Tool


    /* Local Variables which are saved. All Local Variables need to be
    prepended by LVAR_ */
    #define LVAR_Herebefore (4)
    #define LVAR_Hostile (5)
    #define LVAR_Personal_Enemy (6) //Also used to as a run flag

    /* Imported variables from the Map scripts. These should only be
    pointers and variables that need not be saved. If a variable
    Needs to be saved, make it a map variable (MVAR_) */


    /* Local variables which do not need to be saved between map changes. */
    variable Only_Once:=0;

    procedure start begin
    end

    procedure combat_p_proc begin
    if (critter_is_fleeing(self_obj)) then begin
    call NodeFleeing;
    end else begin
    call NodeFighting;
    end
    end

    /* This procedure will get called each time that the map is first entered. It will
    set up the Team number and AI packet for this critter. This will override the
    default from the prototype, and needs to be set in scripts. */
    procedure map_enter_p_proc begin
    variable obj;

    Only_Once:=0;
    critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_RND_KAGA);
    critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_KAGA);
    set_kaga_4;

    check_restock_item(PID_GATLING_LASER, 1, 1, 100)
    check_restock_item(PID_PLASMA_GRENADE, 3, 3, 100)
    check_restock_item(PID_STIMPAK, 5, 5, 100)
    check_restock_item(PID_MICRO_FUSION_CELL, 3, 3, 100)
    check_restock_item(PID_BOTTLE_CAPS, 5000, 5000, 100)
    check_restock_item(PID_YK42B_PULSE_RIFLE, 1, 1, 100)
    obj := self_item(PID_GATLING_LASER);
    if (obj) then begin
    wield_obj(obj);
    end

    if (kaga_met) then set_local_var(LVAR_Herebefore, 1);
    end


    /* Every heartbeat that the critter gets, this procedure will be called. Anything from
    Movement to attacking the player on sight can be placed in here.*/
    procedure critter_p_proc begin

    /* If the critter is mad at the player for any reason, it will attack and remember to attack
    the player should the game be saved and loaded repeatedly. Additionally, if any special
    actions need to be taken by the critter based on previous combat, the critter will remember
    this as well. */

    if (obj_can_see_obj(self_obj, dude_obj)) then begin
    attack(dude_obj);
    end
    end

    /* Whenever the critter takes damage of any type, this procedure will be called. Things
    like setting ENEMY_ and LVAR_Personal_Enemy can be set here. */
    procedure damage_p_proc begin

    /* If the player causes damage to this critter, then he will instantly consider the player
    his personal enemy. In Critter_Proc or through dialog, actions will be taken against
    the player for his evil acts. */
    if (source_obj == dude_obj) then begin
    set_local_var(LVAR_Personal_Enemy,1);
    end

    end

    /* Any time that the player is caught stealing from this critter, Pickup_proc will be called.
    In here, various things can happen. The most common response is instant hostility which
    will be remembered. */
    procedure pickup_p_proc begin
    if (source_obj == dude_obj) then begin
    set_local_var(LVAR_Hostile,2);
    end
    end

    /* The dialog system is setup and prepares the player to talk to this NPC. Where To Go
    written by designers are placed in here. Additionally, Reactions are generated and
    stored which affects player interactions. */
    procedure talk_p_proc begin
    end

    /* This procedure gets called only on the death of this NPC. Special things like
    incrementing the death count for reputation purposes and Enemy Counters are placed
    in here. */
    procedure destroy_p_proc begin

    /* Increment the aligned critter counter*/
    inc_evil_critter

    /* Set global_variable for Enemy status*/
    set_kaga_dead;
    set_kaga_met;
    end

    /* Look_at_p_proc gets called any time that the player passes the cursor over any object.
    This should only hold the most cursory of glances for the player. */
    procedure look_at_p_proc begin
    script_overrides;
    if (local_var(LVAR_Herebefore) == 0) then begin
    display_msg(mstr(100));
    end else begin
    display_msg(mstr(101));
    end
    end

    /* The player will see more indepth descriptions from this procedure. They are actively
    looking at the critter and want more information. Things like names can be added here
    if the critter is known to the player. */
    procedure description_p_proc begin
    script_overrides;
    display_msg(mstr(102));
    end

    /* Any time a skill is used on a critter this call is made. This can be to give examinations
    for things like Doctor skill or messages for various other skills. */
    procedure use_skill_on_p_proc begin
    end

    /* Should the Player ever cause the NPC too much discomfort that he desires to attack the player,
    this call will be made. Essentially, it stores the Hostile vaule so that the critter remembers
    he was once hostile towards the player.*/
    procedure Node998 begin
    set_local_var(LVAR_Hostile,2);
    end

    /* Anytime that there is a need for an ending to dialog, this node is to be called. It will just
    exit from the dialog system without any reprisals from the NPC. */
    procedure Node999 begin
    end


    // Not lines are allowed to be added below here
    // The Following lines are from the Design Tool
    //~~~~~~~~~~~~~~~~ DESIGN TOOL STARTS HERE

    procedure Node001 begin
    end

    procedure NodeFleeing begin
    end

    procedure NodeFighting begin
    variable rnd := 0;

    rnd := Random(103, 111);

    if ((rnd == 103 or rnd == 104) and not kaga_met) then rnd := 105;

    if (rnd == 108) then begin
    CheckKarma;
    if not (has_rep_shield) then begin
    rnd := 110;
    end
    end

    if (rnd == 109) then begin
    CheckKarma;
    if not (has_rep_sword) then begin
    rnd := 110;
    end
    end

    float_msg(self_obj, mstr(rnd), FLOAT_MSG_RED);
    if (rnd == 104 or rnd == 105 or rnd == 111) then begin
    set_local_var(LVAR_Herebefore, 1);
    set_kaga_met;
    end
    end


    //xxxxxxxxxxxxxxxxxxxx


    ========

    That would be nice!
    Many thanks in advance

    Ny the way: How do you do this?
    Is there a chance to get a WORKING(installed) compiler for this ?



    Greetings
    Jona
     
  12. jargo

    jargo Where'd That 6th Toe Come From?

    492
    May 25, 2003
  13. Alakhai

    Alakhai First time out of the vault

    5
    Jul 22, 2004
    I have a problem with writting a script in which a critter attacks player i was trying to use
    attack(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
    attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);

    (These numbers are used in original scripts from the game, tried others but didn't make a change , they are described in the manual)

    I tried to call them in look_at_p_proc & talk_p_proc(i think standard for testing). No success.

    Could any1 give me an example of a script in which critter enters combat mode and attacks player? Should it be map script or can it be critter script?

    Btw here my notes about critter_dmg function , hope it's helpful to anyone.I coudn't make critter_damage work ,which is mentioned in the manual("symbol not found")
    (Basically this function deals dmg to a critter)
    Syntax:
    critter_dmg(pointer,damage_amount_integer,dieway_integer);

    pointer is usually self_obj

    dieway <- it's actually type of damage, death animation depends on it
    <0 No death animation(critter flattens on the ground dead)
    0 Smaller Corpse Explosion*
    1 Cut in Half
    2 Burn**
    3 Melt
    4 Electric Shock
    5 EMP***
    6 Big Corpse Explosion****
    >6 No Death Animations Buggy

    The function seems to work only once? Calling it again won't do anything.

    Didn't found normal dead animation (critter falls to the ground and spills blood)

    * Enclave(adv power armour) death animation does not exit
    ** Alien death animation does not exit
    *** Harms only robots
    **** It is proper die way for Horrigan , otherwise he dies crouching in his blood.
     
  14. Frank Horrigan@BIS

    Frank Horrigan@BIS Still Mildly Glowing

    241
    Apr 3, 2003
    Heh, this thread is getting popular ;-)

    Anyway, new problem (getting used to it :P).

    procedure chance
    begin
    if (op_has_skill(op_dude_obj(), 13) >= 140) then
    call fixed();
    else
    call failure();
    end

    I've edited the requirement for repairing the power armor (script used = Armor.int).

    Whenever your repair skill is 140 or more you'll fix the armor and if not you wont. Anyway I would like to give the player a bonus (+10%) when you using a tool on the armor parts. I don't know how many things I've tried but a fact is that I can't get this to work on my own. I've actually asked this question before in this thread but doesn't anyone know (remember this is a Fallout 1 script file)?
     
  15. jargo

    jargo Where'd That 6th Toe Come From?

    492
    May 25, 2003
    In most cases scripts uses attack(dude_obj); attack is a macro to attack_complex.
    Almost always attack is made in critter_p_proc using LVAR_Hostile variable as a flag.

    Code:
    if (local_var(LVAR_Hostile) == 2) then begin
              set_local_var(LVAR_Hostile,1);
              attack(dude_obj);
    

    To Frank Horrigan@BIS

    Well you should use use_obj_on_p_proc but in FO1 you must call it in start_p_proc.
    Then in use_obj_on_p_proc something like that

    Code:
    procedure use_obj_on_p_proc begin
       variable Tool;
    
       Tool:=obj_pid(obj_being_used_with);
    
       if (Tool == KEY_CARD_PID) then
       begin
          script_overrides;
          debug_msg("BSELEV: used v15 secret keycard on door");
          obj_unlock(self_obj);
        end
    end
    
     
  16. jona0

    jona0 First time out of the vault

    94
    Apr 4, 2003
    Hi!

    Hello Jargo!
    Thanks again for your help.
    Very kind of you.....

    Pity, that I couldnt get any of these compilers to work ;-(((
    (At least those, which are free....)



    Greetings
    Jona
     
  17. jargo

    jargo Where'd That 6th Toe Come From?

    492
    May 25, 2003
    huh but what is the problem?
    BTW: FSE and Fallout compiler are both free.
    You may try Noid's compiler too.
     
  18. jona0

    jona0 First time out of the vault

    94
    Apr 4, 2003
    Hello!

    FSE doesnt have a compiler (at least I didnt find one)
    All the other always give Errors even on the scripts which were included in the mapper-package - so any changes wont work too ;-(

    I assume, they dont find the header files.
    Seems I am just too stupid for this ;-(



    Greetings
    Jona
     
  19. Alakhai

    Alakhai First time out of the vault

    5
    Jul 22, 2004
    I actually found out that the problem with critter not attacking a player is not in the script. While testing a map in the editor(F8) ,the attack(obj_dude) statements are ignored. Do you have other methods of testing such scripts? Is there a way to turn on the attack feature in the editor?
     
  20. jargo

    jargo Where'd That 6th Toe Come From?

    492
    May 25, 2003
    huh i forgot about this :o

    To Jona0

    FSE uses original compiler.

    5 steps to compile script

    1)Get compiler (compile.exe and Dos4gw.exe) in C:\Program Files\Black Isle\Fallout 2 Mapper\scripts

    2)Get precompiler Watcom (wcc386.exe,wcc.dll,wccd386.dll) from http://www.openwatcom.com/ftp/zips/c_nt.zip put it to C:\Program Files\Black Isle\Fallout 2 Mapper\scripts

    3)Install FSE and set "Compiler files folder " to C:\Program Files\Black Isle\Fallout 2 Mapper\scripts

    4) Open any script in FSE

    5) click on compile button.... ready :D

    If you get preprocessor error: E1055: Unable to open.....
    then delete ..\ in include statement.

    from this:
    Code:
    ...
    #include "..\headers\define.h"
    
    #include "..\headers\command.h"
    #include "..\headers\ModReact.h"
    ...
    
    Make this:
    Code:
    ...
    #include "headers\define.h"
    
    #include "headers\command.h"
    #include "headers\ModReact.h"
    ...