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] A Different Respawn - Behind You - Chris
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: 22 Aug 2019

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

PostPosted: Tue Nov 25, 2003 10:03 pm
   Subject: [Code] A Different Respawn - Behind You - Chris
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

Here's something I threw together pretty quick, but maybe it'll give you some ideas on how to do spawning in the source code. I just placed this into the bottom of the KillActor() function of WL_STATE.C; right below the "ob->flags |= FL_NONMARK" line.

::: CODE :::
if (gamestate.killcount*100/gamestate.killtotal > 80 && ob->obclass == guardobj)
{
   tilex-=(tilex-player->tilex)*2;
   tiley-=(tiley-player->tiley)*2;

   if (tilemap[tilex][tiley] == 0)
   {
   // RemoveObj(ob);
      SpawnStand(en_guard,tilex,tiley,116+(player->angle/90+2)%4);
      gamestate.killcount--;
   }
}

What it does is spawn a guard right behind you when you over 80% kill ratio (as a little elevator surprise!). He'll appear at the exact opposite position as where he was before, like a mirror image - and he'll keep reappearing until he either gets teleported into a wall or on top of another dead guy. Of course, this is a limit of 149 guards per level; so you can uncomment the "RemoveObj" line as a safeguard if you think you'll go over (unless you want to see the original enemy fall over & bite the dust).

Like any code example, nothing is set in stone in this little test. You can make the guards reappear as Mutants (object 216) if you like, or knock the kill ratio down to 40%; as a few examples. I'm looking into getting moving guards to bounce off the walls (in random directions) right now, so they won't just keep walking into walls when they're spawned... lol.

For now, though, if you want a quick fix for when the guards try to walk towards bad locations when they're stuck in a corner (you'll probably have to do some extra tweaking for when they spawn into a moving secret passage though), just replace this string in the TryWalk() function of WL_STATE.C:

::: CODE :::
case nodir:
   return false;

default:
   Quit ("Walk: Bad dir");

With this one:

::: CODE :::
default:
   return false;

Hope that's a good starting ground for you (even though it's pretty low-tech)! Glad to hear that you enjoy crazy new ideas like the 'new room' labyrinths Barbara. Smile
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 3314 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2738 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 3660 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