Getting player location script: where is my mistake?

Ionenschatten

Villager
Member
Joined
Jul 21, 2017
Messages
14
Reaction score
4
First Language
german
Primarily Uses
Other
Hey there! I've been trying to make a skill that checks if you're standing around an object and if it's the correct location it will activate a switch.
But for some reason the script does things that seemingly defy logic. The whole script is a huge mess, I'd also love any tips to just make it simpler.

First of all the classic. A common event.
1601324223981.png
Now the mess begins.
I've made 4 different checks for the 4 possible locations around said object. They're labelled Hoch, Runter, Links and Rechts, the german translations for the 4 directions. (Up, down, left, right)
1601324400099.png
1601324444702.png
1601324479873.png
1601324497750.png
1601324511884.png
Now, why do you ask did I insert all of the weird SEs? I've used them to get some sort of a noise code indicating what the script actually does.
And this is what it gives me: Dog Dog Evasion Dog Frog Dog Frog
How on earth is Frog twice?
Also how do I make an out of combat skill that effects the environment if you're standing in special places?
 

Attachments

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,911
Reaction score
7,449
First Language
German
Primarily Uses
RMMV
Before anything else, you made one of the more common mistakes for posting events: you made incomplete screenshots that are missing half of the event - the half with the properties.
But properties like the trigger are very important to see how the event will behave.
So please give one complete screenshot before posting the content only.

Second problem - you didn't tell us what you want the event to do, only where it doesn't do what you want it. That has two negatives:
first, any event using absolute coordinates to check something is difficult to bughunt without knowing what each player position means.
second, there are usually better ways to implement map interactions than to have the player checked for positions in parallel processes. And we can't tell you which of the other options to use if we don't know what the effect in game should be.

Last - from the parts that I can see your use of call common event is sub-optimal. You should call common events to either better organise your events, or to prevent repeating commands.
Technically you're doing that, but especially if you're setting data with control variable it has been proven again and again that it is much better to have the control variables directly before the conditional branch, to make sure that there is no mistake in the sequence. And calling a common event for only two commands is not really reducing repeats.
 

Ionenschatten

Villager
Member
Joined
Jul 21, 2017
Messages
14
Reaction score
4
First Language
german
Primarily Uses
Other
Properties didn't seem to matter to me as I can just do whatever I want with them. For testing reasons I always set them to basic settings aka Action button trigger and that's it. all that matters here to me is the event execution.
I want to make a statue that you have to stand infront of and then use a special skill that you can only obtain using a special item.
So both the statue and the skill are vulnerable to mistakes given my lack of expertise.
Since you can access the statue from 4 sides I have basically simplified everything to the following:

If you stand around the statue, face it and then interact with it you activate the switch.

And even that fails.
The more complicated staff skill stuff comes later. 1601335909349.png
1601335930790.png
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
This is not a script and has nothing to do with Javascript. What you have are event commands.

You have still cropped your image - are those two screenshots from the same event? How is that logic meant to be triggered? You have it set to action button, which means the player needs to interact with the event in order for the commands to be run. If that happens, it means the player is standing one tile away from that event. And if that's the case, and this is the event you want the player to be standing near (with your PlayerX = ... and PlayerY = ... checks), you don't really need to check the player coordinates at all, just the direction.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,213
Reaction score
8,467
First Language
English
Primarily Uses
RMMV

I've moved this thread to MV Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

Ionenschatten

Villager
Member
Joined
Jul 21, 2017
Messages
14
Reaction score
4
First Language
german
Primarily Uses
Other
You have still cropped your image - are those two screenshots from the same event?
Yes, the person above wanted me to post the whole thing again.
How is that logic meant to be triggered?
Via a Skill from an item. Again, I have simplified it and for now destructured the entire thing.
Usually I'd have to not only make those commands work but also the fact that it's being played by a skill. 2 things, both vulnerable to mistakes on my side. Therefore I've left out one part to focus on the other. For now, the trigger is an action button so I can fully focus on getting a correct script right now.

If that happens, it means the player is standing one tile away from that event.
Yes, they're standing around the event and face it. Therefore the event can't fail in my testruns. Yet it fails badly. I want to focus on fixing those mistakes first.
you don't really need to check the player coordinates at all, just the direction.
Later I do, right now I technically do not. I still want to keep this in despite it always should be "right" since the player always has to be in one of the four spots facing the event to activate the event.
Last - from the parts that I can see your use of call common event is sub-optimal. You should call common events to either better organise your events, or to prevent repeating commands.
How could I do that? I have no idea how label really work and I'm pretty limited in my common event experience.
I've moved this thread to MV Support. Please be sure to post your threads in the correct forum next time. Thank you.
Thanks! I posted it in the wrong forum because I had a similar question before which I also posted in this forum but the question before indeed had javascript, this one does not.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

it took soooo long to get character assist to work right in my game. like certain fighting games, a team mate can hop in, do an attack, then leave. it works since these are all one on one fights (usually)
Honestly. Didn't sleep for a day. ONCE
Hi! I've been working on some character sprites for my pirate themed game.
Still somewhat new to pixel art, so feedback or inputs would be appreciated ^^
TRIVIA: I love Japanese food and culture! I've never been to Japan, but someday I'm going to go to Tokyo and do some touring, including Disneyland Tokyo and DisneySea! And I even prepared myself for earthquake safety.
The virus really doesn't want us to do this GameJam. v .v' Even if we don't meet the deadline because of it, still plan on making it a game we'll release.

Forum statistics

Threads
104,255
Messages
1,005,001
Members
135,768
Latest member
WaterGoddess
Top