@EneilShade Thanks! But I encountered another problem, for some reason they still can see me through my walls... I have 2 types of walls and they can't see through one, so i copied and pasted the code and made the appropriate changes but they still see me! Any suggestions?
@TheProjectX01 Have you set the walls to solid? If I remember correctly, that is one of the requirements for the line of sight, there can be no intervening solid object.
@TheProjectX01 I don't even have GameMaker anymore, I must admit. So no, I apologize, I do not have any other ideas. I do have a suggestion though: go find a GameMaker forum, post a link to your code, and ask for help there, for I can be of no assistance to you other than what exists in this video.
@Mr21505 Then -- I hate to say this -- I guess you are not cut out for game programming. This is one of the most simple examples of an AI that you can find. I don't mean to patronize you or demean you, but I also won't do your research for you. If you want more information, do some more looking around.
I'm making a Dungeon Crawler type game still trying to work out what kind of fighting mechanism I should use, but I want to make an AI that will go threw the dungeon slowly moving searching it and then if it see's me chase me until he dies or I'm too far away from him. I'd love it if you should send me codes to help me does such a thing if you still ever come online or read posts or can be bothered sending help.
@varlclough Oh, I respond to every comment, have no fear. I do see a problem in this though: I no longer use GML, and have forgotten most of it. My suggestions: if you are new to programming -- keep at GML. Else, go with C++ or Java -- they are better.
@ShastySpy I don't know how you propose I fix your problem with no information other than "<=SightRange". If you included the surrounding code and the error, I might be able to figure it out. If you do, I will do my best to help, but I need more info.
@ip3wnual0t Thank you very much! I would do so, except that I have recently gotten a new system, and GM8 pro does not work =(.... sorry so much. I might just have to spend another $25 or whatever it is and get it again. I miss it.
I copied exactly what you did in the video, (you're awesome) and it almost went flawlessly. But at the end, to make the AI more realistic something goes wrong. When i start the game my enemy isn't chasing me, but when i apear from behind a Block it starts to chase me, but he doesn't stop chasing me as in your video.
@filmman007 you mite have to re look over the code or in my video cheak that guys channel in the credits he has the full tutorial just with his the gravity is messed up and makes ur guy constantly shake.
@AissurDrol Thanks! I appreciate the "pro" adjective, even though it is not totally true, but, good luck on your game! Contact me if you need any more help.
if you did not place the object guy in the room then that error pops up you can also add on object1 "if instance_exists (guy) mp_potential_step(guy.x,guy.y,4,true)"
and if none of this works set the depth of object guy negative so it will be drawn first in the room and set the object1's depth positive so it will be drawn later if none of this works just send me a message
very nice tutorial, I actually learned a couple of things which can kinda be rare when you've been using game maker for 4 years. Keep these coming they're great.
Hey man, when I put the code in, it says the x and y in the coordinates is an unknown variable. Do you know why? (I'm not too much of a noob, but I'm still confused. :S)
Please answer! What number do I put so that it does not go around non solid objects?
TheProjectX01 2 days ago
@TheProjectX01 You would put a 0, I think. It has been 3 years since I have touched GML, so it is only a guess.
EneilShade 2 days ago
@EneilShade Thanks! But I encountered another problem, for some reason they still can see me through my walls... I have 2 types of walls and they can't see through one, so i copied and pasted the code and made the appropriate changes but they still see me! Any suggestions?
TheProjectX01 1 day ago
@TheProjectX01 Have you set the walls to solid? If I remember correctly, that is one of the requirements for the line of sight, there can be no intervening solid object.
EneilShade 18 hours ago
@EneilShade Yes, it is solid... Any other guesses?
TheProjectX01 14 hours ago
@TheProjectX01 I don't even have GameMaker anymore, I must admit. So no, I apologize, I do not have any other ideas. I do have a suggestion though: go find a GameMaker forum, post a link to your code, and ask for help there, for I can be of no assistance to you other than what exists in this video.
Good luck!
EneilShade 12 hours ago
@EneilShade Oh, also they speed up when there is nothing between us... Maybe that could help you figure it out?
TheProjectX01 14 hours ago
I didn't understand AAAAANYTHING about the codes, ok????
Mr21505 6 months ago
@Mr21505 Then -- I hate to say this -- I guess you are not cut out for game programming. This is one of the most simple examples of an AI that you can find. I don't mean to patronize you or demean you, but I also won't do your research for you. If you want more information, do some more looking around.
EneilShade 6 months ago
Omg your voice has changed so much
dragonman979 8 months ago
Who is Clayton Walker
supman167 9 months ago
@supman167 he is a freind of both eneil and myself
dragonman979 8 months ago
@dragonman979 thanks sorry just wonderin
supman167 8 months ago
I'm making a Dungeon Crawler type game still trying to work out what kind of fighting mechanism I should use, but I want to make an AI that will go threw the dungeon slowly moving searching it and then if it see's me chase me until he dies or I'm too far away from him. I'd love it if you should send me codes to help me does such a thing if you still ever come online or read posts or can be bothered sending help.
varlclough 9 months ago
@varlclough Oh, I respond to every comment, have no fear. I do see a problem in this though: I no longer use GML, and have forgotten most of it. My suggestions: if you are new to programming -- keep at GML. Else, go with C++ or Java -- they are better.
EneilShade 9 months ago
bud, I ran into a problem <=SightRange i get a code error with GM 8.1
ShastySpy 10 months ago
@ShastySpy I don't know how you propose I fix your problem with no information other than "<=SightRange". If you included the surrounding code and the error, I might be able to figure it out. If you do, I will do my best to help, but I need more info.
EneilShade 10 months ago
It seems nobody can do tutorials the right way. Everybody forgets the first step!
1. show the end result. This is what the viewer will be creating. If the end result is not what the viewer wants, he/she can tune out here.
2. do a step by step tutorial.
3. once again the end result -> viewer can check if the result matches theirs.
This is in no way directed to you personally, but more a general notion which I just happened to post here ;)
slaQ83 1 year ago 2
@slaQ83 Well, thank you honestly! The next tutorial I make (I just have to get off my lazy butt) I will follow this pattern! Thank you very much.
EneilShade 1 year ago
There's no point of avoiding objects if he can't see you behind them! xD
brutaka359 1 year ago
Cheak my simple enemy AI video should be easier for people who dont like code its all drag and drop but doesnt have line of sight.
ip3wnual0t 1 year ago
your my hero :) works on GM8 pro and keep posting tutorials plz ur good.
ip3wnual0t 1 year ago
@ip3wnual0t Thank you very much! I would do so, except that I have recently gotten a new system, and GM8 pro does not work =(.... sorry so much. I might just have to spend another $25 or whatever it is and get it again. I miss it.
EneilShade 1 year ago
ughhh the sight range isnt working for me there isnt a error t just follows me nomatter what
pureshadock64 1 year ago
@pureshadock64 sry it only follows you dont kno code for line of sight but ive seen other videos with the tutorial.
ip3wnual0t 1 year ago
Comment removed
pureshadock64 1 year ago
Comment removed
pureshadock64 1 year ago
I've got a problem, please help.
I copied exactly what you did in the video, (you're awesome) and it almost went flawlessly. But at the end, to make the AI more realistic something goes wrong. When i start the game my enemy isn't chasing me, but when i apear from behind a Block it starts to chase me, but he doesn't stop chasing me as in your video.
Why?
Pls help, I need it for a schook project :D
filmman007 1 year ago
@filmman007 I cannot help you, as I do not have your code in front of me right now. But I would like to if you could send me the AI code.
EneilShade 1 year ago
@EneilShade
Thnx, but I already solved it. Don't laugh at me
I typed ''Avtive'' instead of ''Active'' once. Almost invincible to the eye, took me 2 hours to see it -.-
Thnx anyway!
filmman007 1 year ago
@filmman007 I have NEVER (DRIPPING WITH SARCASM) done that!
EneilShade 1 year ago
@EneilShade
I do have another question though. How do I make the AI go slower?
filmman007 1 year ago
@filmman007 AI go slower you change the speed on move towards under comment following the player.
ip3wnual0t 1 year ago
@filmman007 you mite have to re look over the code or in my video cheak that guys channel in the credits he has the full tutorial just with his the gravity is messed up and makes ur guy constantly shake.
ip3wnual0t 1 year ago
This is what I needed but I need more training with codes. Do you have this in something else than codes.
Layemard09 1 year ago
lol at "this is my first time using ai"
ur a pro if you figured that out on your first try.
and thx. this will be helpful in my game, which is a hybrid game. top down + rpg + whatever else i can add in. oh yeah. and its 3d.
AissurDrol 1 year ago
@AissurDrol Thanks! I appreciate the "pro" adjective, even though it is not totally true, but, good luck on your game! Contact me if you need any more help.
EneilShade 1 year ago
now the guy with ai just circles the player weirdly
MoskowFreak1111 1 year ago
for some reason it does not work, the guy with ai just moves right, I copied the thing right down, I use gm8
MoskowFreak1111 1 year ago
A-W-E-S-O-M-E, THANKS
MoskowFreak1111 1 year ago
subbed....
Th1s1sMyAcc0untNam3 1 year ago
What can I say?
FUCKING PLAIN STUPIDLY AWESOMENESS!!!
I've waiting for a vid like this for AI's and here it is.
Everybody else is just making it too hard for me to understand.
I'm not a person who just copies random stuff and put up on the Internet.
I like to UNDERSTAND why that thing do that thing.
And you've completely understood that some persons need that.
Thank you for this tut, I subbed, rated, commented (of course) and I'm waiting for more advanced AI vids.
MriPhoneBK 2 years ago
More advanced you say... Well, give me a while because I am working on a game for the YoYoGames competition, so I am sorta tied up...
EneilShade 2 years ago
@EneilShade Take your time. I'm working on my biggest game ever, so it can take a while for me too.
MriPhoneBK 2 years ago
Comment removed
MriPhoneBK 2 years ago
never mind i said it wrong but i forgot what i was gonna say
metroidfan777 2 years ago
i didnt know how to make the lov, thx
PyroTomas 2 years ago
Comment removed
metroidfan777 2 years ago
What do you mean? The enemies follow the player, not the mouse.
EneilShade 2 years ago
lol nvrm i just had to name the character guy i forgot to do that
catsrule2468 2 years ago
plz help when ever i start game this is what pops up:
ERROR in
action number 1
of Create Event
for object object1:
Error in code at line 1: mp_potential_step(guy.x, guy.y, 4, 1)
at position 19: Unknown variable guy
catsrule2468 2 years ago
if you did not place the object guy in the room then that error pops up you can also add on object1 "if instance_exists (guy) mp_potential_step(guy.x,guy.y,4,true)"
and if none of this works set the depth of object guy negative so it will be drawn first in the room and set the object1's depth positive so it will be drawn later if none of this works just send me a message
metroidfan777 2 years ago
very good, just change it so that it follows you also when he is not facing you AFTER he is once noticed where your curretn position is.
KaiserOfRust 2 years ago
very nice tutorial, I actually learned a couple of things which can kinda be rare when you've been using game maker for 4 years. Keep these coming they're great.
thepog 2 years ago
Thanks a bunch!
0MrENigma0 2 years ago
No problem.
EneilShade 2 years ago
Hey man, when I put the code in, it says the x and y in the coordinates is an unknown variable. Do you know why? (I'm not too much of a noob, but I'm still confused. :S)
narwhals1 2 years ago
I have no idea. Upload your .gmk to a hosting site and give me a link. I will try to find your problem.
EneilShade 2 years ago
i love this and im a noob . so if you could make one where the ai shoots i would love it.and if i copy the code this will work
torysbom 2 years ago
I will make one where the AI shoots. And yes, if you just copy and paste the code, it will work. Thanks for the good comment.
EneilShade 2 years ago
could you also tell me how to make them randomly move when you go behind an object
torysbom 2 years ago
I might just post an example for that one. But thank you for the idea at any rate.
EneilShade 2 years ago
Dude, that's awesome! It helped me alot. Thanks!
Zovex11 2 years ago
No problem, would you like anything else done?
EneilShade 2 years ago
Cool :D
animemaster96 2 years ago