Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Adazalya

#1
Oh ineed ! Thank you haha :-D I often think to complicated things before simple ones
#2
Thank you very much for your answer ! Sorry Nanuaraq but I didn't test your script because I just saw it as I am here to tell you guys that I found the solution of my problem ^^"

So I realized that the Walk thing wasn't working because the Walk line was read again and again instead of only one time. So I added a global boolean variable newplace that become true when I press one of the keys that choose the player location and then added this code in the room repeatedly execute function :

Code: ags
///Room Repeatedly Execute
int x;
int y;
if (placement==1) {x=320; y=268;} //each value of "placement" is for a location for the character
if (placement==2) {x=145; y=140;}
if (placement==3) {x=496; y=137;}
if (placement==4) {x=148; y=391;}
if (placement==5) {x=492; y=389;}

if (newplace==true) {
  if (baddy1==true){ //If Baddy is in the room
  cBaddy1.Walk(x, y, eNoBlock);
  newplace=false;}
}


That way Baddy only changes his destination when the character changes his location !
So I will let this here as an other solution to that problem ;)

Thank you again for your answers guys
#3
Actually nope
I'm always using a eNoBlock Walk but it still doesn't work . . .
#4
Thank you very much for your answer

It indeed seems quite logical but I tried and the problem remains the same, it seems like the enemy just can't update its destination to a new location until it reaches the first location . . . I experimented, even "cBaddy.FollowCharacter(null)" won't be executed until the enemy finishes to travel to the location set when the "cBaddy.FollowCharacter(cEgo, 0, 0)" was last read . . .

That's why I am wondering if the Walk function wouldn't be better as the StopMoving function can instantly interupt the enemy movement, I experimented that too with a simple walk command (I could use this to make him move again with an adjusted destination). My problem is that a walk command in the RepExec just doesn't work (dunno why yet) and when I tried to create something with while, it just aborted the script because it loope 150 000 times, so I am guessing I am not using the while word the right way . . . Any idea of how I could manage to write a while loop that checks the character location, stops ans then re-enable the enemy movement ? must I had a Wait somewhere or a counter as you suggested ? That would really help me a lot :-D
#5
Hello everybody !

I am currently on a small project and, as a beginner, I'm kinda stuck.
So I need to make my ennemy chase the main character, nothing complicated here, used "cBaddy.FollowCharacter(cEgo,0,0)" and this is working very well ! Until I move the character, I disabled the character moving by clicking so that the character could only "jump" between five locations affected to five keys. The thing is that if I move the character to another location while the ennemy is moving toward him, the ennemy goes to the first location and start going to the second location only when after this. Which is not what I would like to do of course . . .

So I tried to script something that checks if the location of the character is still the same and disable and re-enable the follow function when it has changed but I still have the same problem. So I am guessing that the game is still finishing the movement before reading the FollowCharacter(null) line and I don't know what I could do.
I mean, is there a way to kind of "abort" the move of the ennemy if the coordinates change and then make him instantly re-move to the new location or something ? Or does the FolloweCharacter simply not allow this ? Would the walk function be more appropriate ? (my attempts with this function didn't really work for now . . .)

Thank you for reading
SMF spam blocked by CleanTalk