MZ Draw line from event to event?

Hello, I'm very not into programming, so maybe someone could help me...
can we draw a straight white line from one event to another, to connect them? It should work real-time, like when the events are moving, so we can make something like fishing line or a leash for animal? Thank you.
Hello, I'm very not into programming, so maybe someone could help me...
can we draw a straight white line from one event to another, to connect them? It should work real-time, like when the events are moving, so we can make something like fishing line or a leash for animal? Thank you.
Something like this?

1677295611652.png
@ct_bolt Omg, yes! Exactly like this! I just wander is the line can be draw like diagonally when this event goes left or right? Or only straight line vertically or horizontally. sorry, didn't write this earlier.
@ct_bolt Omg, yes! Exactly like this!
:LZSproud:

line can be draw like diagonally when this event goes left or right?
☺️ 😉👍

Spoiler: Demo Events\Script Call Examples
Add lines:
1677552835657.png


You can also remove lines either by ID or with source & target like this:
1677552710253.png


..or also to completely clear all lines is like this:
1677553644626.png

Spoiler: Demo Video


Still in the early stages, but it's very much functional so you can check it out if ya like 😉

CTB_LineBetweenCharacters Plugin: Click Here to Download
@ct_bolt wow, this is absolutely what I wanted, thank you sooooo much for this!
that looks crazy, I'm going to test it in MV to see if it works in 1.6.1
as it might not work in 1.5.x because of ES6 structure.

while I dont have use for it, I can say, this looks really sick.

nice job though =)
that looks crazy, I'm going to test it in MV to see if it works in 1.6.1
as it might not work in 1.5.x because of ES6 structure.

while I dont have use for it, I can say, this looks really sick.

nice job though =)
Can be used as a leash, as a fishing hook, dot-to-dot minigame, or showing the player path to follow 🙂

Edit: or you can event something like skill tree system on a map, so the skills can be connected with the lines! 🙂
This is amazing! Can you also draw a fixed line, not between 2 events, but between two screen x,y points on the map?
This is amazing! Can you also draw a fixed line, not between 2 events, but between two screen x,y points on the map?
You'd have to edit the plugin to allow for that, but you could accomplish this by providing specific coordinates to the line functions rather than going through a source/target.
or you can event something like skill tree system on a map, so the skills can be connected with the lines
I have a way for that, but if you want it more dymamic for a skill tree system, it
needs more like color start, filling to end point and adjustment for thickness.

I do have a fishing system by a plugin already, so I cannot use it for it.
if you event it, it can have it uses though.

it depends how you use it and how effectively for a nice effect.

even though, if ct_bolt adjust it more with a new command.

like now its connect A to B, if you add a 3rd args (optional) it can have an
color to it.

like Connect A with B (default white color).
Connect C with D, green, now C and D are connected with green line.

if you can adjust that with more like a puzzle mechanic, than you need a
4th args to check if its a crossline or not, if it is, event cannot be activated,
if its not crossed, and all dots connected or events, it can be activated.

I might think of a puzzle mechanic around it in my game, as I dont have
all puzzles designed, but there are possibilities what can be done and what
need to be extended in the plugin, but if it doesn't work in MV, than its
useless as its made for MZ 🙂

so it looks sick, but there are possibilities that can be achieved and some
cannot be achieved in the currect state ^^

but I keep an eye on it and test when I'm able to do so.
This is amazing!
Thank you 🙂
Can you also draw a fixed line, not between 2 events, but between two screen x,y points on the map?
Sure I've added that now too 😉
CTB_LineBetweenCharacters Plugin: Click Here to Download

Example:
1677625785132.png

JavaScript:
$gameScreen.createLineBetween({x:24,y:24}, {x:600,y:300}, 5)
That is in pixels though so to have it grid based would have to multiply by $gameMap.tileWidth() & $gameMap.tileHeight.
& coordinates can be javascript (use quotes around it) and will update accordingly 😉

Lot's more still to do on this though, but I have a list of features I'm planning on adding 😉

Edit:
(...also fixing map scrolling issue at them moment for those who were wondering about that)
Fixed 🙂
Thank you SO much! I've been drawing triangles using a combination of show picture events (a straight line, rotated at the correct angle for the 3 bases) that results in 'close-enough' triangles but not perfect. This is going to make such a difference in my math educational games.
Thank you SO much! I've been drawing triangles using a combination of show picture events (a straight line, rotated at the correct angle for the 3 bases) that results in 'close-enough' triangles but not perfect. This is going to make such a difference in my math educational games.
No prob. 😀
Yay! That's great to hear!

