Wolf Planet Forum Index Wolf Planet
We want you here!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Tutorial]Enemies Picking up Weapons and Using them

 
Post new topic   Reply to topic    Wolf Planet Forum Index -> Coding Alliance
View previous topic :: View next topic  
Author Message
Andy3012



Joined: 05 Mar 2005
Posts: 4

PostPosted: Sat Mar 05, 2005 8:01 pm    Post subject: [Tutorial]Enemies Picking up Weapons and Using them Reply with quote

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...[/code][/url]
Back to top
View user's profile Send private message
Flamer46
Newbie


Joined: 16 Feb 2005
Posts: 25
Location: Italy

PostPosted: Thu Mar 31, 2005 5:33 pm    Post subject: Reply with quote

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.
8)
_________________
Join my forum at
[url]wolfingdays.exoboards.com[/url]
and visit my site at
www.wolfer.co.nr
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Andy3012



Joined: 05 Mar 2005
Posts: 4

PostPosted: Fri Apr 01, 2005 2:19 pm    Post subject: Reply with quote

If you use them merging enemy statetypes tutorial that could help reduce alot of wasted memory.
Back to top
View user's profile Send private message
Flamer46
Newbie


Joined: 16 Feb 2005
Posts: 25
Location: Italy

PostPosted: Fri Apr 01, 2005 4:29 pm    Post subject: Reply with quote

I thougt about that. Infact i just finished coding this. Maybe i`ll post it in a little bit. I`ll test it.
_________________
Join my forum at
[url]wolfingdays.exoboards.com[/url]
and visit my site at
www.wolfer.co.nr
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Wolf Planet Forum Index -> Coding Alliance All times are GMT
Page 1 of 1

Jump to:  

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


Powered by phpBB © 2001 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.