Repeating Boulder Spawn + Collision on Player

rechronicle

Mystvaldia
Veteran
Joined
Oct 30, 2013
Messages
137
Reaction score
109
First Language
Bahasa
Primarily Uses
RMMV
Hello, 


I am completely stuck here... need some help.. 2 days tweaking it with no answer..


So I want to make an boulder spawn on certain point and at the end of the road it will teleport back just like a continuous rolling boulder on the cliff.


At the other hand, if the event(boulder) hit the player, the player will blinking and lose some HP.


This is my attempt:

1485283156296.jpg


1485283059292.jpg

As the result, the boulder is not teleported back to the top, even if I have set conditional variable X and Y. And also the damage collision not working correctly. (I am using Galv Event Start Types). If anyone know how to make this work, please help.


Thank you
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
Use autonomous movement for the boulder movement and keep the content on event touch - that way when the boulder moves on the player, you can have it trigger the HP and a change back to start position with two or three simple commands in the content.


Then have an independent event on parallel process only checking if the boulder is at the end of the line (by checking and comparing coordinates) and transfer it to the start when it is. That checking parallel can do that for every boulder on the map if you have more than one.


But do not use the set move route command inside a parallel event that way - that always creates lag and timing problems, because it was never intended to be used that way.


Just use autonomous movement (the option you still have on fixed position), that is what it is intended to be used for.
 

DuncanS

Veteran
Veteran
Joined
Sep 18, 2013
Messages
160
Reaction score
96
First Language
English
Primarily Uses
To illustrate Andar's example:

Boulder, with collision detection:


EDIT: Better yet, use the following scriptlet in the conditional: 



event = $gameMap.event(this._eventId); event.isCollidedWithPlayerCharacters(event.x, event.y)


event_01.png


Parallel event to reset boulder (note that the .event(2) here will need to be changed to the event ID of your boulder):


event_02.png
 
Last edited by a moderator:

rechronicle

Mystvaldia
Veteran
Joined
Oct 30, 2013
Messages
137
Reaction score
109
First Language
Bahasa
Primarily Uses
RMMV
@Andar @DuncanS Hello there, thank you for the replies, really help me a lot. Now I managed to make the boulder rolling and collide trigger when touching the player.


The only thing that bugged me now is that the autonomous movement of the boulder will not continuously moving over and over again


when the player is not at the screen.


Let's say that I got a 40y map size, if I stand and wait on coordinate 38y, the boulder will not coming down again.


I need to move to coordinate 14y to make the boulder roll again(boulder moving only IF the character is on the same screen as the event)


Is this normal? Any ways to trick around it?


Thank you
 

DuncanS

Veteran
Veteran
Joined
Sep 18, 2013
Messages
160
Reaction score
96
First Language
English
Primarily Uses
It's an optimization so Game_Character instances don't move around offscreen on large maps, which could cause lag.


Since it's based on a check for how near the object is to the screen, it can be disabled on a per-event basis. Put this script at the top of the events you want to continue moving offscreen:


event = $gameMap.event(this._eventId);
/*
* Hacky - make sure this event is always
* considered 'near the screen'
*/
event.isNearTheScreen = function() {
return true;
}


Like it says though, this is a bit of a hacky solution.
 
Last edited by a moderator:

rechronicle

Mystvaldia
Veteran
Joined
Oct 30, 2013
Messages
137
Reaction score
109
First Language
Bahasa
Primarily Uses
RMMV
@DuncanS Sweet! Now it is perfect just like what I intended to do. Still curious if there is other solution without touching the script.


You know, exploring many ways. xD


Thank you again!

1485325589750.gif
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
@DuncanS @gundriveth


The first screenshot of DuncanS example is wrong and not an illustration of what I meant.


Change the trigger to event touch and remove the conditional branch with the script line completely - the event content should only be the three commands change HP, flash screen and transfer player.


Let the engine handle the collission by event touch, there is absolutely no need for a parallel on the boulder - that only creates lag.


And there is also a better solution to the problem of off-screen movement, one that was given several times in the last few weeks but I don't have the link, you'll have to search for it.


Done the way above, all events will always move - that will create a lot of lag.


The better way is to include a check for a notetag and return true only if the event checked does have the notetag for always move. Then you include that notetag on the boulder event, but not on the other events that don't have to move - a lot less lag.
 

DuncanS

Veteran
Veteran
Joined
Sep 18, 2013
Messages
160
Reaction score
96
First Language
English
Primarily Uses
Let the engine handle the collission by event touch


Ah, that makes more sense. Still a bit rusty on eventing, thanks:

event_03.png



Note that this way, you'll need to move the snippet for off-screen movement to the parallel event:

event_04.png



As this could get bulky with multiple events that need to move off-screen, you could throw the snippets into a one-off event that erases itself.

Done the way above, all events will always move - that will create a lot of lag.


The better way is to include a check for a notetag and return true only if the event checked does have the notetag for always move. Then you include that notetag on the boulder event, but not on the other events that don't have to move - a lot less lag.


There's maybe a cleaner way to do this repeatably with a plugin, but the snippet I gave will only change the function on the specified event object, not all events.
 
Last edited by a moderator:

rechronicle

Mystvaldia
Veteran
Joined
Oct 30, 2013
Messages
137
Reaction score
109
First Language
Bahasa
Primarily Uses
RMMV
Right on, I am using the one with Event Touch on the boulder and another event Parallel to check.


After searching with keywords "off-screen movement", there were so many answers, not sure if that is what you mention on the solution.


For now, I will stick to the solution we got here.


Thank you!
 

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,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top