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] Wall Ammo Racks (UPDATE: BUG FIXED)
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
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 10 Aug 2019

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Mon Dec 06, 2004 3:16 pm
   Subject: [Code] Wall Ammo Racks (UPDATE: BUG FIXED)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hello, this is a tutorial and making ammo racks for Wolfenstein 3D, this is designed to allow you to make a wall that can be used to get ammo off of then draw the next wall image to make it look like it's empty.

EDIT: Bug found, if you used this prior to 1/5/05 then please look for the red print in the code!!

Examples:
Before
After

This feature was not made made by me, member "Joe" shared this with me on AIM and I thought I'd share it with you!


Note: this tutorial can be changed to give other things too, instead of GiveAmmo, it could be GiveWeapon or HealSelf.

Ok enough chat, let's start

Open WL_AGENT.C and located the following block:
::: CODE :::
if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)
   {
   //
   // use elevator
   //
      buttonheld[bt_use] = true;

      tilemap[checkx][checky]++;      // flip switch
      if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)
         playstate = ex_secretlevel;
      else
         playstate = ex_completed;
      SD_PlaySound (LEVELDONESND);
      SD_WaitSoundDone();
   }
   else if (!buttonheld[bt_use] && doornum & 0x80)
   {
      buttonheld[bt_use] = true;
      OperateDoor (doornum & ~0x80);
   }
   else
      SD_PlaySound (DONOTHINGSND);

}


2. Modify to look like this:
::: CODE :::

if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)
   {
   //
   // use elevator
   //
      buttonheld[bt_use] = true;

      tilemap[checkx][checky]++;      // flip switch
      if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)
         playstate = ex_secretlevel;
      else
       playstate = ex_completed;
      SD_PlaySound (ERLAUBENSND);
      SD_WaitSoundDone();

   }
   // Ammo Rack
   if(!buttonheld[bt_use] && doornum == 1)  // Important! Change 1 to the wall Id that you want to be displayed open floedit and check, for example, 1 is first wall, then when used the second image of the first wall is displayed. You may need to play around with this.   
                {
   buttonheld[bt_use] = true;
   if(gamestate.ammo >= 99) // or what ever your ammo limit is

                return;
   tilemap[checkx][checky]++;
   SD_PlaySound(GETAMMOSND);
   GiveAmmo (25); // Change to your liking!
   StartBonusFlash();
   }

   else if (!buttonheld[bt_use] && doornum & 0x80)
   {
      buttonheld[bt_use] = true;
      OperateDoor (doornum & ~0x80);
   }
   else      
                   SD_PlaySound (DONOTHINGSND);

}


Done! Compile and Link up and test it. Please post any errors or mistakes I may have made, I have this feature in my Tc so it works for me, please do tell me of any compiling errors.
This tutorial is now official.

_________________
Steam: http://steamcommunity.com/id/stormx312


Last edited by KyleRTCW on Wed Jan 05, 2005 3:15 pm; edited 4 times in total
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 24 Sep 2019

Topics: 98
Posts: 1524
Location: New Jersey
usa.gif

PostPosted: Mon Dec 06, 2004 4:27 pm
   Subject: Re: [Tutorial]Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That Code Will be good for the My Mod Smile Smile Smile Mr Green Mr Green Mr Green

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
lucky_foot
Don't Hurt Me
Don't Hurt Me


Joined: 05 Nov 2004
Last Visit: 19 Sep 2010

Topics: 13
Posts: 69
Location: Pennsylvania
usa.gif

PostPosted: Tue Dec 07, 2004 4:58 am
   Subject: Re: [Tutorial]Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

LOL. I guess I can test it for ya. Smile

_________________
JonathanS
Lucky foot Productions

www.luckyfootproductions.jtworld.net
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 10 Aug 2019

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Wed Dec 08, 2004 12:49 pm
   Subject: Re: [Tutorial]Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Has anyone tried it yet? Does it work??
I have the code in my TC so it should work.

_________________
Steam: http://steamcommunity.com/id/stormx312
Hair Machine
DieHard SS
DieHard SS


Joined: 24 Nov 2003
Last Visit: 29 Oct 2018

Topics: 8
Posts: 427
Location: editing my profile
uk.gif

PostPosted: Wed Dec 08, 2004 1:19 pm
   Subject: Re: [Tutorial]Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well... it looks exactly the same as my code - so I guess it should work. By a brilliant process of logic.

_________________
Rar rar fiddle di dee
lucky_foot
Don't Hurt Me
Don't Hurt Me


Joined: 05 Nov 2004
Last Visit: 19 Sep 2010

Topics: 13
Posts: 69
Location: Pennsylvania
usa.gif

PostPosted: Thu Dec 09, 2004 5:04 am
   Subject: Re: [Tutorial]Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Okay, Lucky Foot here. I just tested the code above for my new TC that is in process and the Code DOES work without any changes to it. I can officially say that it works. Smile


Great job. Smile

_________________
JonathanS
Lucky foot Productions

www.luckyfootproductions.jtworld.net
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 10 Aug 2019

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Thu Dec 09, 2004 3:34 pm
   Subject: Re: [Tutorial]Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks for testing it lucky, this code is now official Smile

_________________
Steam: http://steamcommunity.com/id/stormx312
Guest




Last Visit:





PostPosted: Wed Jan 05, 2005 11:31 am
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Is it possible to change a thing to this code?

Because now you can get ammo as much as you wish, but when you have full ammo, and than try to get ammo the wall is empty. But when you never have full ammo you can get every time again ammo on the wall.

