Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Bad Voo-doo man on Wed 23/02/2005 01:52:01

Title: Enemies
Post by: Bad Voo-doo man on Wed 23/02/2005 01:52:01
Ok, I've figured out how to have health going with an npc, and main char. just using global ints and stuff, but for actually having the enemy attack I used the FollowCharacter and FollowCharacterEx, but all that really does it just move the "enemy" (i.e. NPC) to the the main character, and then I have it check to see if they are colliding, and if they are i subtract health from the main char.  To see if you are attacking the character, for all the anis used i just set an int to 1 and if your not "attacking" to 0.  if your attacking and your colliding then subtract from npc not you...is there a better way to script out the enimies so they behave more like the ones in real games (zelda, etc.)?

Thanks in advance
Title: Re: Enemies
Post by: Ishmael on Wed 23/02/2005 06:59:08
That seems a good enough way for starts...

Of cource, you can set up checks for character distances (having a "bounding box" inside which standing enemies inflict damage) using the character[CHARID].x and character[CHARID].y variables, and the character[CHARID].loop variable to see what direction that characters are facing while attacking, and if there is an enemy (for the player) or the player (for the enemies) in their area of effect...
Title: Re: Enemies
Post by: Ashen on Wed 23/02/2005 13:44:19
You might find these functions handy:
AreCharactersColliding (char1, char2);
AreThingsOverlapping (thing1, thing2);


AreThingsOverlapping might be better, as it allows you slightly more control over how close they are before it's triggered. AreCharactersColliding uses baselines, and the results are sometimes a little odd (check the manual for more details).
Title: Re: Enemies
Post by: Bad Voo-doo man on Thu 24/02/2005 00:39:05
Thanks you guys, i'll try out both of your ideas, and then get back to you
Title: Re: Enemies
Post by: Kinoko on Thu 24/02/2005 13:50:13
It's one of those tough things because typically enemies in games like Zelda, etc all move in different ways. A really good way to get ideas is simply to play one of those games and watch the way enemies behave. Certainly, using bounding box collision to detect when you're near an enemy then having him come at you is a good one.  One of my enemies is simply on completely random movement so it never zeroes in on you, as such (it's a mouse though, so it makes sense).

Everything you came up with about attacking is exactly what I have, pretty much, so if you find a better way, I'd like to know it ^_^
Title: Re: Enemies
Post by: Bad Voo-doo man on Fri 25/02/2005 00:15:46
I was thinking...have the enemies walking on a "path" and then when the player steps on a certain region they "see" him and then go after him..using a bounding box like you guys said for the detection part of the attack
Title: Re: Enemies
Post by: Nexic on Sat 26/02/2005 19:30:37
I think you are better off using a different program if you are trying to make a real time combat game. Turn Base RPGs can work with AGS, but something that intense isnt really. At least, it will be a lot of work and you probably still won't have anything that great.
Title: Re: Enemies
Post by: DoorKnobHandle on Sat 26/02/2005 19:34:11
:) Hey, I am working on a real time strategy game... it is possible to do this real time stuff in ags but it requires a really high scripting skill...
Title: Re: Enemies
Post by: Bad Voo-doo man on Sun 27/02/2005 22:59:23
having it stay as an RPG..where they always walk around..not turn based :)


i.e.
---------------------------------
                       O
- - \                 
     - - - - - X   

--------------------------------
If the player was walkin on the path ( - - - ) when they step on region x, enemy "O" will 'see' them and run over to them and follow them around