Paralyzer weapon

Discussion in 'Fallout General Modding' started by Ardent, Oct 26, 2009.

  1. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    Hello, people.

    I'm trying to make a weapon which would paralyze/knock-out opponents. Could be useful for slave raids, etc. So far, I had no luck with it.

    I made the item, it deals slight electrical damage. I added the following to the OBJ_DUDE.int:

    Code:
    procedure combat_p_proc begin
       if (fixed_param == COMBAT_SUBTYPE_HIT_SUCCEEDED) then begin
          if ((obj_pid(critter_inven_obj(self_obj,INVEN_TYPE_RIGHT_HAND)) == PID_TASER) or (obj_pid(critter_inven_obj(self_obj,INVEN_TYPE_LEFT_HAND)) == PID_TASER)) then begin
             float_msg(target_obj,"OUCH!",FLOAT_MSG_RED);
             reg_anim_clear(target_obj);
             reg_anim_begin();
                reg_anim_animate(target_obj,ANIM_fall_back,-1);
             reg_anim_end();
             critter_injure(target_obj,DAM_KNOCKED_OUT);                  
          end
       end
    end
    Now, all the target critter does, is say "ouch!". I tried removing the animation code, but no change.

    I also tried putting a version of this code in the damage_p_proc procedure in the test critter, and the results were as above.

    I thought maybe it's the fault of the combat mode, so I put the code in the description_p_proc procedure to see if it worked out of combat.

    Well, the critter would say "Ouch!" and it would fall to the ground (as ordered by the animation code), but it wouldn't be kocked-out. I could normally talk to it, etc., while what I want to achieve, is to have the critter unconscious, so I could search it, etc.

    Worse still, when I initialised combat, it would stand up and attack me.

    So, if you have any ideas how to solve this problem, I'd be very greatful. Thanks in advance.

    -------------EDIT---------------------

    Forgot to say, I'm using a regular F2 1.02. UK version, I don't have sFall installed.
     
  2. pelicano

    pelicano It Wandered In From the Wastes
    Modder

    129
    Jun 14, 2008
    I've never used the function critter_injure() but it seems it doesn't work properly.

    Why not use sfall? this would be a lot easier with it.
     
  3. Lexx

    Lexx Testament to the ghoul lifespan
    Moderator Modder

    Apr 24, 2005
    Maybe you need to overwrite combat procedure, so that the critter doesn't stand up after the knock out? Would be the first thing to try out... if lvar x == y, then script_override.

    I can't remember correctly right now but I think I used it in a similar way in my SD1 mod, because else the critter stand up and running away each time combat was initialized. I think I've also crippled one or two legs with critter_injure.
     
  4. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    Well, it works as advertised in case of e.g. crippling legs or blinding players. But it indeed seems knock-out is broken.

    Well, I didn't use sFall, because I wanted to save the players the necessity of downloading additional patches when my mod would be out. But I'm having more and more problems with F2 engine's limitations, so I think I'll install it eventually.

    Does sFall fix the critter_injure function, or does it have some other functions which would get the thing done?

    Yeah, I could do that. But then I'd have to edit all critter scripts. Then again, if I used sFall, it would be easy to apply such a modification.

    Anyway, thanks guys, I'll see what I can cook up with sFall.
     
  5. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    It doesn't touch critter_injure. With sfall, I'd probably do it with a combat damage hook, and apply the knocked out special effect flag based on a weapon check.
     
  6. Darkform

    Darkform First time out of the vault

    76
    Nov 27, 2008
    talking about knockout I would like to see someone make a item cloraform can be used out of combat but makes people alied with the person you use it on hostile like as if you used steal skill and failed unless they didn't see or hear you do it so silent killer perk and sneeking could alter other peoples responses. but in combat it may be somethin like a HTH attack with Cloriform cloth and the actual cloriform is ammo (I just thought of the cloth so it can be used for out of combat also if it has a charge in it.). the cloth would only hold 1 charge makeing for a little slower hth attack if used on more than 1 person in combat BUT it would auto knockout anyone not wearing any type of power armor, environmental suit or gas mask.

    about graphics I forget if there is a god cloth in game but there are mods with the graphic for super burn fule mix that could be used for the cloriform ammo graphic. places you could get ahold of cloriform would be slavers, any doctor (probably only if you convince them it is for healing purposes so your pationts don't fell pain while you operate on them.) the cloth could be anywhere and it could be just labled as cloth and do no actual damage in combat but the cloriform could be loaded into the cloth makeing it where you have to script the ammo doing the knockout and maybe +1 damage mod if there is a bug. with cloth like that you can also have other liquid ammo like FEV viruse or something that does other things (ie: FEV iradiates, poison poisons and does extra damage and so on.) but you will have to figure out where you can get those ammos yourself.

    some of these ideas can after implemented be used in new quests like haveing FEV ammo or irated sludge ammo would be use in a quest maybe that guy in vault outer city that was irated wants you to irate a valt citizen or something.

    well I'm bableing all I realy want is a HTH auto knockout that can also be used out of combat.
     
  7. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    Thanks, Timeslip, I'll give it a try and update the thread with the results and possibly further questions :-)
     
  8. pelicano

    pelicano It Wandered In From the Wastes
    Modder

    129
    Jun 14, 2008
    The little hassle that could possibly be installing sfall for both players and modders is totally worth it.

    This little script is just an example but it's a start about how I would do it:

    [spoiler:787374f758]#include "..\HEADERS\sfall.h"
    /* aditional headers here */

    procedure start;

    procedure start begin
    variable begin
    oTarget; iTarget_dmg; iTflag;
    oAttacker; iAttacker_dmg; iAflag;
    oWeapon;
    end

    if (game_loaded) then begin
    register_hook(HOOK_COMBATDAMAGE);
    end else begin
    oTarget := get_sfall_arg;
    oAttacker := get_sfall_arg;
    iTarget_dmg := get_sfall_arg;
    iAttacker_dmg := get_sfall_arg;
    iTflag := get_sfall_arg;
    iAflag := get_sfall_arg;
    oWeapon := get_sfall_arg;

    /* Special Effects */
    if(obj_pid(oWeapon) == PID_TASER)then begin
    if(not(iTflag BWAND DAM_KNOCKED_OUT))then begin
    iTflag := (iTflag BWOR DAM_KNOCKED_OUT);
    end
    float_msg(oTarget,"Ouch!",FLOAT_MSG_RED);
    end

    set_sfall_return(iTarget_dmg);
    set_sfall_return(iAttacker_dmg);
    set_sfall_return(iTflag);
    set_sfall_return(iAflag);
    end
    end
    [/spoiler:787374f758]

    You'd probably want to limit the knock out effect to avoid knocking out robots and the like, maybe. Also, this script should be compatible with any mod unless it uses a combat damage hook too, in which case the combat damage arguments may get overriden.
     
  9. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    Yup, something like that was what I was thinking. One change I'd advise though would be moving the 'procedure start;' line above the includes, if you start including anything other than sfall.h. sfall tends to throw a hissy fit if the start procedure isn't the first one declared in a script, and some of the fallout include files contain procedures.
     
  10. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    So, I've a silly question:

    Is there, and if yes, where, a version of sfall for F2 1.02. UK ver.?

    I tried googling it, I looked at Timeslip's homepage, I looked on NMA, but no luck so far. :?

    Thanks in advance :)
     
  11. brother_soifran

    brother_soifran Look, Ma! Two Heads!

    396
    Oct 14, 2008
  12. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    Thanks, brother_soifran,

    I had a look at these, but it's all intended for the US version of Fallout, or so it says in the readme and when I try to launch the game.

    Any way to go around it?

    EDIT--------------------

    It's OK now. I used the exe file from Killap's patch. It seems to work. I'll have to test it now :-)

    Thank you all.
     
  13. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    Argg, who's been mirroring such ancient versions of sfall? :violent: Link back to my homepage if you aren't going to make any effort to keep downloads up to date. (Edit: And on a related note, why do people always seem to capitalize the s in my name? Always been a bit curious where that came from. :P)

    Anyway, to answer the actual question, no, there is no uk version. Just overwrite your exe with the US version; there's no functional difference between the two.
     
  14. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    Maybe because there are two very common English words "time" and "slip", while timeslip is so much rarer and moreover, it is sometimes written separately? And maybe because it's quite en vogue to capitalise letters inside a word (like I did with sfall, because I thought the spelling was sFall ?)

    Thanks, I just did that. :-)
     
  15. brother_soifran

    brother_soifran Look, Ma! Two Heads!

    396
    Oct 14, 2008
    To TIMEsLIP :)
    you're right, I have forgot to check your forum for new version of sFALL :) since few month.
    I go to update this asap.
    Schuuss

    Bro'
     
  16. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    Actually sfall doesn't mean or stand for anything. It just happened to be a convenient 5 letter word to use for the win 9x version that needed a renamed dll; I always used to refer to the mod itself as 'fallout 2 engine tweaks'. I can't remember who started using sfall as the mod name first. Probably me when I got board of typing.

    :P
     
  17. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    I downloaded sfall, I enjoy various gameplay benefits that it offers, and I have a more or less working version of the paralyzer weapon global script.

    A big thank you to both Pelicano and Timeslip for their insight and advice.

    So, the script is based on Pelicano's:

    [spoiler:5ff0ed9a6e]
    Code:
    procedure start; 
    
    #include "..\HEADERS\sfall.h" 
    #include "C:\Gry\Fallout 2\Fallout 2 Mapper\scripts\HEADERS\DEFINE.H"
    #include "C:\Gry\Fallout 2\Fallout 2 Mapper\scripts\HEADERS\COMMAND.H"
    
    #define NAME                    SCRIPT_GLPRLYSR
    
    /* aditional headers here */ 
    
    
    procedure start begin 
       variable begin 
          oTarget; iTarget_dmg; iTflag; 
          oAttacker; iAttacker_dmg; iAflag; 
          oWeapon; 
       end 
    
       if (game_loaded) then begin
          set_global_script_type(0);
          register_hook(HOOK_COMBATDAMAGE); 
       end 
       else begin 
          oTarget := get_sfall_arg; 
          oAttacker := get_sfall_arg; 
          iTarget_dmg := get_sfall_arg; 
          iAttacker_dmg := get_sfall_arg; 
          iTflag := get_sfall_arg; 
          iAflag := get_sfall_arg; 
          oWeapon := get_sfall_arg; 
       
          /* Special Effects */ 
          if(obj_pid(oWeapon) == PID_TASER)then begin 
             if (proto_data(oTarget,cr_body_type) == CR_BODY_ROBOTIC) then begin
                script_overrides;
                display_msg("The Paralyser doesn't seem to have any effect on this critter.");
             end
             else begin
                if (is_success(do_check(oTarget,STAT_en,-1))) then begin
                   script_overrides;
                   float_msg(oTarget,"Ouch!",FLOAT_MSG_RED);
                   if (not(iTflag BWAND DAM_KNOCKED_DOWN)) then begin 
                      iTflag := (iTflag BWOR DAM_KNOCKED_DOWN); 
                   end
                end
                else begin
                   if (not(iTflag BWAND DAM_KNOCKED_OUT)) then begin 
                      iTflag := (iTflag BWOR DAM_KNOCKED_OUT); 
                   end
                end
             end
          end 
          
          set_sfall_return(iTarget_dmg); 
          set_sfall_return(iAttacker_dmg); 
          set_sfall_return(iTflag); 
          set_sfall_return(iAflag); 
       end 
    end
    [/spoiler:5ff0ed9a6e]

    As you can see, I made some adjustments, namely a block for robotic critters from getting knocked out and an endurance check for all other critters, so it's harder to knock out tough ones.

    The thing is, these adjustments don't work. I mean, the weapon knocks out all critters, regardless of these blocks. So maybe if you could have a look at this and see if I made some mistakes? I'd be very greatful.
     
  18. pelicano

    pelicano It Wandered In From the Wastes
    Modder

    129
    Jun 14, 2008
    It's: proto_data(obj_pid(oTarget),cr_body_type)

    The function do_check() always return 0 for me in global scripts, so maybe it doesn't work as it should. I'd recomend scripting yourself the check to be sure.

    One thing though. Why are you using script_overrides, exactly? Does that even work? and if it does, what are you overriding?
     
  19. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    No, script_overrides in a global script may do any of of nothing, crash the script, or crash whichever script runs next.
     
  20. Ardent

    Ardent A Smooth-Skin
    Modder

    678
    Jul 24, 2009
    OK, everyone!

    The script is now ready and it works as I intended it to. It doesn't have any effect on robotic creatures (those which body type is set to robotic), and as for other critters, it will knock them out if they fail an Endurance check. If they succeed, they will be knocked down and say "Ouch!" so you can actually make a difference.

    I scripted the Endurance roll myself, as suggested by Pelicano, but I'm not sure if the formula is correct. I read here that SPECIAL was using GURPS's ruleset, so I had a look at GURPS and since it's a 3d6 system, I'm doing a random (3,18) roll against target's Endurance with a +4 bonus. The bonus is from the fact that an average STAT value in GURPS is 10, while in SPECIAL it's 5. I wanted the roll to be done with -1 penalty, hence the +4 modifier.

    You can now add several different weapons to use this script, just edit the is_paralyser_weapon macro.

    If anyone wishes to use this script in their mods, feel free to do so. I'll post some paralyser graphics when I have one 8-)

    Again, BIG thanks to Pelicano and Timeslip. Your contributions were invaluable, and to tell the truth, it's you who should be credited for this script :) A special thanks to MIB88 for support and advice.

    So, here it is:

    [spoiler:ae761f9baf]
    Code:
    procedure start; 
    
    #include "..\HEADERS\sfall.h" 
    #include "C:\Gry\Fallout 2\Fallout 2 Mapper\scripts\HEADERS\DEFINE.H"
    #include "C:\Gry\Fallout 2\Fallout 2 Mapper\scripts\HEADERS\COMMAND.H"
    
    #define NAME                    SCRIPT_GLPRLYSR
    
    /* aditional headers here */ 
    
    #define do_en_check              en_dice_roll:=random(3,18); \
                                     if (((get_critter_stat(oTarget,STAT_en)) + 4) <= en_dice_roll) then begin \
                                        roll_successfull:=1; \
                                     end else begin \
                                        roll_successfull:=0; \
                                     end
    #define is_paralyser_weapon      (obj_pid(oWeapon) == PID_TASER) //Add here appropriate weapon PID(s)
    
    procedure start begin 
       variable begin 
          oTarget; iTarget_dmg; iTflag; 
          oAttacker; iAttacker_dmg; iAflag; 
          oWeapon; en_dice_roll:=0; roll_successfull:=0;
       end 
    
       if (game_loaded) then begin
          set_global_script_type(0);
          register_hook(HOOK_COMBATDAMAGE); 
       end 
       else begin 
          oTarget := get_sfall_arg; 
          oAttacker := get_sfall_arg; 
          iTarget_dmg := get_sfall_arg; 
          iAttacker_dmg := get_sfall_arg; 
          iTflag := get_sfall_arg; 
          iAflag := get_sfall_arg; 
          oWeapon := get_sfall_arg; 
       
          /* Special Effects */ 
          if (is_paralyser_weapon) then begin 
             if (proto_data(obj_pid(oTarget),cr_body_type) == CR_BODY_ROBOTIC) then begin
                display_msg("The Paralyser doesn't seem to have any effect on this critter.");
             end
             else begin
                do_en_check
                if (roll_successfull == 1) then begin
                   float_msg(oTarget,"Ouch!",FLOAT_MSG_RED);
                   if (not(iTflag BWAND DAM_KNOCKED_DOWN)) then begin 
                      iTflag := (iTflag BWOR DAM_KNOCKED_DOWN); 
                   end
                end
                else begin
                   if (not(iTflag BWAND DAM_KNOCKED_OUT)) then begin 
                      iTflag := (iTflag BWOR DAM_KNOCKED_OUT); 
                   end
                end
             end
          end 
          
          set_sfall_return(iTarget_dmg); 
          set_sfall_return(iAttacker_dmg); 
          set_sfall_return(iTflag); 
          set_sfall_return(iAflag); 
       end 
    end
    [/spoiler:ae761f9baf]