Show picture on a battler

Hi everyone,

I'm new over here, I usualy post on french forums because I'm not good in english (so scuse me for all my mistakes).

So, I want to create a throw skill, to thow some objects on the enemies. So to do this I need to display a picture on the actor and make move it to the enemy. First I get the ID of the actor and the one of the enemy. Then I'm trying to get the coordinate of them but it's not working : for the actor, the script call look bad because the X and Y values are 0 (the ID is good) ; for the enemies, I have some values but it's not corresponding to the target battler.
Spoiler
1679922204537.png
What I'm doing wrong?

P.S. : I know that some plugin (like VizuMZ action sequence projectile) can do that but i'm looking for a free way to do that.

Thanks everyone.
1 - You're taking up several game variables unnecessarily. If you're just using a value and not changing it, it doesn't need to go into its own variable. So instead of doing:
Code:
game variable 49 = $gameTemp.lastActionData(2)
game variable 50 = $gameParty.members()[$gameVariables.value(49)].screenX()
just do
Code:
game variable 49 = $gameParty.members()[$gameTemp.lastActionData(2)].screenX()
it's not even a longer line or more typing 🤣

You're getting an error because actors don't have a screenX() or screenY() method. Enemies have a _screenX and _screenY, and characters/events have have those methods for the game map, but not for battle.

You need to get it from the sprite level. See this thread:
1 - Vous accaparez inutilement plusieurs variables de jeu. Si vous utilisez simplement une valeur et que vous ne la modifiez pas, elle n'a pas besoin d'entrer dans sa propre variable. Donc au lieu de faire :
Code:
variable de jeu 49 = $gameTemp.lastActionData(2)
variable de jeu 50 = $gameParty.members()[$gameVariables.value(49)].screenX()
fais juste
Code:
variable de jeu 49 = $gameParty.members()[$gameTemp.lastActionData(2)].screenX()
ce n'est même pas une ligne plus longue ou plus de frappe:esclaffer:

Vous obtenez une erreur car les acteurs n'ont pas de méthode screenX() ou screenY(). Les ennemis ont un _screenX et un _screenY, et les personnages/événements ont ces méthodes pour la carte du jeu, mais pas pour le combat.

Vous devez l'obtenir depuis le niveau du sprite. Voir ce fil :
Thk, I'm not home now but I will try when I come back. If it's work I will close the subject.
@ATT_Turan

I tried this think with your explaination and the thread you showed me, it give this (fortunately only one actor in my game will use this skill) :

Spoiler
1679945798290.png

But it's not working, for the actor, the variable 48 and 49 are still to 0. But for the enemies it's even more wierd : when I target the first one, it's throwing on the second. When I target the second, it's OK. When I target the third, the values are still 0 , 0. And as soon I target the fist or second enemy, all next turn are throwing to the second!!!

I think $gameTemp.lastActionData(5) is not the call I need for this.

(Or maybe I'm still doing something wrong).
Why are you referencing _actorSprites[5]? RPG Maker doesn't have 6 actors in the party unless you've changed that with a plugin, and that would only work correctly if that specific actor was always locked in the same position in your party.

You would have to look at the last actor to act and use their index.

Code:
_actorSprites[$gameActors.actor($gameTemp.lastActionData(2)).index()]
[5] was the ID of the character. But I already tried with _actorSprites[$gameActors.actor($gameTemp.lastActionData(2)).index()] but it doesn't work neither!

Original thread: https://forums.rpgmakerweb.com/threads/show-picture-on-a-battler.156173/