Complicated event system

Status
Not open for further replies.

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
Hello,

I'm creating a system complety with events. It's quite complicated to explain (and my english suck) but I'll do my best.

Here is what I want to do :

In my game the hero get some kind of wierd object ( shown as a hud ) that look like a watch but that actually works like a compass. Every time the player press a certain key, the watch hands of the "watch" turns (exactly like the ones of a real watch but way faster) until they point the direction of the player's goal in the map (in game, this "goal" is an event.)

I'm sure it is possible to do with events but I already tried and failled : It's not working correctly.

The watch hands are turning almost non-stop randomly and are not pointing the right direction.

So I'm here and I hope someone can help me.

To locate precisly in wich direction the "goal" is from the player, you need to use degrees. Since RPG don't do that easily, I had to request a script.

@Source did a great one (to put above main in the script section):

class Game_Interpreter def angle_from_player(id) event = $game_map.events[id] ((Math.atan2(event.y - $game_player.y, event.x - $game_player.x) * 57.29577951308232) % 360).to_i end end To use with this script call code to got into a variable the angle:

p angle_from_player(id)With (id) being the ID of the event, "goal"

Also, since the watch hands are pictures, you need to rotate them to point a direction. And Rpg maker can't rotate picture to a certain angle.

So, again, I use a script to do that (To put anywhere in the script section "Game_Picture") :

def set_ang(angle) @angle = angle end To use with the script call :

$game_map.screen.pictures[id].set_ang(value)With [id] being the ID of the picture to rotate and (value) the degrees. (Note that to make the degrees increase clock-wise you, curiously, need to substract them. for example : -34° instead of 34°.)

And now here are my events :

This is an event on the map.

https://www.dropbox.com/s/k0bq6vgpql4bb8f/screen%20shot1.png?dl=0

And theses two are common events.

https://www.dropbox.com/s/xce9d617ruxhpas/screen%20shot2.png?dl=0

https://www.dropbox.com/s/6gmtytwbrlsepau/Screen%20shot3.png?dl=0

Finaly, here is a demo of my game, so you can see what's making not working my system with event and even change it to make it work better.

I'm still working on this so it's a complete mess ( a part of the system on event, another part on a common event... etc).

https://www.dropbox.com/s/b5r85a0jd53ggv7/Watch%20sytem%20test.exe?dl=0

Now you have everything you need to understand how my system works so I hope you can help me.

Thanks for taking the time to read this.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Unable to find file: Graphics/Pictures/montre


You haven't actually said what's wrong with it. At least explain what it's doing (or not doing) that's incorrect.
 
Last edited by a moderator:

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
 I edited my first post by adding screenshots of the events, and coments inside the demo file.
 
Last edited by a moderator:

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
I tried a fiew more things things to make it works but It still don't. ;_;

This system is very important for my game and must finish it.

Help please !
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
Both of your conditional branches check for the hours variable being equal to the goal, but nowhere in the compass common event do you actually change the value of hours, so if it isn't already equal to the goal your compass is never going to stop moving.

I haven't really been able to "fix" this because I have no idea how you actually intended it to work.
 
Last edited by a moderator:

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
Both of your conditional branches check for the hours variable being equal to the goal, but nowhere in the compass common event do you actually change the value of hours, so if it isn't already equal to the goal your compass is never going to stop moving.
I don't think that's the problem. Just take a look a the third event page :

https://www.dropbox.... shot3.png?dl=0

This page is here to makes the watch hands works correctly. The firsts conditionnals branchs are substracting to the hours variable the value 1 every 12 minutes passes. (Like with a real watch.)

So basically, my variable for the hours should be changing so that's probably not the problem, right ?

I haven't really been able to "fix" this because I have no idea how you actually intended it to work.
Sorry I'm very bad at explaining my problem. :o

Here is how it is intended to work.

-Basically, the first page (https://www.dropbox.... shot1.png?dl=0) shows the HUD, calculates, converts the degrees and switch on the second (https://www.dropbox.... shot2.png?dl=0) and thrird pages, when the player press the key.

-The second one check if the watch hands are pointings the right direction, then change the variables until they are and finnaly quit the event until the player press the key again.

-The third one is supposed to work in the same time as the second page and controls the variables for the hours and minutes. (so the second event page can use them.)

Hope you understand. But feel free to change the way it all works if you want.

Thanks you very much for your time.
 
Last edited by a moderator:

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
If you write a step by step description of how you intend it to work and look, I'll write a script for it. :)
 

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
 

Wow. Thanks so much. :D

I'm going to do my best to make it as clear as possible.

First, let's recap what the system would do.

Let's say you're on a map. Your goal is an event on this map. When you press the "Enter" key, the watch-hands of the watch both moves until the hours watch hand points the exact direction of this goal on the map.

While the watch hands are moving, you can't move (like when there is an autorun event running).

Of course, when they aren't, you can.

About the watch hands movements :

-They are moving way faster than thoses of a normal watch, so you don't wait long before they are pointing in the right direction.

-When the key is not pressed, they don't move at all.

-They are moving exactly like the ones of a real watch : When the minutes watch-hand moves of 12 notch, the hours watch-hand moves of 1 notch. So in most cases, both watch-hands are not pointing in the same direction. That's why only one watch hand can possibly point the direction of the goal. In my system, it's the hours watch hand.

When you press the "Enter" key, the watch-hands of the watch both moves until the hours watch hand only points the exact direction of the goal on the map.
Now, here is how it is supposed to look like :

Here is the Hud of the watch in game, with the hours watch hand pointing the goal direction : This is how I would like the system to look like :

Hud in game.png

The hud of the watch :

montre.png

The hours watch-hand :

heures.png

And the minutes watch-hand :

minutes.png
Here is what I would like the script to have :

-A script call to set wich event on the map is the goal. For example : "set_goal(id)" with (id) being the ID of the event.

-A number of use for the watch-system : When you press the key, if the variable for the number of use is less than 1, the system don't work.  And when the system finished working, (when the watch hand is pointing the right direction ), then it substract 1 to this variable.

The possibility to change :

-The pictures the script use.

-How fast the watch hands move.

-The ID of the variable for the number of use.
Finnaly, here is how the system would work, step by step :

- Check if key "enter" is being pressed.

-If yes, it check if the vaiable for the number of use is greater than 0.

-If yes, first it stop the player from moving and then it use the script call you made to know at how many degrees the event "goal" is from the player. Then it convert theses degrees into hours and minutes (to know where the hours watch hand must point at) and put the result into a variable.

 (0° or 360° = noon or midnight, 180° = 6 hour... )

-Then, every X second, it add 1 to the variable "minutes" ( and move the minute watch-hand) ,and since the variable for the hours depends on the variable for the minutes ( It increase of 1 every 12 minutes), the hours watch-hand will move too.

-It will keep moving until the variable for the hours is equal to the variable for the hours and minutes of the goal.

-Then both watch hands will stop moving and the game will stop adding 1 to the variable for the minutes.

-Finnaly, It will give the player the possibility to move again and substract 1 to the variable for the number of uses.

(You also need to :

-make sure the variables for the hours and minutes can't be greater than 60.

-make sure that every 12 minutes, the variable for the hours increase by 1.

-Show the pictures for the Hud and the watch hands all the time.)


Thanks again for your help. :)

Hope it was clear enough. (Sorry If my post is so long.)
 
Last edited by a moderator:

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
Problem solved ! :D

I started everything again and Now it works.

I think it was not working because the two scripts call weren't using the same coordinates.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top