Chaos Project

RPG Maker => Event Systems => Event System Troubleshooting => Topic started by: Magus on September 13, 2010, 03:18:33 pm

Title: A question that I haven't see asked.
Post by: Magus on September 13, 2010, 03:18:33 pm
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
Title: Re: A question that I haven't see asked.
Post by: The Niche on September 13, 2010, 03:43:01 pm
I don't know, but I'd say it'd be doable using event x and y coordinates.
Title: Re: A question that I haven't see asked.
Post by: Blizzard on September 13, 2010, 04:05:18 pm
"Event Touch" trigger.
Title: Re: A question that I haven't see asked.
Post by: Calintz on September 13, 2010, 04:41:00 pm
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.
Title: Re: A question that I haven't see asked.
Post by: Holyrapid on September 18, 2010, 12:20:50 pm
I didn't know that event touch activated on another event too. That's great.
Title: Re: A question that I haven't see asked.
Post by: The Niche on September 18, 2010, 12:23:26 pm
Nor did I as a matter of fact. The what's this yoke says it works when an event touches the player.
Title: Re: A question that I haven't see asked.
Post by: Karltheking4 on September 27, 2010, 04:57:18 am
Let's just assume for a moment, that there are MORE than just the rock and hole events on the one map o.O
Title: Re: A question that I haven't see asked.
Post by: The Niche on September 27, 2010, 05:48:11 am
Let's not, because that would be horribly complicated to fix.
Title: Re: A question that I haven't see asked.
Post by: Valdred on September 27, 2010, 06:09:31 am
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.
Title: Re: A question that I haven't see asked.
Post by: Zeriab on September 27, 2010, 06:54:29 am
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 ^^
Title: Re: A question that I haven't see asked.
Post by: Karltheking4 on September 27, 2010, 08:19:17 pm
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
Title: Re: A question that I haven't see asked.
Post by: Valdred on September 28, 2010, 02:20:08 am
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.
Title: Re: A question that I haven't see asked.
Post by: Karltheking4 on September 28, 2010, 11:33:46 pm
It doesn't understand the "Is_a"
And neither do I?
Title: Re: A question that I haven't see asked.
Post by: Blizzard on September 29, 2010, 02:35:40 am
It should be "is_a?".
Title: Re: A question that I haven't see asked.
Post by: Valdred on September 29, 2010, 09:08:19 am
sorry about that.

fixed
Title: Re: A question that I haven't see asked.
Post by: monzdname on December 13, 2010, 12:56:11 pm
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?
Title: Re: A question that I haven't see asked.
Post by: Valdred on December 13, 2010, 01:01:42 pm
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)
Title: Re: A question that I haven't see asked.
Post by: monzdname on December 13, 2010, 01:42:52 pm
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..
Title: Re: A question that I haven't see asked.
Post by: fjurio on December 13, 2010, 02:13:03 pm
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
Title: Re: A question that I haven't see asked.
Post by: Valdred on December 13, 2010, 02:37:14 pm
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
Title: Re: A question that I haven't see asked.
Post by: monzdname on December 13, 2010, 07:11:30 pm
 :haha: THANKS VALDRED
that code helped me a lot..
its working fine now..
i just didn't know what ID would I input.

THANKS A LOT  :)
Title: Re: A question that I haven't see asked.
Post by: YeahBrown on January 16, 2011, 09:25:39 pm
Well, that script its OK, but that can made without script, I'll explain an engine that I think you had to do from the beginning:
You have to use 4 variables, 2 for the coodinates X and Y for the rock (lets say a "Rock" and a "Button"), and the other 2 for the coordinates X and Y for the button:
The 2 variables for the rock lets call it "Rock X" and "Rock Y", and the variables for the buttom lets call it "Buttom X" and "Buttom Y"......

In the event of the rock: you do all you have to do for move the rock, and at the end, You must match the variables "Rock X" and "Rock Y" to the coodinates X and Y of the Rock....

In the event of the buttom: You must match the variables "Buttom X" and "Buttom Y" to the coodinates X and Y of the Buttom, then put a conditional branch like this:

-Conditional branch: variable [001:Buttom X]==[003:Rock X]
--Conditional branch: variable [002:Buttom Y]==[004:Rock Y]
  -
  :Exception
  -
  end
-
:Exception
-
end


Inside this conditional branch, activate a switch or do what you want to happen, and put this event in Parellel process and oviously, at the end, activate a selfswitch for desactivate the event, and its ready!!, now when you put the Rock above the buttom, something will happen....

I use this engine in game all the time, and works perfectly,
Well, the script its great, this engine is just another way to do this....

Greetings.....
Title: Re: A question that I haven't see asked.
Post by: Valdred on January 17, 2011, 08:03:00 am
A script takes less effort, less lag and less time
Title: Re: A question that I haven't see asked.
Post by: YeahBrown on January 17, 2011, 10:50:21 am
I agree, excuse me if you think I mean to offend, I just wanted to show you one way to do it with an engine because I saw that many people didn't know......
Title: Re: A question that I haven't see asked.
Post by: Valdred on January 17, 2011, 10:58:45 am
No problem at all dude  :)