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...


    [Code Tutorial]Making Enemies Enter Pain States Less

    Share

    Airslide
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 115
    Age : 22
    Location : Central Valley [Formerly Bay Area] (California USA)
    Job : Student
    Hobbie : Indie Game Development
    Registration date : 2007-05-17

    [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Airslide on Tue May 22, 2007 9:00 pm

    You know how in Doom enemies only sometimes entered their pain states when getting hit? Ever wanted that simple effect in Wolf? Now ya can! And it's only 3 lines of code to add.

    First, open up wl_state.c and search for the Damage Actor() routine. Look for this block:
    Code:
    switch (ob->obclass)      // dogs only have one hit point
          {
          case guardobj:
             if (ob->hitpoints&1)
                NewState (ob,&s_grdpain);
             else
                NewState (ob,&s_grdpain1);
             break;

          case officerobj:
             if (ob->hitpoints&1)
                NewState (ob,&s_ofcpain);
             else
                NewState (ob,&s_ofcpain1);
             break;
    and so on...

    Right above that, add this:
    Code:

          if (US_RndT()/6<20)
          {

    Now go down the the } holding the select block, here:

    Code:
          case ssobj:
             if (ob->hitpoints&1)
                NewState (ob,&s_sspain);
             else
                NewState (ob,&s_sspain1);

             break;

          }

    Right below that }, add another }. Ta da! You're done! Now a little more than half the time the enemies go into their pain states, while in other cases they just receive the damage! Good if you have the blood splat tutorial, so the player can see their still hitting.

    Now, getting into the code. Let's say you want them to get into their pain states more/less often. Simple. Look at this code:
    Code:
    if (US_RndT()/6<20)
    If you want them to enter the pain states more often, raise the 6 to a higher value such as 8 or 10. If you want them to enter the pain states less often, place a lower value such as 4. Careful - too high a value or too low a value and the feature may never happen or may happen so rarely the player never notices it.

    Also, would you like you're knife to cause enemies to always enter pain states? Quite simple. Modify this line:
    Code:
    if (US_RndT()/6<20)
    to this:
    Code:
    if (US_RndT()/6<20 || gamestate.weapon==wp_knife)

    Now enemies alway enter pain states if stabbed. Hoped you liked the simple tut, and happy wolfing Smile !

    EDIT: It could be modified further so diffrent enemies react to shots more/less often - ex. the officer reacts to shots rarely, while the guard does 90% of the time. But I'll leave that up to you.




    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Tue May 22, 2007 10:32 pm

    huh, what is this??? what are pain states less?

    Airslide
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 115
    Age : 22
    Location : Central Valley [Formerly Bay Area] (California USA)
    Job : Student
    Hobbie : Indie Game Development
    Registration date : 2007-05-17

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Airslide on Wed May 23, 2007 4:44 pm

    You know in Doom (if you've played it) they don't always fly their head back or move when they get hit? Pain states are when they go through the pain frames in the VSWAP. What this does is make it so that they still go into them sometimes, but not always, meaning you get a doom like effect (and making it more difficult to deal with the SS guards when using a machinegun)




    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Dark_wizzie on Wed May 23, 2007 5:15 pm

    sounds so technical =)



    Wolf3d Haven
    Minute Logic Blog

    Airslide
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 115
    Age : 22
    Location : Central Valley [Formerly Bay Area] (California USA)
    Job : Student
    Hobbie : Indie Game Development
    Registration date : 2007-05-17

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Airslide on Wed May 23, 2007 8:57 pm

    Lol...yes, prehaps. But I've found it really impacts gameplay, SS guards on hard skill levels are much more difficult, and the original guards can sometimes get a shot on you now! Smile




    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Wed May 23, 2007 10:33 pm

    huh, I still dont understand. that they make different pain moves or something? can you make a screen?

    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Dark_wizzie on Thu May 24, 2007 6:36 am

    i think what airslide emans is like...when you hit an ss or guard, they stop momentarily do to 'pain'. but you can make it so some guards dont go through that process. and if not, some guards and ss can shoot you. and you cant take an ss down with a knife.



    Wolf3d Haven
    Minute Logic Blog

    Airslide
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 115
    Age : 22
    Location : Central Valley [Formerly Bay Area] (California USA)
    Job : Student
    Hobbie : Indie Game Development
    Registration date : 2007-05-17

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Airslide on Thu May 24, 2007 6:43 am

    Well, if you make me extra modification, you can still take them down with a knife (as that weapon would always force painstates), it just allows them to get more shots on you when using a pistol or machinegun (chaingun - they'd need alot of health to last long enough Smile )




    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Thu May 24, 2007 8:37 am

    sorry,, but I still dont understand, or do you mean that they have more health? sorry.. but the description is lame.

    ronwolf1705
    Hardcore Wolfer
    Hardcore Wolfer

    Male
    Number of posts : 1252
    Age : 25
    Registration date : 2007-03-26

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by ronwolf1705 on Thu May 24, 2007 10:52 am

    Wolfenstein3D Fan wrote:sorry,, but I still dont understand, or do you mean that they have more health? sorry.. but the description is lame.

    No, your English is lame. Razz

    Inkoppertje. :lol!:

    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Thu May 24, 2007 11:34 am

    no my english is good I always get 9/10's on english in school? so your english is lame..


    En wat is dat nou weer? :S noob

    ronwolf1705
    Hardcore Wolfer
    Hardcore Wolfer

    Male
    Number of posts : 1252
    Age : 25
    Registration date : 2007-03-26

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by ronwolf1705 on Thu May 24, 2007 12:00 pm

    Wolfenstein3D Fan wrote:no my english is good I always get 9/10's on english in school? so your english is lame..


    En wat is dat nou weer? :S noob

    I'm going to quit this discussion, since you clearly didn't understand that I was making a joke.

    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Thu May 24, 2007 12:47 pm

    Oh, sorry then lol!

    Airslide
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 115
    Age : 22
    Location : Central Valley [Formerly Bay Area] (California USA)
    Job : Student
    Hobbie : Indie Game Development
    Registration date : 2007-05-17

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Airslide on Thu May 24, 2007 3:00 pm

    For crying out loud...everyone on DHW got it (I hope). See, in wolf, shoot a guy or knife him. See how he goes into his pain states, playing the frame of getting hit? Usually has blood ya know? Well, this makes it so they only SOMETIMES go into those, meaning that they can shoot while getting hit sometimes. Add that to my new SS update (fire continuously until players out of view like Doom) and your enemies become quite a bit harder.




    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Dark_wizzie on Thu May 24, 2007 9:51 pm

    basically what airslide ment is that when you hit a guard, they kinda wince, or stop a moment in pain. this gives you an adavantage over shooting, as you get to shoot again, and again.
    in mutants this applies, though the time delay (remember they 'wince' or momentarily stop in pain) is shorter.
    in bosses this is no the case. shoot em with chaingun, they dont stop. but they do reload.



    Wolf3d Haven
    Minute Logic Blog

    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Fri May 25, 2007 12:12 am

    ok I understand now! thanks Smile

    oh airslide not everyone knows it..

    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Dark_wizzie on Fri May 25, 2007 4:37 pm

    airslide, he crying out loud sounds like kernal o neil =p



    Wolf3d Haven
    Minute Logic Blog

    Airslide
    Bring em' On!
    Bring em' On!

    Male
    Number of posts : 115
    Age : 22
    Location : Central Valley [Formerly Bay Area] (California USA)
    Job : Student
    Hobbie : Indie Game Development
    Registration date : 2007-05-17

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Airslide on Fri May 25, 2007 7:07 pm

    'kernal' is spelled Colonel. And it's O'Neill. Wink




    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Dark_wizzie on Fri May 25, 2007 7:12 pm

    oh. i like kernal beter =)



    Wolf3d Haven
    Minute Logic Blog

    PicNic
    Veteran
    Veteran

    Male
    Number of posts : 1584
    Age : 23
    Registration date : 2007-04-16

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by PicNic on Sat May 26, 2007 1:45 am

    ..?

    Dark_wizzie
    I am Death Incarnate!
    I am Death Incarnate!

    Male
    Number of posts : 5090
    Age : 22
    Location : USA or Tawain
    Job : Student, Part time Cactuar fanatic
    Hobbie : Planting Cactuars.
    Message : I made this forum when I was 13 High on Drugs
    Registration date : 2007-03-24

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Dark_wizzie on Sat May 26, 2007 11:31 am

    its a movie thingy or tv show. called stargate.



    Wolf3d Haven
    Minute Logic Blog

    Sponsored content

    Re: [Code Tutorial]Making Enemies Enter Pain States Less

    Post by Sponsored content Today at 12:21 pm


      Current date/time is Sat Dec 10, 2016 12:21 pm