I Currently only know how to make my character move but is there any way to make an npc/bad guy move around
ive read tons of the manual and beginers Faqs but cant find out how
cEnemy.Walk (int x, int y, optional BlockingStyle, optional WalkWhere);
where enemy is your character's name. The third argument is either game blocking (eBlock) or goes on in the background while the game continues (eNoBlock). The last argument is either eAnywhere, which ignores your rooms walkable areas, or leave it out if you want them to stay on your walkable areas.
If you mean how do you move your NPCs with something similar to artificial intelligence then you've probably still got a lot of reading ahead of you. I'd set up some triggers under "Repeatedly Execute" like when the player character gets too close (e.g. cPlayer.x > cEnemy.x -20) or when a timer goes off (IsTimerExpired (1) ==1).
Baron
sorry about long time post but i dont use ints so it says parse error near int
EDIT
Odd the other charectar moves for me sometimes on the y axis when im in the room i use 2.7 so how could i fix this
There's something wrong with your code. That's really the only thing I can contribute here without taking wild, wild guesses.
Do you even WANT help? How are we supposed to do anything remotely similar to solving your problem if you don't show us even one line of the code you've used...??
Btw, did you fix the int problem (by reading the manual and looking at the example immediately below the Character.Walk command's explanation)?
havent been on Ags in while cant find where manual is
heres line i have
cBob.Walk (int x, int y, eBlock, eWalkableAreas);
in repeatedly execute
it says parse error in line 30 in expr near 'int'
Some quick research would lead you to the AGS wiki (http://americangirlscouts.org/agswiki/Contents_%28manual%29). Isn't the manual packaged with AGS 2.7, accessible via the help menu in AGS itself?
I would recommend looking at the manual somewhere to closely inspect an example of character.Walk to see where you might be making your mistake. In the online version you can find it under scripting -> character properties and functions. In AGS itself there will be an alphabetical index.
Baron
If the code you have is literally
cBob.Walk (int x, int y, eBlock, eWalkableAreas);
then the int problem is pretty obvious. You can't put "int x" or "int y" right in the function call; you have to replace that with an actual value.
Like everyone else is *strongly* recommending, I think you should read the manual. Maybe take a look at the tutorial.
ya, i finished reading manual and i get it now, but i dont see how to make a character walk towards a moving character like in hero rpg, the enemys walk towards you and if you turn they still go towards you
i just dont get if theres a command like cBob.Walk (character*cEgo - 12, -12);
so they walk to my character but 12 off of him on x and y axis
fixed that sorry
but repeatly execute code only lets him stay in place then animate as if hes walking, and he will turn to face me, but he doesnt walk towards me
heres the line in repeatedly execute i have
cBob.Walk (cEgo.x - 1, cEgo.y - 1);
That's because it's non-blocking by default, which means the character is continually flashing on screen. I recommend this code:
if (cEnemy.Walking == false) {
cEnemy.Walk(Random(Room.Width), Random(Room.Height), eNoBlock, eWalkableAreas);
}
This code will make the enemy move randomly around the screen. If you want the enemy to actually follow the hero, look for the Character.Follow function in the manual.
ive tried follow but he just walks to where my character started in the room, not following my character
Did you try
cBob.FollowCharacter(cEgo, 0, 0);
?
PLEASE, show us the code you've used.