A question that I haven't see asked.

Started by Magus, September 13, 2010, 03:18:33 pm

Previous topic - Next topic

Magus

Have this been made:

Something happens  when an event touches another event.

Like for example:  Link pushes the rock in the hole. *event happens.*

Event on event collision, I guess.

This would help out so much
LEVEL ME DOWN. THE ANTI-BLIZZ GROUP IS AMONG YOU... Do it for the chick below...She watches..<br />

The Niche

I don't know, but I'd say it'd be doable using event x and y coordinates.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Calintz

Blizzard is right, again!
The 'Event Touch' trigger runs an event when two events touch one another and one of them has that trigger set. In this case, it doesn't matter where the player is on the map. If an event is triggered by "Event Touch," then the moment it touches another event on the map ... its code will start processing.

So in your scenario, you would want to make an event and give it a hole's graphics and give it the 'Event Touch' trigger. Make another event somewhere on the map and give it a rock's graphics. Give it a 'Parallel Process' or 'Button' trigger respectively, and the proper code for making it move. When link pushes that rock to the hole, the hole's event code will begin to process.

Holyrapid

I didn't know that event touch activated on another event too. That's great.

The Niche

Nor did I as a matter of fact. The what's this yoke says it works when an event touches the player.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Karltheking4

Let's just assume for a moment, that there are MORE than just the rock and hole events on the one map o.O

The Niche

Let's not, because that would be horribly complicated to fix.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Valdred

The event touch trigger do not do that at all. It works exactly like player touch but from the event's perspective which means when the event touches the player.

You'll have to write a method or use variables.

Zeriab

For the example you mention I not make hole events, but rather put it in the tileset and give it a specific terrain tag.
Then you can just check the terrain tag of the rock event ^^

Karltheking4

September 27, 2010, 08:19:17 pm #10 Last Edit: September 27, 2010, 08:28:11 pm by Karltheking4
Ahh, now your thinking with portals!
You could also make an invsible tile in the tileset with said terrain tag, and place it above non-moving events, that way you could also animate the hole! :haha:
Which is kind of pointless I agree, but meh, someone will find a use some day.

Also, you could use this in a script conditional branch
$game_player.x == $game_map.events[#].x

Valdred

September 28, 2010, 02:20:08 am #11 Last Edit: September 29, 2010, 09:08:06 am by Valdred
you would need to put this code above main:


class Game_Event < Game_Character
#--------------------------------------------------------------------------
  # * Contact
  #--------------------------------------------------------------------------
  def contact?(event)
    event = $game_map.events[event] if event.is_a?(Integer)
    x_match = (@x < (event.x + 2) and @x > (event.x - 2))
    y_match = (@y < (event.y + 2) and @y > (event.y - 2))
    return ((x_match and @y == event.y) or (y_match and @x == event.x))
  end
end


And in order to use it, Conditional branch > script:
$game_map.events[id1].contact?(id2)

Exchange id1 with the ID of the first event (doesn't need to be the event in which the command is called) and id2 with the ID of the second event.

Also remember, this is non-tested code, if it's not working, tell us.

Karltheking4

It doesn't understand the "Is_a"
And neither do I?

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Valdred


monzdname

hello.

I think I'm in the same situation with thread starter of this topic, (i guess his problem is solved) so i thought i would not start a topic and reply here instead.

I'm having trouble with this event touch. Just like the starter of this thread, i wanted to hit a switch with another event (rock, block, etc..)
But instead of pushing a boulder or box. I made a parallel event in which my character can shoot arrows when a keyboard button is pressed.
Now, i wanted a switch to be turned on when those arrows hit the switch, coz i plan to place those switches in an area where it can't be reach. I did a couple of touch trigger and x,y coordinatites, still it didn't worked out. I even tried the script posted above, but I always get a syntax error.

Can somebody pls help me out with this?

Valdred

Well, first of all, the event touch trigger isn't working for this as I stated above. What line do you get error on? (if it only says "Syntax error when running script" put the script into a blank slot in the script editor and run)

monzdname

December 13, 2010, 01:42:52 pm #17 Last Edit: December 13, 2010, 02:01:45 pm by monzdname
the syntax error's gone now, but when i tried to use it ( shooting an arrow to the switch )
this occured..

NameError occured while running script
undefined local variable or method "skills" for interpreter:0x41e5990and

I suppose, i made an error when renaming the IDs, what should i write instead? coz i renamed my events and thats what i used in the script command..
i called  the script using this :    $game_map.events[arrow].contact?(switch)
with arrow= the shooting arrow and switch= the switch to be hit
should i use the default ID inststead?


edit:
I tried using the default names of the event, and now every time i shoot an arrow
this error occur:

NameError occured while running script
uninitialized constant interpreter:: EV003

as you can, see EV003 is the event..

fjurio

Quote from: monzdname on December 13, 2010, 01:42:52 pm

i called  the script using this :    $game_map.events[arrow].contact?(switch)
with arrow= the shooting arrow and switch= the switch to be hit
should i use the default ID inststead?


yes

Valdred

The id is a number, not a name. You can name it whatever you want. See bottom right when you have selected the event of choice. You will see 001: nameofevent. Then 1 is the id