Conner94 Moderator

Joined: 15 Jan 2005 Posts: 249 Location: ???
|
Posted: Wed Jul 06, 2005 9:23 pm Post subject: [Code] SS Firing - More Like Doom Chaingun Zombie |
|
|
In this tuturial I will show you how to make the ss shoot more like the Chaingun Zombie in Doom. This way, if he can, he will keep shooting at you. I also made it so if he isn't by the player, he may stop shooting and move like normal - that way he is using more realistic tatics.
NOTE: THIS IS STILL BETA CODE - HE DOESN'T STOP FIRING YET
First, open up WL_ACT2. All of the changes will be made here. Find:
| Code: |
| void T_Shoot (objtype *ob); |
and under that, add this:
| Code: |
| void T_SSFire (objtype *ob); |
Now, with this you will need fewer state types. Find:
| Code: |
extern statetype s_ssshoot5;
extern statetype s_ssshoot6;
extern statetype s_ssshoot7;
extern statetype s_ssshoot8;
extern statetype s_ssshoot9; |
Delete those lines.
Now, find:
| Code: |
statetype s_ssshoot1 = {false,SPR_GRD_SHOOT1,20,NULL,NULL,&s_ssshoot2};
statetype s_ssshoot2 = {false,SPR_GRD_SHOOT2,20,NULL,T_Shoot,&s_ssshoot3};
statetype s_ssshoot3 = {false,SPR_GRD_SHOOT3,10,NULL,NULL,&s_ssshoot4};
statetype s_ssshoot4 = {false,SPR_GRD_SHOOT2,10,NULL,T_Shoot,&s_ssshoot5};
statetype s_ssshoot5 = {false,SPR_GRD_SHOOT3,10,NULL,NULL,&s_ssshoot6};
statetype s_ssshoot6 = {false,SPR_GRD_SHOOT2,10,NULL,T_Shoot,&s_ssshoot7};
statetype s_ssshoot7 = {false,SPR_GRD_SHOOT3,10,NULL,NULL,&s_ssshoot8};
statetype s_ssshoot8 = {false,SPR_GRD_SHOOT2,10,NULL,T_Shoot,&s_ssshoot9};
statetype s_ssshoot9 = {false,SPR_GRD_SHOOT3,10,NULL,NULL,&s_grdchase1}; |
Change those to:
| Code: |
statetype s_ssshoot1 = {false,SPR_GRD_SHOOT1,10,NULL,NULL,&s_ssshoot2};
statetype s_ssshoot2 = {false,SPR_GRD_SHOOT2,20,NULL,T_Shoot,&s_ssshoot3};
statetype s_ssshoot3 = {false,SPR_GRD_SHOOT3,5,NULL,T_SSFire,&s_ssshoot4};
statetype s_ssshoot4 = {false,SPR_GRD_SHOOT2,10,NULL,T_Shoot,&s_grdchase1};
|
Note: My State Types are merged. If your's aren't, make sure you reset the state's sprites and the 4th's turning into the guard's chase
Now, find:
| Code: |
| void T_Shoot (objtype *ob) |
Now, under that ENTIRE FUNCTION, including the "/*", add this:
| Code: |
===============
=
= T_SSFire
=
= Try to damage the player, based on skill level and player's speed
=
===============
*/
void T_SSFire (objtype *ob)
{
int chance,refire;
chance = 128;
if (!CheckLine (ob)) // player is behind a wall
return;
if (CheckLine (ob))
{
if (!areabyplayer[ob->areanumber])
{
if (US_RndT()<chance)
refire = 1;
}
else
refire = 1;
}
if (refire == 1)
{
switch(ob->obclass)
{
case ssobj:
NewState (ob,&s_ssshoot1);
break;
}
}
}
/* |
There, now the ss should act more like the doom chaingun zombie. If you have a fix for the bug I mentioned above, please post it! _________________ My Wolfenstein Website:
http://www.wolf94.cjb.net
Status: Falling apart over a product I ordered that is taking forever to arrive. |
|