Is het possible that you can just ammo for one time?
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 10 Aug 2019

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Wed Jan 05, 2005 12:54 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I can't exactly understand what you are saying, your sentences are not clear. I just tested in Todpfad and I tested for what I interepted from your message (taking ammo from the wall twice) and I cannot take it more than once even without full ammo.

Please, if you are having a problem, please tell me specificly whats going on.

~Kyle

_________________
Steam: http://steamcommunity.com/id/stormx312
Guest




Last Visit:





PostPosted: Wed Jan 05, 2005 1:16 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sorry for my bad english, but you interepted it well! That's exactly what i mean. I can get the ammo from the walls every time again and again.

Don't know what I did wrong. I didn't change anything of the code, just copied it.

If you have a little time: here's my source code: http://members.home.nl/l.euser/Bramaldo_Source2.zip
Haasboy
DieHard Officer
DieHard Officer


Joined: 23 Jul 2003
Last Visit: 07 Nov 2019

Topics: 58
Posts: 581
Location: South Africa, Johannesburg
southafrica.gif

PostPosted: Wed Jan 05, 2005 1:36 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've just had a look at your source, and everything looks norm, there's no way that you'd be able to get the ammo twice even with full ammo.

_________________
Haasboy Engine - Currently under construction (To be used with future mods - F.A.D.E.D. - Mansion X - Rising Evil Series)
Guest




Last Visit:





PostPosted: Wed Jan 05, 2005 1:58 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If I have 99 ammo, and than I push on the spacebar when I am at the ammowall, than it stops. But when I have 1 ammo, I can raise the ammo up to 99.
thejosh
I am Death Incarnate
I am Death Incarnate


Joined: 26 Apr 2003
Last Visit: 22 Nov 2009

Topics: 4
Posts: 150

blank.gif

PostPosted: Wed Jan 05, 2005 2:16 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

if(gamestate.ammo >= 99) // or what ever your ammo limit is

Think try commenting out that line.

_________________
thejosh Official procrastinator
Lair of the Mantis
Guest




Last Visit:





PostPosted: Wed Jan 05, 2005 2:28 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks thejosh!

It works perfect now!
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 10 Aug 2019

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Wed Jan 05, 2005 3:13 pm
   Subject: Re: [Code] Wall Ammo Racks
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

BUG FOUND!

When I was writing the tutorial, I missed one line of code.

Here is the fix:

add return; underneath if(gamestate.ammo >= 99)

so it looks like this:

::: CODE :::
// Ammo Rack
   if(!buttonheld[bt_use] && doornum == 1)  // Important! Change 1 to the wall Id that you want to be displayed open floedit and check, for example, 1 is first wall, then when used the second image of the first wall is displayed. You may need to play around with this.   
                {
   buttonheld[bt_use] = true;
   if(gamestate.ammo >= 99) // or what ever your ammo limit is
                return;
   tilemap[checkx][checky]++;

_________________
Steam: http://steamcommunity.com/id/stormx312
Thomas
Mapping Master
Mapping Master


Joined: 23 Nov 2004
Last Visit: 0:08 ago.

Topics: 164
Posts: 5197

denmark.gif

PostPosted: Sun Jan 09, 2005 3:21 am
   Subject: Re: [Code] Wall Ammo Racks (UPDATE: BUG FIXED)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

.....


Last edited by Thomas on Thu May 26, 2011 3:52 am; edited 1 time in total
Guest




Last Visit:





PostPosted: Thu Jan 13, 2005 4:40 am
   Subject: Re: [Code] Wall Ammo Racks (UPDATE: BUG FIXED)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

In my tc i have include Kyle`s ammo racks. In my code though i put an objject modifier on the wall to define what you get with those racks.

Here is my code

Quote:

if(!buttonheld[bt_use] && doornum == 52) // Important! Change 1 to the wall Id that you want to be displayed open floedit and check, for example, 1 is first wall, then when used the second image of the first wall is displayed. You may need to play around with this.
{
switch(MAPSPOT(checkx,checky,1))
{
case 732: // give normal ammo and chaingun ammo
buttonheld[bt_use] = true;
tilemap[checkx][checky]++;
SD_PlaySound(GETAMMOSND);
GiveAmmo (25); // Change to your liking!
GiveChainAmmo (15);
StartBonusFlash();
break;
case 733: // gives a missile
buttonheld[bt_use] = true;
tilemap[checkx][checky]++;
SD_PlaySound(GETAMMOSND);
GiveMissile(1);
StartBonusFlash();
break;
case 734: // give a medipack
buttonheld[bt_use] = true;
tilemap[checkx][checky]++;
SD_PlaySound(GETAMMOSND);
HealSelf(25); // Change to your liking!
GiveMediAmmo(1);
gamestate.medipack = true;
StartBonusFlash();
break;
case 735: // gives silenced weapon ammo
buttonheld[bt_use] = true;
tilemap[checkx][checky]++;
SD_PlaySound(GETAMMOSND);
GiveStenAmmo(10);
StartBonusFlash();
break;
default: // gives normal ammo
buttonheld[bt_use] = true;
tilemap[checkx][checky]++;
SD_PlaySound(GETAMMOSND);
GiveAmmo (25); // Change to your liking!
StartBonusFlash();
}
}


Now change the number where it sais case 735 to define the identefier of the modifier,
You can add more cases or change some to give differtent results.
Cool

Flamer46
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 16992 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 3367 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 2494 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2790 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3715 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