I have a fairly simple (I think) requirement. I wish to be able to move an item onto another item and have it trigger.
First I have the boulder which is set as the same height as the player and executes the following when the action button is pressed
Set Move Route: This event(Wait)
: $>Through ON
: $>Move away from Player
: $>Through OFF
The through had to be turned on so it would pass "onto" the switch.
Next I set up a button. I used one of the floor button icons from Graphics > Switch1, set it to below characters and marked the trigger as "event touch". On event touch I got it to set it's self switch A on then just created a blank page (so I could see it disappear under the boulder)
I wasn't sure if the event trigger would work like that as I'm not 100% sure how it works. Anyway, using this method all I get is this
http://www.youtube.com/watch?v=0hOmOvnZbF0&feature=youtube_gdata
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FEoB28dn.png&hash=1aacf91a3cbbe85ced39da9cb952bcd0f4dc7d2b) (http://www.youtube.com/watch?v=0hOmOvnZbF0&feature=youtube_gdata)
Can anyone help me out with what I'm doing wrong or a better way to achieve my goal?
Well, event touch events only activate when the event touches the player, not when it touches another event (the difference between it and player touch is that player touch events don't activate when the event moves into the player, only when the player moves into the event).
One way you could achieve the desired effect is put a conditional branch after the move event and check whether the boulder is on the switch square.
Ie, assuming the switch is at 12, 8, then like this:
@>Control Variables[0000: Boulder X] = This event's Map X
@>Control Variables[0000: Boulder Y] = This event's Map Y
@>Conditional Branch: Variable [0000: Boulder X] == 12
@>Conditional Branch: Variable [0000: Boulder Y] == 8
# Activate the switch
: Branch End
: Branch End
Naturally, replace the 12 and 8 with the actual x and y coordinates of the switch event.
Thanks so much for the help. I hadn't realised the difference between event touch and player touch so that's great to know.
Also thanks for the logic with the other too. I setup my boulder with the following new lines:
Control Variables: [0023:BoulderX] = This event's Map X
Control Variables: [0024:BoulderY] = This event's Map Y
Conditional Branch: Variable [0023:BoulderX] == 6
Conditional Branch : Variable [0023:BoulderY] == 5
Script: $game_self_switches[[19, 2, 'A']] = true
Branch End
Branch End[/code]
Then set the switch up as ....
ahh I'm an idiot. I used the Variable 23 twice in the branch instead of individual for X and Y.
Pity you have to assign a variable for it although I guess I could initialise it on entrance to the map and then reuse it later.
In any case that works perfectly. Thank you very much :D
Got it working even better courtesy of some advice from crossroads at the RPGMVXA Community site.
http://www.youtube.com/watch?v=GafgyGr671U&feature=youtube_gdata
If anyone else is interested this is how I did it.
Create the switch event with the trigger set to parallel
Create a conditional branch with the following script condition
$game_map.events[@event_id].x == $game_map.events[6].x and $game_map.events[@event_id].y == $game_map.events[6].y
Where 6 is the event number of the first boulder
Under Else create another conditional branch with the following script condition
$game_map.events[@event_id].x == $game_map.events[1].x and $game_map.events[@event_id].y == $game_map.events[1].y
Where 1 is the event number of the second boulder
Then, I called the following script for the true condition
$game_self_switches[[19, 2, 'A']] = true
and this for the "Else" in the second conditional branch
$game_self_switches[[19, 2, 'A']] = false
Then I just duplicated this switch and changed the event number in the game_self_switches calls (so each switch activates something different). You could also set a variable I guess and have an activated switch increment a counter by 1 whilst a deactivated decreases it. That way you could have another event, like a door, open when the cvariable reaches a certain value (i.e.e the number of switches)