| Author |
Message |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Sat Mar 05, 2005 7:37 pm
Subject: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

 
|
|
I really really need some help, I know you'll all say to use Paal Olstads (or whatever hes called) tutorial on adding a rocket Launcher, but it just doesn't do it for me I can't stand it!!! , im really stuck here, You can't really make a mod without having either one of the weapons that will compete very much with the others. As far as i kno Paals Rockety Launcher is the only tutorial of the kind that i'm looking for, and i can't use it. Can anybody help me? Perhaps, a page with a written tutorial (rather than a screen dumped one) or anything helpful (not like a useless piece of code for a crud programmer like me)...
Many thanks in return
Andy3012 |
|
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Sun Mar 06, 2005 12:53 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
Hey! That's not so hard... Here you go.
(This is an example on how to make a weapon shoot fire balls)
We are going to make the pistol fire fireballs.
In WL_AGENT.C, add this at the beginning of the file.
::: CODE :::
extern statetype s_fire1;
Then add this declaration before T_KnifeAttack
[BUG FIXED]
::: CODE :::
void FlamethrowerAttack (objtype *ob)
{
if (gamestate.ammo<1)
{
return;
}
SD_PlaySound (FLAMETHROWERSND);
GetNewActor ();
new->state = &s_fire1;
new->ticcount = 1;
new->x = ob->x ;
new->y = ob->y ;
new->tilex = new->x >> TILESHIFT;
new->tiley = new->y >> TILESHIFT;
new->obclass = fireobj;
new->dir = nodir;
new->angle = ob->angle;
new->speed = 0x4200l;
new->flags = FL_NONMARK | FL_BONUS;
new->active = true;
}
And then in GunAttack, change it to look like this:
::: CODE :::
void GunAttack (objtype *ob)
{
objtype *check,*closest,*oldclosest;
int damage;
int dx,dy,dist;
long viewdist;
if (gamestate.weapon == wp_pistol) // change it to your liking.
{
FlameThrowerAttack (ob);
return; }
switch (gamestate.weapon)
{
case wp_machinegun:
SD_PlaySound (ATKMACHINESND);
madenoise = true;
break;
case wp_chaingun:
SD_PlaySound (ATKGATLINGSND);
madenoise = true;
break;
[Rest of the code]
Then in WL_ACT2.C Change the T_Projectil to look like this.
::: CODE :::
void T_Projectile (objtype *ob)
{
long deltax,deltay;
int damage;
long speed;
objtype *check, *extracheck;
speed = (long)ob->speed*tics;
deltax = FixedByFrac(speed,costable[ob->angle]);
deltay = -FixedByFrac(speed,sintable[ob->angle]);
if (deltax>0x10000l)
deltax = 0x10000l;
if (deltay>0x10000l)
deltay = 0x10000l;
ob->x += deltax;
ob->y += deltay;
if (!ProjectileTryMove (ob))
{
if (ob->obclass == rocketobj)
{
PlaySoundLocActor(MISSILEHITSND,ob);
ob->state = &s_boom1;
}
#ifdef SPEAR
else if (ob->obclass == hrocketobj)
{
PlaySoundLocActor(MISSILEHITSND,ob);
ob->state = &s_hboom1;
}
#endif
else
ob->state = NULL; // mark for removal
return;
}
if (ob->obclass == fireobj && ob->flags & FL_NONMARK && ob->flags & FL_BONUS)
{
check = objlist ;
while (check)
{
if (check->flags & FL_SHOOTABLE)
{
deltax = LABS(ob->x - check->x);
deltay = LABS(ob->y - check->y);
if (deltax < BJROCKETSIZE && deltay < BJROCKETSIZE)
{
if (check->obclass != angelobj)
// PlaySoundLocActor(MISSILEHITSND,ob);
ob->state = &s_boom1;
DamageActor (check, 25);
}
}
check = check->next ;
}
}
else
{
{
// Check if player hit by anything
deltax = LABS(ob->x - player->x);
deltay = LABS(ob->y - player->y);
if (deltax < PROJECTILESIZE && deltay < PROJECTILESIZE)
{ // hit the player
switch (ob->obclass)
{
case needleobj:
damage = (US_RndT() >>3) + 20;
break;
case rocketobj:
case hrocketobj:
// case sparkobj:
damage = (US_RndT() >>3) + 30;
break;
#ifdef SPEAR
case sparkobj:
damage = (US_RndT() >> 3) + 30;
break;
#endif
case fireobj:
damage = (US_RndT() >>3);
break;
}
TakeDamage (damage,ob);
ob->state = NULL; // mark for removal
return;
}
}
ob->tilex = ob->x >> TILESHIFT;
ob->tiley = ob->y >> TILESHIFT;
}
}
Then add this at the beggining of WL_ACT2.C
#define BJROCKETSIZE 0x6000l
There you go. Now the pistol will fire fireballs whenever you fire it..
Enjoy!
Breaker.
P.S This is just the shorter version of Paal's way. Please tell me if there is a bug. I must have mistyped or left something.  |
_________________ Gone from the community for a while. Will be back on July
Last edited by wolf3dbreaker on Sat Apr 16, 2005 10:22 pm; edited 3 times in total
|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Sun Mar 06, 2005 4:57 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
| Wow!!! Thanks mate, yeah i'll get right on to checking it... |
|
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Mon Mar 07, 2005 9:58 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
Glad that you liked it!  |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Mon Mar 07, 2005 8:55 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
| It doesn't work... I need to define a couple things, and change a few things to make it work... Ill post the errors on here tomorow |
|
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Tue Mar 08, 2005 9:44 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
What exactly are the errors? they worked for me. (I must have mistyped something)  |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Tue Mar 08, 2005 4:34 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
Wait, i don't think it's this code that is the problem, i think its something else, for some odd reason when i start the game and it comes up with "Get Psyched" screen when that finnishes, it crashes, i think its something to do with Hi-Res, some of my source code files probably got mixed about the place, so i clean up the problem...
Edit: The Problem above was because of my compiler, which was mashed! So i've reinstalled that, and sorted out my source code. When i install it now i get 4 errors in wl_agent.c and 1 in wl_act2.c
In Agent they are:
Undefined symbol: Hit by Rocket
Declaration not allowed here (before it was the flame attack, now its knife attack,
Declaration Syntax error
Declaration Missing ;
in Act2 they are:
Undefined symbol s_burn |
|
|
|
 |
Zombie_Plan
DieHard Wolfer


Joined: 13 Oct 2004
Last Visit: 21:35 ago.
Topics: 90
Posts: 1471
Location: A hole in the wall

|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Wed Mar 09, 2005 9:34 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
I fixed them already. I left it out from my code.
change:
::: CODE :::
ob->state = &s_burn;
to this.
::: CODE :::
ob->state = &s_boom1;
And I left this out. It was from my code. that's why.
::: CODE :::
SD_PlaySound (FLAMETHROWERSND);
//hitbyrocket = 0;
Sorry. I must have forgotten to take those out of my code!
There. That should fix your bugs.  |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Thu Mar 10, 2005 6:35 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
I eventually got this to work, their was just a few things that needed defining, and thanks to your bug fixes it works!!
Thank you ever so much Wolf3dbreaker |
|
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Fri Mar 11, 2005 4:47 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
You're welcome. It's my pleasure helping fellow wolfers.  |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Sun Mar 20, 2005 9:04 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
| Hey, I need a little Help, i have got my flamer and it works fine, but i want to make a crossbow fire objrocket (which will be the bolt), i have added the stuff to wl_agent.c and im sure theres no more that i need to change, but then when i actually shoot the gun in the game, all i get is damage to me. I know it must be something to do with T_Projectile in Wl_act2.c, and i have tried changing a few things, but the same still occours can any body help out please? |
|
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
|
 |
Zombie_Plan
DieHard Wolfer


Joined: 13 Oct 2004
Last Visit: 21:35 ago.
Topics: 90
Posts: 1471
Location: A hole in the wall

|
Posted: Mon Mar 21, 2005 6:15 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
| Maybe keep that hurting you effect, and make it you get burnt if you shoot it. That would give a realistic effect. |
_________________ BLOGS
WolfingTime - RSS Feed
HELP ME
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
|
 |
andy3012
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008
Topics: 29
Posts: 292
Location: England

|
Posted: Mon Mar 21, 2005 6:57 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
| Yup, that was a great deal of help thanks wolf3dbreaker, and yeh you was right, it wasn't shooting a particle only damaging me. |
|
|
|
 |
wolf3dbreaker
I am Death Incarnate


Joined: 10 Jun 2003
Last Visit: 29 Sep 2009
Topics: 31
Posts: 196
Location: Philippines

|
Posted: Tue Mar 22, 2005 5:12 am
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
You're welcome  |
_________________ Gone from the community for a while. Will be back on July
|
|
 |
Codetech84
Code Master

Joined: 12 Mar 2003
Last Visit: 23:30 ago.
Topics: 16
Posts: 1040
Location: Rauma - Finland

|
|
 |
Guest

Last Visit:
|
Posted: Sat Apr 16, 2005 3:55 pm
Subject: Re: [Help] Weapon shooting Particles i.e rockets,flame
[ IP : Logged ]
|

  
|
|
*EDIT* Nevermind!!! I fixed it myself!
When I made these sourcecode changes to get pistol to shoot fireballs, I got four errors. I was able to solve two of them but I can't solve the last two errors, these two are:
WL_AGENT.C 1366: Declaration is not allowed here
WL_AGENT.C 1367: Declaration syntax error
I think I got these errors because of I added the Flamethrower attack before T_Knifeattack.
Please help! |
|
|
|
 |
Guest

Last Visit:
|
|
 |
|
|