DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[help] changes to the T_Bite function.
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Raziel
DieHard SS
DieHard SS


Joined: 03 Dec 2005
Last Visit: 03 Dec 2009

Topics: 49
Posts: 485
Location: Israhell
israel.gif

PostPosted: Mon Aug 13, 2007 2:06 pm
   Subject: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hello there, I was wondering if anyone could of help me with a little code problem I'm having right now.
I want to know how to add another damage formula to the T_Bite function so it will allow the guard to attack from a close range using the T_Bite but that he will be able to attack a bit stronger. Here's the T_Bite Function just for you to see..
Please if anyone can spare some free time to help me solve this problem I will appreciate it a lot. Thanks.

T_Bite Function:

::: CODE :::
/*
===============
=
= T_Bite
=
===============
*/

void T_Bite (objtype *ob)
{
   long   dx,dy;
   int   hitchance,damage;

   
       PlaySoundLocActor(DOGATTACKSND,ob);   // JAB
     


   dx = player->x - ob->x;
   if (dx<0)
      dx = -dx;
   dx -= TILEGLOBAL;
   if (dx <= MINACTORDIST)
   {
      dy = player->y - ob->y;
      if (dy<0)
         dy = -dy;
      dy -= TILEGLOBAL;
      if (dy <= MINACTORDIST)
      {
         if (US_RndT()<180)
         {
               
            TakeDamage (US_RndT()>>4,ob);
         
                         return;
         }
      }
   }

   return;
}

_________________
Raziel A.
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 2:44 ago.

Topics: 73
Posts: 3765

blank.gif

PostPosted: Tue Aug 14, 2007 2:31 am
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm not sure, but maybe you can just change the TakeDamage to a higher number. It's just a guess, but you can copy T_Bite, rename it and then change the TakeDamage line too (this is just an example):

::: CODE :::

TakeDamage (48,NULL)


Now, every time the guard attack, it'll do 48% damage on the hardest difficulty level, and 12 on the easiest.

You could also change the line too:

::: CODE :::

TakeDamage (US_RndT()>>2,ob);


No there will be more damage and it will appear more, randomly. The damage is also random.

You could also change the US_RndT above the TakeDamage line.
Raziel
DieHard SS
DieHard SS


Joined: 03 Dec 2005
Last Visit: 03 Dec 2009

Topics: 49
Posts: 485
Location: Israhell
israel.gif

PostPosted: Tue Aug 14, 2007 2:47 am
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ronwolf1705 wrote:
I'm not sure, but maybe you can just change the TakeDamage to a higher number. It's just a guess, but you can copy T_Bite, rename it and then change the TakeDamage line too (this is just an example):

::: CODE :::

TakeDamage (48,NULL)


Now, every time the guard attack, it'll do 48% damage on the hardest difficulty level, and 12 on the easiest.

You could also change the line too:

::: CODE :::

TakeDamage (US_RndT()>>2,ob);


No there will be more damage and it will appear more, randomly. The damage is also random.

You could also change the US_RndT above the TakeDamage line.


I tried to duplicate the T_Bite function and tried to make my own fucntion T_Swing. But my game crashed or the other way, the compiler crashed after receiving 24+ errors... Can you please show me how to do it? Neutral
or maybe how just to make 2 damage formulas in the T_Bite function with Cases, Like case guardobj: and case dogobj: (?)

_________________
Raziel A.
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 2:44 ago.

Topics: 73
Posts: 3765

blank.gif

PostPosted: Tue Aug 14, 2007 2:58 am
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Etzem wrote:
I tried to duplicate the T_Bite function and tried to make my own fucntion T_Swing. But my game crashed or the other way, the compiler crashed after receiving 24+ errors... Can you please show me how to do it? Neutral
or maybe how just to make 2 damage formulas in the T_Bite function with Cases, Like case guardobj: and case dogobj: (?)


You could try the 'case guardobj:', I'm sure that will work.

For the other way:

In WL_ACT2.C search for:

::: CODE :::

void   T_Bite (objtype *ob);


Underneath that add:

::: CODE :::

void   T_Bite2 (objtype *ob);


Then search for:

::: CODE :::

statetype s_grdshoot2    = {false,SPR_GRD_SHOOT2,20,NULL,T_Shoot,&s_grdshoot3};


I take the guard as example. Change that line too:

::: CODE :::

