(Old code tutorial) Enemies Picking up Weapons and Using them from Wolf Planet forum

View previous topic View next topic Go down

(Old code tutorial) Enemies Picking up Weapons and Using them from Wolf Planet forum

Post by Officer-M. John (Admin) on Sun Mar 27, 2016 8:43 am

Hi, This is my First Ever Tutorial, that I have Written, so i can't garrentee that it will work, from what is written here, I have tested the code though and it worked fine to my knowledge, this will take up alot of space, (as you need to add a new enemy). If you use this please give credit to Andy3012, WSJ and the authors of the other tutorials which i used to write this tutorial (MCS + Areyep)

Ok to start with were going to add a new enemy to do this use the tutorial from the site below:
http://www.areyep.com/Codingtips/addenemy.html
With that done, we are going to add the tutorial which allows guards to pick up items
http://www.areyep.com/Codingtips/enemybonus1.html

With that done we can now edit the enemy picking up bonus items tutorial, go to the very end of wl_act2.c which is where the main part of the code is. In this we'll make it so that the officer turns into officer2 (but you can always change the officer2 part the name of your enemy you added.

And the end of this code

Code:

case bo_firstaid:
   switch (ob->obclass)
   {
   case guardobj:
   case ssobj:
   case officerobj:
    RemoveObject (objpos);
    PlaySoundLocActor (HEALTH2SND,ob);
    ob->hitpoints += 25;
    objpos->flags &= ~FL_BONUS;
    break;

add

Code:

 {
case bo_machinegun:
switch (ob->obclass)
   {
   case officerobj:    
   RemoveObject (objpos);
   PlaySoundLocActor (GETMACHINESND,ob);
   objpos->flags &= ~FL_BONUS;
   ob->obclass = officer2obj; // officer becomes machinegun officer
   NewState (ob,&s_ofc2chase1); // go into machinegun chase frames
   break;

make sure to add another } at the end of the end of wl_act2.c (under this code which is at the end)

Hopefully that worked. If not than please say!

What this tutorial does exactly, is makes the Machine gun a pickup, then when the officer picks it up, he changes into officer2 (The new enemy you added in Areyeps tutorial).

More updates to come...

Writte by Andy3012 on Sat Mar 05, 2005 8:01 pm


Last edited by Officer-M. John (Admin) on Sat Apr 23, 2016 9:10 am; edited 2 times in total
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

Re: (Old code tutorial) Enemies Picking up Weapons and Using them from Wolf Planet forum

Post by Officer-M. John (Admin) on Sun Mar 27, 2016 8:46 am

Andy it`s pretty good. But iit could easily be done using less memory.
This code is still in development
I will continue updating it later. But you can work on this first.
I`ll make the officer as Andy has chosen above get the machinegun.
Ok for this tutorial you only need MCS bonus tutorial that andy told you about above.
Ok go in WL_DEF.H and find SPR_CHAINREADY.
After add this

Code:

SPR_OFC_MSHOOT1,SPR_OFC_MSHOOT2,SPR_OFC_MSHOOT3

Now open WL_ACT2.C
Find extern statrtype s_ofcshoot4.
After add

Code:

extern statetype s_ofcmshoot1;
extern statetype s_ofcmshoot2;
extern statetype s_ofcmshoot3;

Now scroll down until you find
statetype s_ofcshoot3 = {false,SPR_OFC_SHOOT3,10,NULL,NULL,&s_ofcchase1};
After add

Code:

statetype  s_ofcmshoot1 = {false,SPR_OFC_MSHOOT1,6,NULL,NULL,&s_ofcshoot2};
statetype  s_ofcmshoot2 = {false,SPR_OFC_MSHOOT2,20,NULL,T_Shoot,&s_ofcshoot3};
statetype  s_ofcmshoot3 = {false,SPR_OFC_MSHOOT3,10,NULL,NULL,&s_ofcchase1};

Now i add Andy`s code but i removed a line.

Code:

case bo_machinegun:
switch (ob->obclass)
   {
   case officerobj:    
   RemoveObject (objpos);
   PlaySoundLocActor (GETMACHINESND,ob);
   objpos->flags &= ~FL_BONUS;
   ob->weapon=2     // This is an important line for this code!! You will have to add a new variable in the ACtor structure.
   break;

I`ll update it soon.

Writte by Flamer46 on Thu Mar 31, 2005 5:33 pm
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum