HELP WITH EVENT CODING...

Posts

Pages: 1
Alright, basically, I have it set so the event (a zombie) chases the player. I know you can do this automatically by having the event's move pattern set to approach, however, I want to do it the long way so I can have the zombie chase NPCs if they're closer.

So, this is what I have (with some notes)

LOOP
V1 = Player's Map X
V2 = Player's Map Y
V3 = Zombie's Map X
V4 = Zombie's Map Y
(V5 is the X distance between player and zombie)
V5 = V1
V5 = V5 - V3
(V6 is the same, but with the Y axis)
V6 = V2
V6 = V6 - V4
(This conditional branch changes the values of V5 to a positive number if it's negative so it could be potentially compared to a positive Y)
Conditional Branch: V5 < 0
V7 = V5
V7 = V7 - V5
V7 = V7 - V5
Branch End
(This conditional branch does the same, but for a negative Y axis)
V8 = V6
V8 = V8 - V6
V8 = V8 - V6
Branch End
(This next branch compares X to Y to see which is greater)
Conditional Branch: V7 >= V8
(If the X axis is greater than Y, the zombie will move in the appropriate direction, left if the original outcome was negative...)
Conditional Branch : V5 < 0
Set Move Route : Move Left
(...or right if the outcome was positive)
Else
Set Move Route : Move Right
Branch End
(Now, if the Y is greater than X, the zombie should move in the correct direction, up if the original outcome was negative...)
Else
Conditional Branch: V6 < 0
Set Move Route : Move Up
(...or down if the outcome was positive)
Else
Set Move Route : Move Down
Branch End
Branch End
Repeat Above



Now, here's where my problem lies. Everything works perfectly except moving down. The zombie just won't do it. It'll move right, left, or up towards the player consistently and correctly, but it will never move down. Any help appreciated.
Give me some time to try this out and find the problem. I will post back if I find it.

EDIT(again.....): Found the problem. In the event coding, switch the positions of the move right and move down codes. problem solved. Tell me if it doesn't work and I'll send you mine.

Also, thank you for figuring this out. This is something I've been wanting to do for some time but couldn't figure out how.
Well, I switched the Move Right and Move Down commands, and now the zombie does indeed move in all four directions...however, he moves down when he should move right and right when he should move down, since they're switched. @_@ If yours is working correctly, I would love it if you sent it.
Ok, I fixed the problem this time, but to do it, I had to erase variables 7 and 8 from usage. Is that ok?
Yeah, as long as everything works, that's fine. That's actually better. I don't use them for anything else, so it'll free 'em up.
Here it is

I left my debugging efforts in there. Press A to see all the variables.
Oh, and I tried it for the other event there, and the zombie will follow him
Enjoy!
Hm, it won't let me open it...it says I don't have the RGSS RTP Standard?
Chances are Quiversee's is in RMXP, and you don't have the RMXP RTP. Just google it, should be easy enough to find.
Yep, with the RTP I can run the game...however, I can't open the project file to see the coding, 'cause RPG Maker XP doesn't seem to work with Vista. ._.
You would be completely wrong to say that. Just right click it, go into properties. Go into the Compatibility tab, and check "Run as Administrator"
Sorry. By the syntax it looked like it was in RPG Maker XP. What maker do you use? I can convert it.
Sorry. By the syntax it looked like it was in RPG Maker XP. What maker do you use? I can convert it.

No worries. I'm using VX. But apparently I can run XP if I run it as an administrator, so I'll try that.

Edit: Yep, that worked. I'm remaking the coding in VX, I'll let you know if it works out!
I see. I forgot that XP and VX syntax is almost identical, like 2k and 2k3 are identical.

Next time I'll remember to ask so I can make it in the right one.
Save yourself some headaches in the future by opening the run menu, entering "msconfig", going to the Tools tab, and disabling the UAC.
Got it all redone, works perfect so far! Thanks SO much. If I ever get this game finished, I'll be sure to credit you. ^_^
no trouble, and you yourself deserve credit for the find itself. Like I said I have been trying to figure this out... and it seems to work better than the normal move toward player command.
Pages: 1