Script call to USE a specific item on any actor/call item-use select screen?

Solr

Living Weapon
Veteran
Joined
Apr 20, 2019
Messages
75
Reaction score
55
First Language
English
Primarily Uses
RMVXA
(Skip to the last paragraph if you want to understand what the problem specifically is). Basically in my project, there are large of amount event interactions that rely upon the player "selecting" an actor of their choice out of the available party and that selected actor's stats being used to determine the outcome of an event. Like a wooden door that requires someone with 10+ Strength (ATK) to knock down so you can gain access to the room, a steel door that requires 40+ Strength, books that require 25+ Intelligence to read, an NPC you can convince to steal from a store if you have 20+ Charisma, ect. The common event for this system is already finished; It assigns any chosen actor's 6 (10 if you include Max/Current HP/MP) stats to neat variables ready to be passed on to unique events for processing. The problem is actually CHOOSING the actor from the player's perspective. Originally, I just gave everyone a skill called "Interact" that would just give the user a state called "Interact_Flag" and would then call a common event to pass the stats of whoever has the state into variables, before resetting the state (removing the state from everyone/anyone in the party). It worked fine, but I don't want the player to have to go into the menu, select an actor's skills, and select "Interact" everytime they want to do something (because they are a lot of the aforementioned selection events in game).

I discovered @NinjaChicle Party Member select script, which allows you to create events in which you visually select an actor, and then bind that actor's ID to a variable. It seemed perfect for what I was trying to accomplish, but I quickly ran across some issues.
Like in a common event, if I call the party member select script first, and then make a conditional branch to check if the selected actor's ID is 1, it doesn't seem to actually assign the selected actor's ID to the variable until AFTER the conditional branch check was made, so to get results I have to run the common event twice (this happens even when I use wait commands as per NinjaChicle's instructions.

Galv also has a script that does this but it's incompatible with several mission-critical scripts I have, and will cause an error message before the game even reaches the title screen.

So basically, I've thought of an alternate way to "select" an actor. I have a common event which can be called from the menu. When the common event is triggered, it will add one instance of an item that places the Interact_Flag state on it's user, and it will take the player directly to the screen where the item is already selected and is ready to be used:Example.JPG
But I don't know how to call a specific item use scene directly. There must be a script call like "use_item_ID[X]_actor_select" or something. Does anyone know how do this or if this script call exists?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,990
Reaction score
10,007
First Language
German
Primarily Uses
RMMV
your description is rather convoluted, and I believe a lot of that comes from you not knowing how the engine itself works. So instead of answering your questions directly, I will describe how I would start to handle things by coming from a completely different direction.


First, make an invisible target identification state. With "invisible" I mean no messages, no icon, low priority - something the player can never detect as a result, but the engine still knows it is there.

Second, make a skill for something you want to do and name it appropiately as well as setting it to one ally target. Give that skill two effects, and those effects only: applying the target state and calling a common event.

in the common event, check every actor to see if it has the target state. If yes, you'll know this is the actor that had been selected on the skill.

you are now inside a common event where you can continue to do whatever, and know which actor you are supposed to use for whatever you want - no plugin needed at all.

doing this with only event commands can be tedious (for example having one conditional branch for every actor), but you can easily use some script code like a loop through the party to check which actor has the state, and use that to simplyfy all things.

Also please not that the engine makes no difference between item and skill internally (in fact all skills are processed as items), so you can do the same with an item instead of a skill.



additionally, only from the comments you gave I strongly suspect that you common event system is needlessly complex as well. For example I see no need to assign variables and pass them to events - the events themselves should be able to check everything directly through control variable game data, without having to go through specific variables. One or two temporary variables should be enough to handle all parameters from all actors.

But I can't give suggestions as to how to simplyfy your events without seeing them and learning what they do.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,365
Reaction score
1,202
First Language
English
Primarily Uses
RMVXA
so to get results I have to run the common event twice
I would play around with that. for example, in your common event to check the actor id, first do a call common event command at the top. Maybe that will invoke your run CE twice problem you are having.
Ok tested it, works if you call the common event to select the actor from the common event that does the check for the actor id
 