statetype s_grdshoot2    = {false,SPR_GRD_SHOOT2,20,NULL,T_Bite2,&s_grdshoot3};


Then search for the T_Bite function. Copy the function and rename it. It will look like this:

::: CODE :::

/*
===============
=
= T_Bite2
=
===============
*/

void T_Bite2 (objtype *ob)
{
   long   dx,dy;
   int   hitchance,damage;


   PlaySoundLocActor(DOGATTACKSND,ob);   // JAB

   dx = player->x - ob->x;
   if (dx<0)
      dx = -dx;
   dx -= TILEGLOBAL;
   if (dx <= MINACTORDIST)
   {
      dy = player->y - ob->y;
      if (dy<0)
         dy = -dy;
      dy -= TILEGLOBAL;
      if (dy <= MINACTORDIST)
      {
         if (US_RndT()<180)
         {
            TakeDamage (US_RndT()>>2,ob); // change this line to your needs
            return;
         }
      }
   }

   return;
}


As you see, I've changed the TakeDamage line, but you can change that to your needs.

I thinks that's all. If there are any problems, let me know.
Raziel
DieHard SS
DieHard SS


Joined: 03 Dec 2005
Last Visit: 03 Dec 2009

Topics: 49
Posts: 485
Location: Israhell
israel.gif

PostPosted: Tue Aug 14, 2007 3:19 am
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ronwolf1705 wrote:
Etzem wrote:
I tried to duplicate the T_Bite function and tried to make my own fucntion T_Swing. But my game crashed or the other way, the compiler crashed after receiving 24+ errors... Can you please show me how to do it? Neutral
or maybe how just to make 2 damage formulas in the T_Bite function with Cases, Like case guardobj: and case dogobj: (?)


You could try the 'case guardobj:', I'm sure that will work.

For the other way:

In WL_ACT2.C search for:

::: CODE :::

void   T_Bite (objtype *ob);


Underneath that add:

::: CODE :::

void   T_Bite2 (objtype *ob);


Then search for:

::: CODE :::

statetype s_grdshoot2    = {false,SPR_GRD_SHOOT2,20,NULL,T_Shoot,&s_grdshoot3};


I take the guard as example. Change that line too:

::: CODE :::

statetype s_grdshoot2    = {false,SPR_GRD_SHOOT2,20,NULL,T_Bite2,&s_grdshoot3};


Then search for the T_Bite function. Copy the function and rename it. It will look like this:

::: CODE :::

/*
===============
=
= T_Bite2
=
===============
*/

void T_Bite2 (objtype *ob)
{
   long   dx,dy;
   int   hitchance,damage;


   PlaySoundLocActor(DOGATTACKSND,ob);   // JAB

   dx = player->x - ob->x;
   if (dx<0)
      dx = -dx;
   dx -= TILEGLOBAL;
   if (dx <= MINACTORDIST)
   {
      dy = player->y - ob->y;
      if (dy<0)
         dy = -dy;
      dy -= TILEGLOBAL;
      if (dy <= MINACTORDIST)
      {
         if (US_RndT()<180)
         {
            TakeDamage (US_RndT()>>2,ob); // change this line to your needs
            return;
         }
      }
   }

   return;
}


As you see, I've changed the TakeDamage line, but you can change that to your needs.

I thinks that's all. If there are any problems, let me know.


Wow thanks! it's working perfectly! I think I know why the last time it didn't work, because instead of putting the
::: CODE :::
void   T_Swing (objtype *ob);

after
::: CODE :::
void   T_Bite (objtype *ob);

I've putted it after
::: CODE :::
void   T_Stand (objtype *ob);
Razz

Maybe that's why the game always crashed >_< one more thing though there's another problem. when they open a door it looks like he's teleporing himself to the other end of the door, like he's walking through a wall... Any idea on how to fix it? and btw I only think it's like this because of the T_DogChase that doesnt have a walking through a door option(?)

_________________
Raziel A.
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 2:44 ago.

Topics: 73
Posts: 3765

blank.gif

PostPosted: Tue Aug 14, 2007 3:25 am
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm not sure, but I think you mean this:

http://diehardwolfers.areyep.com/viewtopic.php?t=3124&highlight=dog
Raziel
DieHard SS
DieHard SS


Joined: 03 Dec 2005
Last Visit: 03 Dec 2009

Topics: 49
Posts: 485
Location: Israhell
israel.gif

PostPosted: Tue Aug 14, 2007 3:34 am
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ronwolf1705 wrote:


