The Daily Click ::. Forums ::. Klik Coding Help ::. Enemy ai woes
 

Post Reply  Post Oekaki 
 

Posted By Message

ClownLove



Registered
  04/03/2003
Points
  84
19th May, 2005 at 18:20:30 -

Hey

Ive been making a game for a couple of weeks now, and have encountered a problem which I can't figure out. I'm using pmo for the ai of the enemies, and each enemy has two parts arms(which rotate 32 directions)and the body. The coding is fairly simple and all ive done is create an object on the player when they have activated the enemy, always have the body & arms look at that object and if the enemy is facing left or right, "player is pressing left/right" accordingly. Now it works ok, with a few bugs but I just can't get more than one enemy working. I've changed all the relevant events and stuff to a qualifier in case that would help, but it doesnt make any difference.

The enemy guys dont respond, and once one has been destroyed, all the arms for all the other guys are destroyed too, not the body, even though their both instructed to be destroyed...

There must be another way, i've thought about having objects at enemy locations and creating the arms and body that way instead of copying, but I have no idea on how i would come about that.

I hope all that doesnt look too confusing.
Thanks for your time

 
punk & disorderly

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
19th May, 2005 at 19:02:53 -

the part about when the enemy being destroyed all the arms and legs or whatever dissappear. let me guess. when you attack the enemy a number is added to A,B,C etc value of body and when that value is a certain number destroy the the body and limbs, or when collision with body destroy it and limbs. only one body will dissapear cause its the only one with that value or is being hit but when you have it destroy the arms along whith body it thinks you want to destroy all of them. end result all limbs dissapear. at least thats whats happening to me in a tank game im trying to make. the tank and its cannon would dissapear along with all the other tanks cannons but the tanks would still be there.i couldnt figure it out either. im working on it though. this would take along time but animate the body with arms in all 32 directions.

 
n/a

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
19th May, 2005 at 19:50:45 -

It seems like you're going to have to use Spread a Value - I'm not sure of the specifics of it myself, but I'm sure someone else can help here.

 
http://www.davidn.co.nr - Games, music, living in America

ClownLove



Registered
  04/03/2003
Points
  84
19th May, 2005 at 20:00:24 -

Actually I've assigned the enemy guys to a qualifier (bad) and every hit of the a bullet subtracts 1 from alt value. The enemies body is the one with the qualifier, not the arms. When alt value = 0, destroy bad and arms.

 
punk & disorderly

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
19th May, 2005 at 20:12:59 -

thats basically what i said. except your using a qualifier instead of one of the values for the enemy object. it still thinking when the body is destroyed to destroy all arms cause theyre not included in some sort of value.

hold on, i had an idea. im gonna test it out.
whatever you do, dont delete this feed.

----------------------------------------------------------

ok. do something like this.

also make a value or qualifier for the arms
if the arms are overlapping the body always set their value to bodies value
then just like you have body<=0 destroy body or bad put when arms<=0 destroy arms

this should only set the value of the arms of the enemy your attacking to the value of the body so when the body=0 so do the arms and only those arms are destroyed. hope i said that right and it makes sense.i hope it works for you. it worked in my test.

Image Edited by the Author.

 
n/a

ClownLove



Registered
  04/03/2003
Points
  84
19th May, 2005 at 20:39:09 -

Sweet, thanks, thats one problem solved. now all i need to figure out is why they aren't responding correctly. I think i need to get some web space so people can see whats happening...

 
punk & disorderly

ClownLove



Registered
  04/03/2003
Points
  84
19th May, 2005 at 20:45:39 -

yeah its mmf

 
punk & disorderly

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
20th May, 2005 at 00:12:10 -

A little off topic but I felt the need to ask since wong brought it up.
What exactly does 'spreading a value' do? I've never used it in my life!!!

 
n/a

Brian Haase (FSP)



Registered
  22/01/2005
Points
  691
20th May, 2005 at 01:37:52 -