Last edited:

Solr

Living Weapon
Veteran
Joined
Apr 20, 2019
Messages
75
Reaction score
55
First Language
English
Primarily Uses
RMVXA
your description is rather convoluted, and I believe a lot of that comes from you not knowing how the engine itself works. So instead of answering your questions directly, I will describe how I would start to handle things by coming from a completely different direction.


First, make an invisible target identification state. With "invisible" I mean no messages, no icon, low priority - something the player can never detect as a result, but the engine still knows it is there.

Second, make a skill for something you want to do and name it appropiately as well as setting it to one ally target. Give that skill two effects, and those effects only: applying the target state and calling a common event.

in the common event, check every actor to see if it has the target state. If yes, you'll know this is the actor that had been selected on the skill.

you are now inside a common event where you can continue to do whatever, and know which actor you are supposed to use for whatever you want - no plugin needed at all.

doing this with only event commands can be tedious (for example having one conditional branch for every actor), but you can easily use some script code like a loop through the party to check which actor has the state, and use that to simplyfy all things.

Also please not that the engine makes no difference between item and skill internally (in fact all skills are processed as items), so you can do the same with an item instead of a skill.



additionally, only from the comments you gave I strongly suspect that you common event system is needlessly complex as well. For example I see no need to assign variables and pass them to events - the events themselves should be able to check everything directly through control variable game data, without having to go through specific variables. One or two temporary variables should be enough to handle all parameters from all actors.

But I can't give suggestions as to how to simplyfy your events without seeing them and learning what they do.
My common event functions loosely the same as you described. Every actor has the same skill and all it does is apply an invisible state to the user (and also call a common event). The common event is basically just a long chain of open-ended conditional branches (conditional branches that have no else clause); they basically look like: "If actor [Eric] has state [27] then set variable "Who_Strength?" to [Eric]'s ATK, set variable "Who_Resilence?" to [Eric]'s DEF...ect" Then another conditional branch: "If actor [Natalie] has state [27] then set variable "Who_Strength?" to [Natalie]'s ATK..." you get the idea. A different event (whatever door or book the player is interacting with) then takes the variables "Who_Strength" or "Who_Intelligence" and it runs it's own processes to determine if the player is able to open/read it. It's tedious and inefficient, but it's easy (enough) to manage and add new actors onto this chain and the system itself works fine. I appreciate your input, but it's not the system I'm worried about, it's the best way to SELECT AN ACTOR from the menu that I'm having trouble with. You mentioned you can do this through a skill that can target anyone in the party? You're saying that instead of a script call that calls an item, I should be using a script call that calls a skill because the game doesn't make any difference between skills and items internally?
I would play around with that. for example, in your common event to check the actor id, first do a call common event command at the top. Maybe that will invoke your run CE twice problem you are having.
Ok tested it, works if you call the common event to select the actor from the common event that does the check for the actor id
I see. I'm trying to recreate what you are doing but it's not going very well for me. You're saying to call the conditional branch for the check first and then call a separate common event that contains the script call for the actor select script? Could you post a screenshot please?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,990
Reaction score
10,007
First Language
German
Primarily Uses
RMMV
I'm still not sure we are talking about the same thing, because why would you need to select a second actor when you already have the one that used the skill to trigger the common event?

that said, unless you are already using the hidden items for something else, you can simply use that option for any one type of selection.
just make a token/hidden item for each actor, make sure that the inventory has only the hidden items for the available actors and then use select item.
if you are using icons based on actor faces the player will never realise that he ise selecting items instead of actors, and you can then use the result of select item in any form you want.
 

Solr

Living Weapon
Veteran
Joined
Apr 20, 2019
Messages
75
Reaction score
55
First Language
English
Primarily Uses
RMVXA
I'm still not sure we are talking about the same thing, because why would you need to select a second actor when you already have the one that used the skill to trigger the common event?