It works! Beer cheers!
Thanks again for all of your help Smile now it's just perfect Wink

_________________
Raziel A.
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 01 May 2018

Topics: 64
Posts: 566

blank.gif

PostPosted: Sun Sep 25, 2016 3:48 pm
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I am currently working on adding a mutant that attacks with a knife. Everything is working fine, but how would I increase the chances that T_Bite2 is successful? I want damage to be done more often than with the typical dog.

Thanks for any replies!

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 13 Sep 2018

Topics: 55
Posts: 2139
Location: Canada
blank.gif

PostPosted: Sun Sep 25, 2016 4:06 pm
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Something like this should make the damage between 30 and 60 each time (I think, but haven't tested it):

::: CODE :::
      dy -= TILEGLOBAL;
      if (dy <= MINACTORDIST)
      {
            TakeDamage ((30 + (US_RndT() % 31)),ob); // change this line to your needs
            return;
      }

Between 5 and 20:

::: CODE :::
            TakeDamage ((5 + (US_RndT() % 16)),ob); // change this line to your needs

Removing the "if (US_RndT()<180)" part makes it so that it runs TakeDamage always, and the # + ensures that it's never 0.

edit: If you mean making his attack faster, changing the statetype s_mutshoot# to lower numbers than 6,20,10,20 might help.
edit2: There's also a quirk in dos where the enemies keep running into you when beside you, the fix in Wolf4SDL looks like this.
edit3: Another edit? Sure, why not! Might already be obvious, but on Can I Play Daddy mode the damage dealt is divided by 4.
edit4: lol, I googled T_DogChase to read this and apparently there's someone on Twitter with that username (Thomas Chase).
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 01 May 2018

Topics: 64
Posts: 566

blank.gif

PostPosted: Sun Sep 25, 2016 6:21 pm
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris wrote:
Something like this should make the damage between 30 and 60 each time (I think, but haven't tested it):

::: CODE :::
      dy -= TILEGLOBAL;
      if (dy <= MINACTORDIST)
      {
            TakeDamage ((30 + (US_RndT() % 31)),ob); // change this line to your needs
            return;
      }

Between 5 and 20:

::: CODE :::
            TakeDamage ((5 + (US_RndT() % 16)),ob); // change this line to your needs

Removing the "if (US_RndT()<180)" part makes it so that it runs TakeDamage always, and the # + ensures that it's never 0.

edit: If you mean making his attack faster, changing the statetype s_mutshoot# to lower numbers than 6,20,10,20 might help.
edit2: There's also a quirk in dos where the enemies keep running into you when beside you, the fix in Wolf4SDL looks like this.
edit3: Another edit? Sure, why not! Might already be obvious, but on Can I Play Daddy mode the damage dealt is divided by 4.
edit4: lol, I googled T_DogChase to read this and apparently there's someone on Twitter with that username (Thomas Chase).


Thanks Chris!

I was able to get pretty close to what I want by changing the 6,20,10,20 values. I might tweak them a little more but this has me on the right track.

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
fraggeur
DieHard Guard
DieHard Guard


Joined: 31 Dec 2012
Last Visit: 16 Sep 2018

Topics: 11
Posts: 269

blank.gif

PostPosted: Sat Oct 15, 2016 2:47 pm
   Subject: Re: [help] changes to the T_Bite function.
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

What I did, is adding a "damage" variable to T_Bite,
then doing a switch case on the objtype, depending on the enemy, changing the base damage.

As for the dog teleporting bug, it happens with the T_Dogchase function, I don't use that function for human close combat ranged, instead I use the T_chase with some conditional skip based on the objtype, then they "shoot" only when they are at 0 distance.
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 9415 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Help] Setting RocketLauncher: Explosive Range...?
Author: KyleRTCW
17 5474 Thu Jun 03, 2004 3:21 am
Codetech84 View latest post
This topic is locked: you cannot edit posts or make replies. [Info] Source code for Darkone's NewWolf Classic
Author: Raistlin
1 1753 Tue Feb 10, 2004 10:18 am
BrotherTank View latest post
No new posts [Help] Berserk mode
Author: wolf3dbreaker
2 2042 Tue Feb 03, 2004 11:01 pm
Xarkon View latest post
No new posts [Info] Assigning Static Objects problem.
Author: Guest
1 104 Sun Jul 06, 2003 1:25 pm
Guest View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group