Wolf3d Haven Forum

Please log in or register. Smile
Wolf3d Haven Forum

A friendly Wolfenstein 3D community, about Wolfenstein 3D, the game that gave birth to first person shooters...


    Guards that attack from a close range.

    Share

    Raziel
    Seasoned Wolfer
    Seasoned Wolfer

    Male
    Number of posts : 361
    Age : 28
    Location : Israel
    Hobbie : Blasphemous Noise and Wolfenstein3D
    Registration date : 2007-07-08

    Guards that attack from a close range.

    Post by Raziel on Sun Aug 12, 2007 11:56 pm

    Ok I now I don't deserve full credits on this one, but if you use this code I want you to credit, chris, insurrectionman (he helped me to understand the T_Bite sound system hehe) and me, Razi (or Just Karharis or Ritual Wink)
    Plus even if you think I'm wrong and you don't think I deserve any credits at all I think I still deserve those credits for Putting this code for you guys that maybe want to make this happen. Anyway, 'nuff said.. Let's code!

    First off, Open WL_ACT2.C
    Now do a search for
    Code:
    statetype s_grdshoot2    = {false,SPR_GRD_SHOOT2,20,NULL,T_Shoot,&s_grdshoot3};
    and Change this part to look like this:
    Code:
    statetype s_grdshoot2    = {false,SPR_GRD_SHOOT2,20,NULL,T_Bite,&s_grdshoot3};

    After that go a down a bit and right exactly below that part we've just changed you will see these lines:
    Code:
    statetype s_grdchase1    = {true,SPR_GRD_W1_1,10,T_Chase,NULL,&s_grdchase1s};
    statetype s_grdchase1s    = {true,SPR_GRD_W1_1,3,NULL,NULL,&s_grdchase2};
    And so On... I want you to change all the T_Chase lines (all 4 of them)
    to T_DogChase.

    Now do a search for:
    Code:
    check for byte range
    it will lead you to the T_DogChase function, go down a bit until you'll see these lines:
    Code:
     NewState (ob,&s_dogjump1);
          return;
    now change these two lines to look like this:
    Code:
    if (ob->obclass == guardobj)
                  NewState (ob,&s_grdshoot1);
          else
                  NewState (ob,&s_dogjump1);
          return;
    Now if you got it all correctly you should have a guard that attacks from close range but he still barks because we didn't made any changes to the T_Bite function. So let's do it shall we?
    Okay, do a search for:
    Code:
    PlaySoundLocActor(DOGATTACKSND,ob);
    now I want you to change this line to look like this one:
    Code:
    switch (ob->obclass)
          {
       case dogobj:
          PlaySoundLocActor(DOGATTACKSND,ob);   // JAB
            break;
            case guardobj: // replace guardobj with guard that uses knife sound
          PlaySoundLocActor(NAZIFIRESND,ob); // or whatever u used for the sound
            break;
          }

    Now just change the Guards pistol sound with a swing of a sword sound or whatever you want.. Now the guard is attacking from close range and he doesn't bark! and like my old fella Fat Bastard used to say. ain't that magical? Laughing

    Just don't forget to credit the people I mentioned above including me :muwaha: and there you have it! a guard that attack you from a close range. Hope you understood this rough tutorial because it's my first one Smile So if you got questions about it or whatever please do (NOT) ask me..

    EDIT1: if you want the guard to attack harder like he's shooting you (but only from close range you should leave the first line where we changed the T_Shoot to T_Bite intact. And to make the guard to take less damage with each attack: Apply this quick tutorial by BrotherTank http://diehardwolfers.areyep.com/viewtopic.php?t=1606

    Hope this helps...

    -Razi




    STORMING THE FRONT WITH A SCHMEISSER IN HAND!
    Raziel A.

      Current date/time is Mon Sep 26, 2016 10:19 am