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       

[Code] Changing an Enemies Attack Strength - BrotherTank
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials 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
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Tue Jan 27, 2004 10:29 am
   Subject: [Code] Changing an Enemies Attack Strength - BrotherTank
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

To answer the question of 'How do I change the strength of an enemies attack?', you will find all that you are looking for in the T_Shoot function within the WL_ACT2.C file.

The damage is calculated and set in place before it chooses which sound to use based on the enemy attacking... ie:

::: CODE :::

// see if the shot was a hit

   if (US_RndT()<hitchance)
   {
      if (dist<2)
         damage = US_RndT()>>2;
      else if (dist<4)
         damage = US_RndT()>>3;
      else
         damage = US_RndT()>>4;

      TakeDamage (damage,ob);
   }

   switch(ob->obclass)
   {
    case ssobj:
      PlaySoundLocActor(SSFIRESND,ob);
      break;
#ifndef SPEAR
    case giftobj:
    case fatobj:
      PlaySoundLocActor(MISSILEFIRESND,ob);
      break;
    case mechahitlerobj:
    case realhitlerobj:
    case bossobj:
      PlaySoundLocActor(BOSSFIRESND,ob);
      break;
    case schabbobj:
      PlaySoundLocActor(SCHABBSTHROWSND,ob);
      break;
    case fakeobj:
      PlaySoundLocActor(FLAMETHROWERSND,ob);
      break;
#endif
// Guards Default
    default:
      PlaySoundLocActor(NAZIFIRESND,ob);
   }


Try modifying this section of the routine to get it to change the damage based on the enemy/weapon being used against the player...

Here's something quick from that routine to change an emeny attack strength based on weapon used... The new lines that change the enemy attack strength are in Red:

::: CODE :::
// see if the shot was a hit

   if (US_RndT()<hitchance)
   {
      if (dist<2)
         damage = US_RndT()>>2;
      else if (dist<4)
         damage = US_RndT()>>3;
      else
         damage = US_RndT()>>4;

//      TakeDamage (damage,ob);  Remmed out and replaced below

   }

   switch(ob->obclass)
   {
    case ssobj:
      PlaySoundLocActor(SSFIRESND,ob);
// is using a machine gun so we increase the damage      
      damage = damage * 1.25;
      break;
#ifndef SPEAR
    case giftobj:
    case fatobj:
      PlaySoundLocActor(MISSILEFIRESND,ob);
// is using a projectile weapon
      damage = damage * 1.8;      
      break;
    case mechahitlerobj:
    case realhitlerobj:
    case bossobj:
      PlaySoundLocActor(BOSSFIRESND,ob);
// is using a gatlin gun or better
      damage = damage * 1.6;      
      break;
    case schabbobj:
      PlaySoundLocActor(SCHABBSTHROWSND,ob);
// is using a syringe
      damage = damage * 1.5;    
      break;
    case fakeobj:
      PlaySoundLocActor(FLAMETHROWERSND,ob);
      break;
#endif
// Guards Default
    default:
      PlaySoundLocActor(NAZIFIRESND,ob);
// is using a pistol type weapon - strength no change      
   }

// New line for damage actor
   if (damage > 0) TakeDamage (damage,ob);



You can change the multiplier values to anything you'd like, but remember that it has to be fair to the player. ie: if you are boosting the attack values as they are, you should be doing 1. Increasing the players attack strength (also based on weapon - Search topic within the Code Crackers forum), and 2. Placing a little more health points in your maps, so the player can recover...

Greg
BrotherTank
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials 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 [Code] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 14177 Tue Mar 11, 2008 12:02 am
AlumiuN View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2840 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 2059 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3206 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 609 Tue Jul 29, 2003 3:00 pm
Codetech84 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