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       

[Help] Setting RocketLauncher: Explosive Range...?
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers 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: 09 Nov 2017

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

PostPosted: Sat Jan 10, 2004 5:35 pm
   Subject: [Help] Setting RocketLauncher: Explosive Range...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I have added an explosion range to my Rocket Launcher (so enemies and you near it get hurt or die).

I added the way Poet said at his tutorial site, but there is a minor issue with that. THe issue is that the range can go trough walls (i.e. shoot it at door that enemy is behind and that enemy dies). How do I stop this from happening?

_________________
Steam: http://steamcommunity.com/id/stormx312
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Sun Jan 11, 2004 7:48 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Kyle... in poets tutorial, he didnt include that, at least what i think the problem is...

On my old website, theres some tutorails i wrote and go on this one http://verdammt.ionichost.com/sct_5.php...

This makes an expl range go work off walls, and i think that also solvs the problem because thats all that i did in PV Phase I...

try it and tell me what you think...

_________________
~ James
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Sun Jan 11, 2004 8:06 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

nothing, still problem, what do I put exactly?

BTW, the tutorial didn't do anything. Sad

And, the tutorial didn't help because it never said what to put in the funcution

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




Last Visit:





PostPosted: Mon Jan 12, 2004 4:25 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

couldn't help ya there... my damage routine uses a bunch of checks... and sees if the actor within the assigned damage radius... but automatically doesn't go through walls because the check values look for an actor, not a door....
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Mon Jan 12, 2004 10:35 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Try this:

::: CODE :::
/*
=======================================
=
= Damage actors within specific radius
=
=======================================
*/

void DamageActorsR (objtype* ob, int radius, int damage)
{
int        dx,dy,dist,i;
objtype *check;

  for (check = player;check;check = check->next)
  {
   if (check->state && (check->flags & FL_SHOOTABLE)
   && check != ob)
   {
     dx = abs(ob->tilex - check->tilex);
     dy = abs(ob->tiley - check->tiley);
     dist = dx>dy ? dx : dy;

     if (dist <= radius)
     DamageActor (check,damage/dist);

     dx = abs(ob->tilex - player->tilex);
     dy = abs(ob->tiley - player->tiley);
     dist = dx>dy ? dx : dy;

     if (dist <= radius)
     TakeDamage (damage/dist,check);
   }
  }
}

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Mon Jan 12, 2004 10:39 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Optimisation notes:

Start the check from 'player->next', and add player's radius check outside the for loop.

This optimisation isn't required, nor even necessary...

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Mon Jan 12, 2004 11:02 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
nothing, still problem, what do I put exactly?

BTW, the tutorial didn't do anything. Sad

And, the tutorial didn't help because it never said what to put in the funcution

Sorry i couldn't help, but thats the only thing i changed in PV so i guessed that mine have done sumat..

_________________
~ James
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Mon Jan 12, 2004 11:09 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hellooo, isn't it obvious! 'objtype *ob' 'int radius' 'int damage'

ob = pointer to the actor in the center

radius = integer defining the radius

damage = ammount of damage in hitpoints it causes to the actor inside the radius


Using this information you could easily add a callback in the 'statetype'.

An example of such thing:

::: CODE :::
void Explode (objtype *ob)
{
   DamageActorsR(ob,2,(US_RndT()>>1));
}

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Mon Jan 12, 2004 1:54 pm
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

One problem: Division Error Crying or Very sad

