Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Red Fox on July 03, 2008, 05:57:04 PM

Title: X & Y's makes me go insane crazy.
Post by: Red Fox on July 03, 2008, 05:57:04 PM
I got this monster walking around in a map and when the player gets into the first three squares from the monster it should start following him.

This is the code I got so far:
<>Loop
 <>Variable Oper: [0001:Hero X] Set, Hero X Coord.
 <>Variable Oper: [0002:Hero Y] Set, Hero Y Coord.
 <>Variable Oper: [0004:Monster X] Set, Monster 1 x Coord.
 <>Variable Oper: [0005:Monster Y] Set, Monster 1 Y Coord.
 <> Wait: 0.1 Sec
 <>
: End Loop
<>

And

<>Branch if Var [0001:Hero X] is V[0004] Equal
 <>Switch Operation: [0002:Monster Seen you] ON
 <>
: Else Handler
 <>Branch if Var [0001:Hero Y] is V[0005] Equal
  <>Switch Operation: [0002:Monster Seen you] ON
  <>
 :End
 <>
:End
<>

But this code gets the whole row and I just wants the first three squares from the monster. I guess I will have to add or subtract some number somewhere but math isn't my strong side.

Help would be appreciated.


On a sidenote: The recomended tutorials doesn't work.
Title: Re: X & Y's makes me go insane crazy.
Post by: Felix-0 on July 03, 2008, 06:09:08 PM
 :o
whoa...I'm working on this RIGHT now...it sounds intuiging


NOTE: I messed around with it for a bit.....
It would be easier to keep it how it is...if the enemy is moving then issues appear...
they need to be in spots that you can't get behind..or else the event get's activated from behind the person
Title: Re: X & Y's makes me go insane crazy.
Post by: karlc on July 03, 2008, 06:30:02 PM
cool!
i have a similar question
how do u make it so that an event will hapen if the hero is 1 square away from the monster from  any direction.
for now ill try to work with  your code!
Title: Re: X & Y's makes me go insane crazy.
Post by: Fisherson on July 03, 2008, 06:39:06 PM
Okay he's aking for help not writing a tutorial,so post if you have
some advice,please.I'm not mad at you guys ,it's jest anoying when pepole
post un-usefull infromation when your looking for help.

Whoops sorry jest saw your post Kalrc.
Title: Re: X & Y's makes me go insane crazy.
Post by: Bluhman on July 04, 2008, 03:32:30 AM
You know, I've actually done this successfully. Let me get my script, just a mo.

Ok, what you want instead of that is to also do a difference variable between hero and monster x and y, by subtracting one from the other. Perform four different conditional branches that make sure that the X and Y differences are between -3 and 3. If all of them are true, commence the chase!
Title: Re: X & Y's makes me go insane crazy.
Post by: Felix-0 on July 04, 2008, 03:52:35 AM
oh yea Variable range!!!
I forgot about that!
 :bend: Nice job Bluhman...
Title: Re: X & Y's makes me go insane crazy.
Post by: Red Fox on July 04, 2008, 08:35:30 AM
Thank you Bluhman you saved my game.
Title: Re: X & Y's makes me go insane crazy.
Post by: karlc on July 04, 2008, 04:15:57 PM
im sorry i don't quite understand what bluhman is saying
can someone explain it please?
Title: Re: X & Y's makes me go insane crazy.
Post by: A Forgotten Legend on July 06, 2008, 03:42:33 PM
I did it this way on VX.  Its basically the same as it would be on 2k3.


(Common Event - Parallel Process)
Player X = Var. Player X
Player Y = Var. Player Y


(Event - Parallel Process)
>Event 1's X = This Event's X
>Event 1's Y = This Event's Y
>Conditional Branch: Player Y = Event 1 Y
-->Conditional Branch: Player X </= 11 (The X cord. farthest away from the event that I want it to see)
-->DO STUFF HERE
-->Branch End
>Branch End



I just copied this event, and gave any new event's I've made different variables.  Though, I used the same Variable if it was on a different map.
Title: Re: X & Y's makes me go insane crazy.
Post by: karlc on July 06, 2008, 10:24:49 PM
i tried it and it didnt work. maybe i did it wrong