Hey guys,
I'm wondering, if you can access the skill object or the Id of a skill, when a character attacks. To Specify it: I can easyly access the user of an attack itself, but is there a command to access the skill he cast?
I know one, but that doesn't work. user._actions[0].item() would return the database skill of the attack used, but I need use the command at a point, where this "actions" array is already emptied.
So does anyone know another way how to access it?
Can you specifiy how and where you want to access that data? because that depends on when you are where in the sequence.
One way to handle this without any hassle is to add a command to all skill damage formulae to store the skill ID in a variable - but that has the disadvantage that it will only happen in case of a hit, not when the skill misses.
I use the Yanflys BuffsStatesCore Plugin. In any state, I can add a section of code to a specific point in the action phases of an attack. These are: Before the attack and independent whether it hits or not, before the attack but only if it hits, after the attack but only if it hit, and after the attack regartless of whether the attack hit or not. I would like to access it at any time before the attack commits, so in one of the first two steps. But in each of the sections I get access to the user and the target.
The background is, that I would like to run different code depenening on the skills attack type (guaranteed / physical / magical), that the enemy hits the owner of the state with.
So the point of access is exactly when an enemy selects me (the owner of the state) as a target. The location of the access is inside a states notebox in the according section "<Custom Select Effect>".
The problem is, that the at point the code runs, the enemys _action list is already empty. I guess that it nulls itself as soon as the turn starts. There is a section provided by the plugin where I can run code at the start of a turn, but it seems that the nullification of the _action array runs even earlier. So that won't work.
Your suggestion would properbly work out well, since in this case it doesn't matter, whether the skill hits or not.
But do you maybe know a way to do it without saving the skills ID? ^^ If not, no problem. I didn't even come up with the idea of storing the last cast skill by anyone.