Edit:
(...also fixing map scrolling issue at them moment for those who were wondering about that)
Fixed the scrolling issue 🙂

Edit:
@fizzly & anyone else who is following this...
Pretty big update... Added alot (maybe too much lol)

CTB_LineBetweenCharacters Plugin: Click Here to Download

Such as..
Can now set color, width, alpha & add a texture image, and have either source &/or target be non character values like $gameScreen.createLineBetween({x: $gameVariables.value(5), y: 200}, $gameMap.event(7)) or anything like that.


Spoiler: Help Snippet
JavaScript:
 * Add lines:
 *  $gameScreen.createLineBetween(source, target, data) // data is optional
 *  source and target can be game characters or {x: value, y: value}
 *  data can have any of the following, any/all are optional
 *  id: value
 *  color: string (ex. '0xf71302')
 *  width: value
 *  alpha: value (ex. 0.5)
 *  texture: object
 *    ex. {file:'img/parallaxes/Clouds'}
 *
 *
 * Examples:
 *   $gameScreen.createLineBetween($gameMap.event(1), $gameMap.event(2))
 *   $gameScreen.createLineBetween($gameMap.event(4), $gameMap.event(5))
 *   $gameScreen.createLineBetween($gameMap.event(6), $gameMap.event(7))
 *   $gameScreen.createLineBetween($gameMap.event(8), $gameMap.event(9), 4)
 *   $gameScreen.createLineBetween($gameMap.event(1), $gameMap.event(9))
 *   $gameScreen.createLineBetween($gamePlayer, $gameMap.event(3))
 *   $gameScreen.createLineBetween({x:24,y:24}, {x:600,y:300}, 5)
 *   $gameScreen.createLineBetween($gamePlayer, $gameMap.event(8), {id:2, color:'0xf71302', width:4, alpha: .5, texture:{file:'img/parallaxes/Clouds'}})
Spoiler: Demo Event
1677647563901.png
I'm so happy that you've made those updates! I now have and idea to use it as a grappling hook! This would be so awesome! Thank you for you work @ct_bolt, you're the best.
ct_bolt = sick to pull this off, and color line.

@fizzly now you can make color fish string that has different strenght 😛

white, breaks fast
green, stronger, for bigger fish
blue, stronger than green for much bigger fish
pink, cannot break 😛
Wow! This is an amazing plugin! Thank you so much @ct_bolt!

I have an additional question if it's not too late for this thread:
Is there a way, through script perhaps, to check if the line between 2 events is passing through a specific region?
I am making a navigation puzzle where the player plots a course on a map by placing Xs on the gridded map. These Xs are then connected by the by lines using this plugin. If any of the lines goes over land at any point, for example, i want to give a the player a message that says something like,"You can't plot a course over land!".
There are a number of different conditions that trigger a failure for the player. In the example screen shots:
Region 2 = land
Region 3 = shipping lane
Region 4 = storm
Region 5 = coast guard
Spoiler: screen capture
Screenshot 2025-02-15 at 15.46.49.png
Screenshot 2025-02-15 at 15.54.59.png
Screenshot 2025-02-15 at 15.54.59B.png
(the player has to gather the information about these locations through investigation around the ship)

I'm using VisuStella Events and Move Core plugin, and making the invisible player walk the line from Event 1 to Event 2, and in that plugin there is a parameter called "Common Event on Touch", which runs a common event if the player passes over it, but it seems it only works if the Player is controlling the character at the time, and NOT moving the character with movement routes as I am doing.

SOoo, for all those reasons, I want to check instead if the line between Event 1 and Event 2, or line id: 1, is passing through Region 2 (see 3rd image above in spoiler). Is it possible?

Thanks in advance for any help that anyone can provide <3
Thank you so much @ct_bolt!
Well...he's dead. Literally. RIP.
So he isn't going to be answering your questions unless you happen to have a direct line to heaven.
But he appreciates your thanks, I'm sure.

Second, it would be better if you start a new thread. This one has been dead for nearly 2 years.
You can just link back to this thread in your new topic instead.
Necro-post notice: @Kyuubits

Original thread: https://forums.rpgmakerweb.com/threads/draw-line-from-event-to-event.155192/