[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:
void T_Shoot (objtype *ob);
and under that, add this:
void T_SSFire (objtype *ob);
Now, with this you will need fewer state types. Find:
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:
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:
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:
void T_Shoot (objtype *ob)
Now, under that ENTIRE FUNCTION, including the "/*", add this:
===============
=
= 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!
Deathshead- 07-07-2005
so basikally, up'd intelligence? wikid dude, although I dont mod nemore, dis be useful 4 sum1
Conner94- 07-07-2005
Thanks! This is just one of many changes I plan to have with War Storm so enemies are more lethal - not just uping hitpoints and weapon damage, but actually modifing their AI like this tutoiral.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.