Execute plugin on event run.

coolperez8

Veteran
Veteran
Joined
Mar 23, 2016
Messages
159
Reaction score
12
First Language
English
Primarily Uses
So, I have this plugin I'm working on.


The problem is that it constantly executes it's code. What I want it to do is execute the code any time the player interacts with an event.


while(true) {
$gameVariables.setValue(Skurry.Param.LVID, $gameParty.leader().actorId())
}


How can I change this so that it will only run when an event is called?
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
There's a few ways to do that. Either define a new function in the Game_Interpreter, which will allow you to call it using the "script" command in an event, or alias the pluginCommand function in the Game_Interpreter, and then you can call it using the Plugin Command event command. Creating a new function is probably going to be easier, but a Plugin Command might be better for a future maker, we can't really say for sure.


However I'm also concerned about your code snippet itself.... why are you using an infinite loop, which you never even explicitly break out of, to set a variable value...? You could just have it set the value once and avoid looping at all...
 

coolperez8

Veteran
Veteran
Joined
Mar 23, 2016
Messages
159
Reaction score
12
First Language
English
Primarily Uses
There's a few ways to do that. Either define a new function in the Game_Interpreter, which will allow you to call it using the "script" command in an event, or alias the pluginCommand function in the Game_Interpreter, and then you can call it using the Plugin Command event command. Creating a new function is probably going to be easier, but a Plugin Command might be better for a future maker, we can't really say for sure.


However I'm also concerned about your code snippet itself.... why are you using an infinite loop, which you never even explicitly break out of, to set a variable value...? You could just have it set the value once and avoid looping at all...
So it would constantly set the variable to the leader of the party. That way I don't have to do it through events.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Ok, yes, it'll constantly set the value. And nothing else will run. That loop will halt the game until it's done running, which happens to be never.


But now I'm confused. You want the variable to always be set to the party leader's ID, but you want it to only get set when you call the function in an event? That's a contradiction, they're opposites.
 

coolperez8

Veteran
Veteran
Joined
Mar 23, 2016
Messages
159
Reaction score
12
First Language
English
Primarily Uses
Ok, yes, it'll constantly set the value. And nothing else will run. That loop will halt the game until it's done running, which happens to be never.


But now I'm confused. You want the variable to always be set to the party leader's ID, but you want it to only get set when you call the function in an event? That's a contradiction, they're opposites.
Actually, I'd prefer the latter.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Well, I'd recommend making a function in the Game_Interpreter and calling it from a "Script..." command in the events you want it to work with. A plugin command is a little more annoying to implement, but if you're up for the challenge, go for it. It's probably debatable whether or not one method is better than the other, but it'll be quicker and easier to just add and call a function.
 

coolperez8

Veteran
Veteran
Joined
Mar 23, 2016
Messages
159
Reaction score
12
First Language
English
Primarily Uses
Well, I'd recommend making a function in the Game_Interpreter and calling it from a "Script..." command in the events you want it to work with. A plugin command is a little more annoying to implement, but if you're up for the challenge, go for it. It's probably debatable whether or not one method is better than the other, but it'll be quicker and easier to just add and call a function.
ok
 

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top