Living Dead A.i
#1
Posted 20 March 2009 - 07:32 PM
#2
Posted 20 March 2009 - 08:17 PM
motion_set(point_direction(x,y,player.x,player.y),speed)but you can also have some pretty complicated ai's with a whole command-stack and personalities and the works. Search through the 'scripts' and 'examples and tutorials' sections. there are plenty of different ai scripts and tutorials to help you out.
Edited by zachman, 20 March 2009 - 08:17 PM.
#3
Posted 20 March 2009 - 08:19 PM
#4
Posted 20 March 2009 - 08:42 PM
Yes, it depends on how you want to program your A.I. Also, you can't just ask on the GMC, "Can you please give me a code for an A.I". Most topics that do so get ignored.
Most topics like this won't get much help....but I do happen to have zombies in a game I'm working on right now with very basic AI...or something like AI anyway, it's not strictly speaking an AI...
Most of it only applies to my game, but the movement code I have is possibly useful to you
in alarm[0] I have execute a piece of code...the code is
mp_potential_settings(179,3,10,true)
if (distance_to_object(player) < 600) {
mp_potential_step((instance_nearest(x,y,player).x),(instance_nearest(x,y,player).y),1,false)
speed=S;
}
else
if (distance_to_object(man) < 600) {
mp_potential_step((instance_nearest(x,y,man).x),(instance_nearest(x,y,man).y),1,false)
speed=S;
}
else
if (distance_to_object(demon) < 600) {
mp_potential_step((instance_nearest(x,y,demon).x),(instance_nearest(x,y,demon).y),1,false)
speed=S;
}
else {
mp_potential_step(random(10240),random(7680),1,false)
speed=S;
}
alarm[0]=40;This makes the zombies reevaluate every 40 steps, if there's no target within 600 pixels they'll wander about within an area from 0x,0y to 10240x,7680y, avoiding solid objects; if there is a target they'll move towards it....player first, then man, then demon...you could replace 'man' with ally and 'demon' with civilian and it should work.
You'll also want to replace 10240 and 7680 with however big your room is, and change 600 to however far you want zombies to be able to 'see'
And in the create event of zombies you'll need to set alarm[0] to 40, and create a variable S for how fast you want zombies to move. This will only do movement, not attacking or infecting...you'll have to sort that out yourself cos the attacking system in my game is way to complicated for your purposes.
Edited by amibtious, 20 March 2009 - 08:43 PM.
#5
Posted 20 March 2009 - 08:44 PM
#6
Posted 20 March 2009 - 09:44 PM
But it's probably for a top-down game.
I think you should tell it when you don't have a top-down game.
Because most people assume it's a top-down unless it says something else. (Or when it's a mario game or something like that, then most people expect platform view.)
#7
Posted 21 March 2009 - 12:35 AM
Yes, it depends on how you want to program your A.I. Also, you can't just ask on the GMC, "Can you please give me a code for an A.I". Most topics that do so get ignored.
Most topics like this won't get much help....but I do happen to have zombies in a game I'm working on right now with very basic AI...or something like AI anyway, it's not strictly speaking an AI...
Most of it only applies to my game, but the movement code I have is possibly useful to you
in alarm[0] I have execute a piece of code...the code ismp_potential_settings(179,3,10,true) if (distance_to_object(player) < 600) { mp_potential_step((instance_nearest(x,y,player).x),(instance_nearest(x,y,player).y),1,false) speed=S; } else if (distance_to_object(man) < 600) { mp_potential_step((instance_nearest(x,y,man).x),(instance_nearest(x,y,man).y),1,false) speed=S; } else if (distance_to_object(demon) < 600) { mp_potential_step((instance_nearest(x,y,demon).x),(instance_nearest(x,y,demon).y),1,false) speed=S; } else { mp_potential_step(random(10240),random(7680),1,false) speed=S; } alarm[0]=40;
This makes the zombies reevaluate every 40 steps, if there's no target within 600 pixels they'll wander about within an area from 0x,0y to 10240x,7680y, avoiding solid objects; if there is a target they'll move towards it....player first, then man, then demon...you could replace 'man' with ally and 'demon' with civilian and it should work.
You'll also want to replace 10240 and 7680 with however big your room is, and change 600 to however far you want zombies to be able to 'see'
And in the create event of zombies you'll need to set alarm[0] to 40, and create a variable S for how fast you want zombies to move. This will only do movement, not attacking or infecting...you'll have to sort that out yourself cos the attacking system in my game is way to complicated for your purposes.
Thanks, I just wanted some help on the wandering, i can figure the rest out myself.
Oh, and to the people who were asking if its a TDS, yes it is.
#8
Posted 21 March 2009 - 03:59 PM
Since it's very heavy for game maker to deal with mp.
#9
Posted 21 March 2009 - 04:01 PM
I do have to warn you that a script using Motion Planning (mp) can become slow.
Since it's very heavy for game maker to deal with mp.
What dya suggest instead?
#10
Posted 21 March 2009 - 05:24 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