But, where do I actually call the function?
Here is oringnal code for Rocket Launcher:
(just tell me where to insert it
::: CODE :::

void A_StartAttack (objtype *ob)
{
   long   deltax,deltay;
   objtype   *extracheck;
   int   damage;

   extracheck = objlist ;
   while (extracheck)
      {
      if (extracheck != ob && (extracheck->flags  & FL_SHOOTABLE))
      {
      deltax = LABS(ob->x - extracheck->x);
      deltay = LABS(ob->y - extracheck->y);
      if (deltax < BARRELEXPLSIZE * 2 && deltay <         BARRELEXPLSIZE * 2) {

      damage = Damage (deltax, deltay, BARRELEXPLSIZE, 300);
      if (damage > 0)
      DamageActor (extracheck, damage);
      }
      }
   extracheck = extracheck->next;
   }
deltax = LABS(ob->x - player->x);
deltay = LABS(ob->y - player->y);
if (deltax < BARRELEXPLSIZE * 2 && deltay < BARRELEXPLSIZE * 2) {

damage = Damage (deltax, deltay, BARRELEXPLSIZE, 300);
 if (damage > 0)
TakeDamage (damage, ob);

     }
}

_________________
Steam: http://steamcommunity.com/id/stormx312
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Mon Jan 12, 2004 2:46 pm
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Division error means division by zero.
The radius can't be zero...

The error is caused by this function:

TakeDamage (damage/dist,check);

You put the Explode thing in an actor's state. Like you would put T_Shoot, or A_DeathScream, or something like that...

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Mon Jan 12, 2004 2:51 pm
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Codetech84 wrote:
Division error means division by zero.
The radius can't be zero...

The error is caused by this function:

TakeDamage (damage/dist,check);

You put the Explode thing in an actor's state. Like you would put T_Shoot, or A_DeathScream, or something like that...


@ Division: MORE INFO on the Division Error. ( i did put the raduis on 2, not 0)
The exe bombs when rocket hits wall with a garbled screen, with garbled text (still readable) that says "Divide Error"

@ Where to put it: I meant in the rocket code, it wouldn't make sense to put in the statetype's of the enemies. Would it? I didn't think so because we aren't relying on the actor to see, are we?? Thanks for yuor help BTW CodeTech

_________________
Steam: http://steamcommunity.com/id/stormx312
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Tue Jan 13, 2004 7:12 am
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
Codetech84 wrote:
Division error means division by zero.
The radius can't be zero...

The error is caused by this function:

TakeDamage (damage/dist,check);

You put the Explode thing in an actor's state. Like you would put T_Shoot, or A_DeathScream, or something like that...


@ Division: MORE INFO on the Division Error. ( i did put the raduis on 2, not 0)
The exe bombs when rocket hits wall with a garbled screen, with garbled text (still readable) that says "Divide Error"

@ Where to put it: I meant in the rocket code, it wouldn't make sense to put in the statetype's of the enemies. Would it? I didn't think so because we aren't relying on the actor to see, are we?? Thanks for yuor help BTW CodeTech


Just add a error check to it, that it couldn't divide by zero...
So don't let dist get to 0:

Like this...

::: CODE :::

if(dist<=0)
 dist = 1;

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Tue Jan 13, 2004 1:28 pm
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

that causes me to die everytime a rocket hits the wall.

BTW, did you know that this is for the Rocket Launcher Weapon I added? Not nessicarily the enemy's version.

_________________
Steam: http://steamcommunity.com/id/stormx312
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Sat May 15, 2004 2:24 pm
   Subject: Re: RocketLauncher: ExplRange...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
that causes me to die everytime a rocket hits the wall.

BTW, did you know that this is for the Rocket Launcher Weapon I added? Not nessicarily the enemy's version.


I understood, you need to add this in one of the frames of the rocket's explosion. I do not understand why it bombs out, try to debug it somehow. Use a sound, or a statusbar picture or something to know where the code is going and pinpoint the bug.

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

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

PostPosted: Sun May 16, 2004 5:02 am
   Subject: Re: [Help] Setting RocketLauncher: Explosive Range...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Don't worry Codetech, i got this to work a long time ago, after that post, I don't know how I did, lol Smile , but I did. Thanks for all your help though!

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


Joined: 07 Feb 2004
Last Visit: 17 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Sun May 16, 2004 12:56 pm
   Subject: Re: [Help] Setting RocketLauncher: Explosive Range...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

You can try (at your own risk) to add an A* ("A-star") path finding algorythm... so if you can't reach the enemy on a radius it couldn't hit it!
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Mon May 17, 2004 11:24 am
   Subject: Re: [Help] Setting RocketLauncher: Explosive Range...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

KyleRTCW wrote:
Don't worry Codetech, i got this to work a long time ago, after that post, I don't know how I did, lol Smile , but I did. Thanks for all your help though!


Glad I could help. Mr Green

Maybe you should share what was wrong so other people can use it too...

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Thu Jun 03, 2004 3:21 am
   Subject: Re: [Help] Setting RocketLauncher: Explosive Range...?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Here's a fixed version of the "DamageActorsR"

::: CODE :::

/*===================================
 DamageActorsR:

 Damage actors within specific radius damage is smaller,
 the further the actor is from the blast center
===================================*/
void DamageActorsR (objtype* ob, int radius, int damage)
{
  int        dx,dy,dist,i;
  objtype *check;
 
  // Go through the entire actor list using linked list nodes
  for (check = player; check ;check = check->next)
  if(check && ((check->state)  &&  (check->flags & FL_SHOOTABLE)  && (check != ob)))
  {
     // Calculate distance
     dx = abs(ob->tilex - check->tilex);  dy = abs(ob->tiley - check->tiley);
     dist = dx>dy ? dx : dy;
     
     // Damage the appropriate actor according to distance to the blast center
     if ((dist <= radius) && (check != player))  DamageActor (check,damage/dist);
     else TakeDamage (damage/dist,check);
  }
}


Edit: Oops, I almost forgot...

Happy coding! Cheesy Grin

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers 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 Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 7676 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Black & White Effect - Tutorial
Author: Guest
10 296 Thu Mar 17, 2005 6:24 pm
Dugtrio17 View latest post
No new posts [Info] Tricks - Dogs that shoot - Modifying Behaviour
Author: Guest
19 284 Sat Mar 20, 2004 7:31 am
Dugtrio17 View latest post
No new posts [Help] Berserk mode
Author: wolf3dbreaker
2 1657 Tue Feb 03, 2004 11:01 pm
Xarkon View latest post
No new posts [Help] Larger than 64x64 Maps
Author: Codetech84
11 2927 Mon Oct 27, 2003 1:04 pm
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