Prevent party members from using burst attacks with sfall scripting

NovaRain

Casual Modder
Modder
Moderator
Yet another simple mod. sfall 1.49a added the set_critter_burst_disable function to prevent critters from using burst attacks. Of cause you can edit individual scripts of party members and add set_critter_burst_disable(self_obj, 1); in the "start" procedure, but you'll have to edit about 10 (vanilla) to 13 (RP 2.x) scripts.

A simpler way is packing all codes in a global script:
Code:
// gl_npcnoburst.ssl
#include ".\HEADERS\DEFINE.H"

procedure start;

procedure start begin
    if (game_loaded) then begin
        set_global_script_repeat(60);
    end else begin
        if (party_size > 1) then begin
            if (Sulik_In_Party) then begin
                set_critter_burst_disable(Sulik_Ptr, 1);
            end
            if (Vic_In_Party) then begin
                set_critter_burst_disable(Vic_Ptr, 1);
            end
            if (Miria_In_Party) then begin
                set_critter_burst_disable(Miria_Ptr, 1);
            end
            if (Davin_In_Party) then begin
                set_critter_burst_disable(Davin_Ptr, 1);
            end
            if (MacRae_In_Party) then begin
                set_critter_burst_disable(MacRae_Ptr, 1);
            end
            if (Lenny_In_Party) then begin
                set_critter_burst_disable(Lenny_Ptr, 1);
            end
            if (Marcus_In_Party) then begin
                set_critter_burst_disable(Marcus_Ptr, 1);
            end
            if (Myron_In_Party) then begin
                set_critter_burst_disable(Myron_Ptr, 1);
            end
            if (Robobrain_In_Party) then begin
                set_critter_burst_disable(Robobrain_Ptr, 1);
            end
            if (Robobrain_Human_In_Party) then begin
                set_critter_burst_disable(Robobrain_Human_Ptr, 1);
            end
        // RP 2.x new NPCs
            if (Kitsune_In_Party) then begin
                set_critter_burst_disable(Kitsune_Ptr, 1);
            end
            if (Cat_Jules_In_Party) then begin
                set_critter_burst_disable(Cat_Jules_Ptr, 1);
            end
            if (Dex_In_Party) then begin
                set_critter_burst_disable(Dex_Ptr, 1);
            end
        end
    end
end

Or with the party_member_list function added in sfall 3.6, the code can be much shorter:
Code:
// gl_npcnoburst_new.ssl
#include ".\HEADERS\DEFINE.H"

procedure start;

procedure start begin
    if (game_loaded) then begin
        set_global_script_repeat(60);
    end else begin
        if (party_size > 1) then begin
            variable who;
            foreach who in party_member_list(0) begin
                if (who != dude_obj) then begin
                    set_critter_burst_disable(who, 1);
                end
            end
        end
    end
end
The first code itself is more straightforward and rather quick-n-dirty, but it's easier to implement some fancy stuff like an extra INI to control individual NPCs can use burst or not.

Note: set_critter_burst_disable only works when the weapon has both single and burst modes. If the weapon has only burst mode (e.g. miniguns), critters will still use burst attack with it. So it's still advisable to keep Marcus' hands away from those machine guns. :P
 
Last edited:
I actually have such component in my mod.
But using a global script is probably cleaner, I'll think about revising it.
 
Back
Top