When you run SPREAD A NUMBER, it takes each object in that collection and assigns a number to it, then steps it. For instance, say you have three instances of the GUARD Object. If you were to spread the value 1 on the GUARD Objects? The first guard would have the value 1. The second, 2, and the third, naturally, 3.

This has a whole array of other uses too. It's a great way to assign unique IDs to every enemy. Once you've done that, you can easily use a FASTLOOP to run a routine for each guard ONE AT A TIME. You could make ONE guard shoot a bullet and run it through a fastloop, so that when it strikes you have a way of knowing where it came from. Of course, you could shoot the bullet and assign the Guards now-unique ID to the bullet too.

If you have an event like 'When GUARD is stopped', it'll only run if atleast one guard is stopped, right? Well some people don't realize that it'll select ALL of the guards that are not moving. Spreading a number then will only affect stopped guards then. I don't know why you'd do that there, but you can. Maybe you could do it to assign goal markers for movement? 'Create marker', 'Set marker to guard X/Y', 'Start Guard moving'

It's terribly useful. I found it pretty handy for my pathfinding work.

 
Current Projects:
Bomb Squad (Total Progress - 3%)
:: Current Task Progress: 40%
:: Current Task - Level Editor Shell

ClownLove



Registered
  04/03/2003
Points
  84
20th May, 2005 at 05:01:13 -

ok here is the 'training' mission.plz exuse everything that looks dodegy and crap, I intend to vastly improve everything, 'thats just there to remind me what goes where'

oh and when you do shoot the first guy and he runs at you all jerky-like, that doesnt usually happen neither.


use the arrows to move, havent changed the controls to wsad yet, and try to ignore the shooting direction bugs.

http://clownyzero.topcities.com/warpigs.zip

<IMG
oh and if anyone has a good idea for something to put in the background behind the
'mountains' would be great.
src="./sitegfx/edited.gif"></IMG> Edited by the Author.


Image Edited by the Author.

 
punk & disorderly

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
20th May, 2005 at 05:42:38 -

why do you use the platform extension in a top view game? I could look through you cca, but I dont have the extension, and having some problems installing the bonus packs...If you remove the platform extension I could help you.

And I am really curious - what are you using the extension for in your game!?

 
http://www.robocaptain.com

ClownLove



Registered
  04/03/2003
Points
  84
20th May, 2005 at 10:04:26 -

Its not top view its a side scroller...

 
punk & disorderly

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
20th May, 2005 at 10:23:09 -

oh... I just read the 32 directions part and assumed it was a top view.

 
http://www.robocaptain.com

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
20th May, 2005 at 15:32:19 -

that little idea i had to fix your problem gave me an idea for a game. thanx

 
n/a

ClownLove



Registered
  04/03/2003
Points
  84
21st May, 2005 at 20:36:58 -

so i suppose noyone here can help me...

 
punk & disorderly

Sashman15



Registered
  14/11/2004
Points
  93
12th July, 2005 at 02:29:28 -

Lol, alotta hope you've got there . Well, if the problem is that when the alterable value goes to 0 and EVERYONE DIES, then i have a solution... I always had this problem, it was a big reason why i sort of gave up on alot of games and on TGF for a little while. Assault Andy gave me some advice on a "war game with stats" thing earlier, he said:


"I think you need to learn about alterable values. They are counters which each object has 'internally'. They are independant of other objects. Here is a short example of how you would use them:

Click on active1 >>> add 5 to alterable value A of active1
Alterable value A of Active1 is greater that 15 >>> Destroy"

Notice that its not "when value A is 0", its when its UP to a certain number, it was the same mistake i made with alterable values, but now i've finally figured them out correctly and its awesome! lol.

 
Heyya, what you sayya?

a1018



Registered
  08/02/2005
Points
  131
12th July, 2005 at 08:54:52 -

I will try my best. Just wait a minute.

 


a1018



Registered
  08/02/2005
Points
  131
12th July, 2005 at 09:34:56 -

url : http://s27.yousendit.com/d.aspx?id=1GPHYM5C8BZFN19A4SYZALK8DV

 

   

Post Reply



 



Advertisement

Worth A Click