Spawnable event that follows player for XX amount of steps. Ideas?

SoCalAshez

Villager
Member
Joined
Sep 9, 2020
Messages
20
Reaction score
9
First Language
English
Primarily Uses
RMMZ
Good Day all!

I'm creating a DnD style game and one of my heroes has the "light" Spell. I would like to know if there is a way make it when players go into the menu and cast the spell, it creates an event with the light that follows around the player and despawns after XX steps. I already have the coding to make spells like that work for stealth for my rogue and a speed boost akin to "Force Speed" from Star Wars Knights of the Old Republic. So I'm primarily looking for the event spawning that can be done on any and every map and follows around until the player hits the step limit and then despawns. I would love it to be purposeful, but I just want the base of it down and I can go from there.

Thank You!
-SoCalAshez
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,563
Reaction score
1,153
First Language
English
Primarily Uses
RMMV
Create a custom route for the event and type in this as a script for the custom route:
$gameMap.event(this._eventId).setPosition($gamePlayer._followers._data[0]._x, $gamePlayer._followers._data[0]._y); <- this is all 1 line btw

That will get the event to follow your Hero. I also added a 3 frame wait before it. Also, make sure "Repeat Movements" & "Skip if Cannot Move" is checked.

As for the despawning, that will have to be done on the main event page (exit out of the custom route menu/page). Sry but I'm gonna hit the hay rn, but hopefully someone here can help you w/ the spawn timer function. GL!

Edit: Oops! My bad, I just realized this is for MZ, not MV. Though the differences are probably minimal so it may still work for you. ^.^
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,300
Reaction score
525
First Language
indonesian
for spawning you can use galv's
make sure to choose to spawn the event temporary instead of permanent...

then for following you can use custom route -> script posted above
or another version of it:
Code:
this.moveStraight(this.findDirectionTo($gamePlayer.x, $gamePlayer.y));
this one will have 'walking' animation.

for despawning maybe you need variable in custom move route that store the player steps at the start of event spawn and erase the event when the counter reached. maybe this:
Code:
this._myLightCounter = this._myLightCounter || $gameParty.steps();
this will store $gameParty.steps() to a variable. but only once. if already stored it will use it instead. thus we can do check how many steps since the event spawned.

then below it another custom route -> script
Code:
if ($gameParty.steps() - this._myLightCounter > 10) $gameMap.eraseEvent(this.eventId);
when the step increase more than 10 steps... erase the event.

i did not test above though since i'm outside... hope this help.
 

prototyper

Warper
Member
Joined
Oct 27, 2020
Messages
3
Reaction score
2
First Language
English
Primarily Uses
RMMZ
I think you may be able to do this without any coding or plugins.

Have the skill trigger a common event.

The common event does what you're looking for. Maybe swap out the sprite of your actor for the sprite affected by the effect, or add the party member that you want to follow your character around, etc.

Then save your current steps to a variable + the number of steps you want the effect to last.

Then loop, and on each loop, check your step count against that number. Once you've reached that step number, remove the effect/party member/swap the sprite/etc, and break the loop.

You may have to add a self-switch in there to ensure that the player can't cast this multiple times and have lots of loops eating your bandwidth at the same time.

None of this is tested, but just trying to think of a way to do this without having to maintain custom code.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I am trying to get my game published with Aldorlea Games so that I make sales from their website and the game being on Steam. They have said that their published games rarely make less than a few hundred dollars.
DoubleXP wrote on Tonbi's profile.
Hello Wondering if you take commissions?
I should make an itch.io page one of these days...Maybe for my next large update.
whoops, forgot to get started with Advent posts! coming shortly!

Forum statistics

Threads
105,779
Messages
1,016,403
Members
137,472
Latest member
TatlTaelGamer
Top