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] Making Pacman ghosts stand still until alerted
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
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Wed Sep 15, 2004 7:55 pm
   Subject: [Code] Making Pacman ghosts stand still until alerted
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

You may notice that in the original Wolf3D, the Pacman ghosts start chasing you as soon as the level starts. This code change will make it so that they won't move until they spot the player. I added this in "Operation: Letzterschutz." I'm not sure if anyone else will need it, but I thought I'd share it anyway.

In WL_ACT2.C, go to the "T_Ghosts" function and look for these lines:

::: CODE :::

void T_Ghosts (objtype *ob)
{
   long move;


Add these lines:

::: CODE :::

   if (! (ob->flags & FL_ATTACKMODE) )
   {
      T_Stand (ob);
      return;
   }


Next in WL_STATE.C, look for these lines:

::: CODE :::

   case ghostobj:
      NewState (ob,&s_blinkychase1);
      ob->speed *= 2;         // go faster when chasing player
      break;


Change it to look like this:

::: CODE :::

   case ghostobj:
      // NewState (ob,&s_blinkychase1);
      ob->speed = SPDDOG;
         // go faster when chasing player
      break;



Then go down to these lines:

::: CODE :::

      case bossobj:
      case schabbobj:
      case fakeobj:
      case mechahitlerobj:
      case realhitlerobj:
      case gretelobj:
      case giftobj:
      case fatobj:
      case spectreobj:
      case angelobj:
      case transobj:
      case uberobj:
      case willobj:
      case deathobj:


Add this line:

::: CODE :::

      case ghostobj:


Save and compile.

That's all there is to it. Now, like other enemies, the Pacman ghosts will stand and wait for the player.
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Thu Sep 16, 2004 2:30 pm
   Subject: Re: Making Pacman ghosts stand still until alerted
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I almost forgot to mention... The reason for doing it this way is because it's fairly quick and it saves some memory. Yes, you could get the same effect by simply adding standing statetypes for each ghost, but statetypes cost memory, and you'd probably have to define object classes for each ghost so that they won't all go into the same chase frames when "FirstSighting" is called (because they all use "ghostobj").
Matthew
DieHard SS
DieHard SS


Joined: 02 Jul 2007
Last Visit: 19 Aug 2018

Topics: 94
Posts: 471

usa.gif

PostPosted: Mon Jul 16, 2007 9:19 am
   Subject: Re: [Code] Making Pacman ghosts stand still until alerted
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Quote:
You may notice that in the original Wolf3D, the Pacman ghosts start chasing you as soon as the level starts.


Actually, this isn't always true. Even though ghosts are in chase mode when the level starts, for some reason ghosts usually will not start chasing the player until the instant their floor code is connected to -- if the player is not on their floor code at the start of the level. But ghosts will always start chasing the player if the player sees them. In E3 L10 of Temporary Insanity, this is used to create ghosts that will start chasing the player not when they see the player, but when THE PLAYER SEES THEM -- so the player has to navigate a maze, making sure to never SEE any ghosts. Pretty creepy.
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Mon Jul 16, 2007 2:42 pm
   Subject: Re: [Code] Making Pacman ghosts stand still until alerted
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Matthew wrote:
Even though ghosts are in chase mode when the level starts, for some reason ghosts usually will not start chasing the player until the instant their floor code is connected to -- if the player is not on their floor code at the start of the level.

That's because their animation code is ignored in DoActor() unless areabyplayer is true. But in the Pacman level (E3L10), the player starts on the same area code as the ghosts, so they'll start chasing him before they even see him (or before he sees them.)
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 14144 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 2829 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 2053 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2368 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3196 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