Hi!
I want to make a talk system similar to a SMT game into my project. I don't think a plugin is needed, but if there's any plugin that can solve my problem, It would be great too!
Basically, I want to make a very simple skill that can start a conversation with an enemy based on the enemy ID of the target. I created a Common Event, but I'm unsure of which script call I should use, or how I should use it...
If I can somehow store the target enemy ID into a variable, I think I can then make a Condition for each enemy ID... How should I do it?
Thanks!
You can use BattleManager.actor()._lastTargetIndex for this.
It works fine for me; are you remembering the indexes start at 0? (you also don't need it to be parallel process; just have the Talk skill call the common event)
No, it stores the index of the most recent target (which will be the enemy you targeted with the skill).
BattleManager.actor() returns the actor that is *currently acting* which when the skill executes will be the one who used the skill that called the common event.
When does that common event actually execute? I know that items "reserve" a common event to execute at the next opportunity... which is when exactly?
It's executed as part of execution of the skill; the common event happens after damage is applied.
Ah okay, so it should work then.
Funnily enough I'm currently writing the new Jump into Javascript and I'm on Game_Action, which will break down how this works.
I did some more tests, and I think I may have done something wrong... It's always returning the variable value as 0, even if I target another enemy.
For example, I want enemy ID below 20 to have a default message, So I set that if Variable 21 is Less than or equal to 19, it will give the default message.
If Variable 21 is equal to 20, it will give message 1.
If Variable 21 is equal to 21, it will give message 2, etc.
From Enemy ID 1 to 20 (which I guess would be from 0 to 19 for the variable), I have set the monsters which you can't talk to. But if I start a battle with Enemy ID 21, it stills shows the default message and, once outside of the battle, it shows Variable 21 as 0 on the debug menu.
The code I gave you returns the *enemy index* of the last target, not the ID of its entry in the database. Did you want the ID of the actual enemy type selected?
I'll check out your thread and see if I can help. The plan once I've finished breaking down the default code is expanding into engine customisation and more interesting stuff.
Whereabouts do you have this line, exactly? Can you show screenshots?