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] Calculate enemies coords?
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
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 16 Jul 2019

Topics: 56
Posts: 2234
Location: Canada
blank.gif

PostPosted: Wed Dec 03, 2003 2:16 pm
   Subject: [Code] Calculate enemies coords?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

You can try using the GunAttack() code, just elimanting the angles and distance limits; than add a comment box that points to ob->x and ob->y. Here's another way, I just scanned the infoplane for enemies; and made it store the closest one's information into variables (just replace the old "Tab-F" statement in WL_DEBUG.C with this one):

::: CODE :::
if (Keyboard[sc_F])      // F = facing spot
{
   long xstuff, ystuff;
   int candy=128, chips, storex, storey;
   for (obj=player->next;obj;obj=obj->next)
   {
      storex = obj->tilex - player->tilex;
      if (storex < 0)
         storex -= storex*2;
      storey = obj->tiley - player->tiley;
      if (storey < 0)
         storey -= storey*2;
      chips = storex + storey;
      if (candy > chips && (obj->flags & FL_SHOOTABLE))
      {
         candy = chips;
         xstuff = obj->x;
         ystuff = obj->y;
      }
   }
   CenterWindow (13,12);
   US_CPrint ("Closest Enemy\n");
   US_Print ("\nx: "); US_PrintUnsigned (xstuff/65536);
   US_Print (" - "); US_PrintUnsigned (xstuff);
   US_Print ("\ny: "); US_PrintUnsigned (ystuff/65536);
   US_Print (" - "); US_PrintUnsigned (ystuff);
   US_CPrint ("\n\nPlayer Location\n");
   US_Print ("\nx: "); US_PrintUnsigned (player->tilex);
   US_Print (" - "); US_PrintUnsigned (player->x);
   US_Print ("\ny: "); US_PrintUnsigned (player->tiley);
   US_Print (" - "); US_PrintUnsigned (player->y);
   VW_UpdateScreen();
   IN_Ack();
   return 1;
}

Let me know if that's what you wanted! It's pretty cool just walking around and seeing which guard is the closest (in some cases it's hard to tell without using the code; trying to consider the lengths of each angle to them in your head - lol). Smile
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 16 Jul 2019

Topics: 56
Posts: 2234
Location: Canada
blank.gif

PostPosted: Tue Dec 16, 2003 12:27 pm
   Subject: Re: Calculate enemies coords?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Chris wrote:
Let me know if that's what you wanted!

Did this information help at all? Just curious, because I noticed how you where talking about your "Enemy Co-ordinates" gun in another thread, and would like to hear a little bit on how you did it (sounds pretty cool).

Maybe if the above information helped, I'll play around with your some of your "YES!!! AW YEAH!!!" and "Exploding (cencosed by Mod)" stuff to see I can come up with any useful information for you. Coding can be so fun sometimes! Mr Green
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] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 3309 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 2442 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2736 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Info] Giving a Guard a Rocket Launcher
Author: Guest
4 197 Fri Jan 23, 2004 1:58 pm
Guest View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3653 Sun Oct 26, 2003 1:21 am
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