that said, unless you are already using the hidden items for something else, you can simply use that option for any one type of selection.
just make a token/hidden item for each actor, make sure that the inventory has only the hidden items for the available actors and then use select item.
if you are using icons based on actor faces the player will never realise that he ise selecting items instead of actors, and you can then use the result of select item in any form you want.
I need to list out every actor because in vxa, when you designate game variables using an event, you have to set variables to actor's stats directly:
capture4.JPG
I'm aware that there is definitely a way to do something like:
"variable:Who_Strength = ATK of Actor_state[21]_inflicted"
but I'm unskilled at scripting in general, so I have to find creative (and inefficient) ways to defy the limitations of eventing.

Thanks for the suggestion about using key item select and hidden key items to represent actors! I'm going to give it a shot. Ideally, I'd like to key items when they are displayed to be organized in the same way of the actor's positions in the party, but I'm sure I'll find some convoluted method to accomplish this.
 

Attachments

  • capture3.JPG
    capture3.JPG
    27.4 KB · Views: 0

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
658
Reaction score
368
First Language
German
Primarily Uses
I discovered @NinjaChicle Party Member select script, which allows you to create events in which you visually select an actor, and then bind that actor's ID to a variable.
[...] if I call the party member select script first, and then make a conditional branch to check if the selected actor's ID is 1, it doesn't seem to actually assign the selected actor's ID to the variable until AFTER the conditional branch check was made, so to get results I have to run the common event twice (this happens even when I use wait commands as per NinjaChicle's instructions.
Switching scenes usually happens within one frame, but if this does not work you could maybe try to set the actor variable to 0 first and wait in a loop until it has a valid value.

(I wrote other stuff here that turned out I had misremembered, the above might not be the best advice)
 
Last edited:

Solr

Living Weapon
Veteran
Joined
Apr 20, 2019
Messages
75
Reaction score
55
First Language
English
Primarily Uses
RMVXA
Switching scenes usually happens within one frame, but if this does not work you could maybe try to set the actor variable to 0 first and wait in a loop until it has a valid value.

(I wrote other stuff here that turned out I had misremembered, the above might not be the best advice)
I see, I'm pretty bad at implementing loops properly, but I'll give it a shot and see if I can do it.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,365
Reaction score
1,202
First Language
English
Primarily Uses
RMVXA
You're saying to call the conditional branch for the check first and then call a separate common event that contains the script call for the actor select script? Could you post a screenshot please?
1660447472531.png
 

Solr

Living Weapon
Veteran
Joined
Apr 20, 2019
Messages
75
Reaction score
55
First Language
English
Primarily Uses
RMVXA
Switching scenes usually happens within one frame, but if this does not work you could maybe try to set the actor variable to 0 first and wait in a loop until it has a valid value.

(I wrote other stuff here that turned out I had misremembered, the above might not be the best advice)
I tried this out first. I fumbled with loops for a bit, but I ultimately wasn't able to make it work (maybe it doesn't make the check in reverse, but it assigns the ID to the variable only after the event is finished in some circumstances?) Thanks though, @Another Fen
Ohhhhhhhh :). I'm supposed to put the script call in it's own common event, and call it within using the conditional branch's common event. I doing the opposite. Thank you so much @Roninator2 , I'm so grateful!

@Andar thank you too for your analysis, insight, and your creative solution :) I never would have imagined that key items could be used like that. Even if it's not the solution I'm going with, many others can definitely find value in this.
 

Latest Profile Posts


Clarn Hold
(No storylines)
There was a tutorial on how to draw anime eyes. Just draw Among Us. So I tried.
Screenshot_107.jpg
DamageActor3_7.png added!
index.php

Making a "characters first appearance" drawing for my game. Now I just have to finish the sprite art animation for her grand entrance.​
ScreenShot_9_24_2022_7_56_24.png
New area being started today. It leads to one of the games 2 optional bosses.

Forum statistics

Threads
125,537
Messages
1,171,798
Members
164,608
Latest member
royeventcompany
Top