So, I have got skill that changes variable to the enemy's id and index (order in troop starting from 0). This is the formula I put in the Damage tab:
$gameVariables.setValue(1, b.enemyId()); $gameVariables.setValue(2, b.index()); 0;
...and it works perfectly!
But then I installed YEP Selection Control and when I use that skill on actor console log pops up and it says "TypeError: undefined is not a function" of course.
I'm sure I have to make if/else statement but I don't know how can I check if target is an enemy.
I'd like to make something like this:
if (target == enemy) { $gameVariables.setValue(1, b.enemyId()); $gameVariables.setValue(2, b.index()); } else { $gameVariables.setValue(3, b.actorId()); }; 0;
Any ideas how to make condition? Thank you!
In the damage field, v is the $gameVariables._data array. So instead of $gameVariables.setValue(1, b.enemyId()) you can just do v[1] = b.enemyId().
Game_Battler has functions called isEnemy() and isActor() that will return true or false depending on which side they're on.
Oh, yeah, you are right! Those are working!
Also I'm very beginner at javascript and I have no idea how should it look like. I have tried to do this multiple times but it always didn't work.
Will you help me? I ended up with this:
if(b == Game_Battler.isEnemy) {v[1]=b.enemyId; v[2]=b.index;}else{v[3]=b.actorId;} 0;
After using skill, nothing happens. There should be common event instead if variable 1 is equal to specific enemy id.
Also thank you for responding!
At a glance I don't see anything wrong with that, but I also am not used to combining 5-line scripts into a single line.
Can you show a screenshot of your skill and the common event that's attached to it? Use alt+printscreen so it grabs the whole database window (to include all the info we need to see, not just a subset) but not the entire desktop (which results in the window itself being too small to read clearly).
Are you setting those variables to 0 at some point, so the common event isn't running with a variable 'left over' from a previous call?
Uh, sorry, it looks like formating didn't work.
◆If:EnemyID = 2
◆If:Script:$gameTroop.members()[$gameVariables.value(2)]._przeprosiny
◆Force Action:#1, Zaprzyjaźnienie się, Last Target
◆Play SE:Scream (90, 150, 0)
◆Text:wjoska(0), Window, Bottom
:Text:gratulacje
◆Play SE:Scream (90, 150, 0)
◆Text:wjoska(0), Window, Bottom
:Text:zdałeś test na miłość
◆Play SE:Scream (90, 150, 0)
◆Text:wjoska(0), Window, Bottom
:Text:wruć kiedyś a nałucze ćie czegoś wiencej
◆
:Else
◆If:Script:$gameTroop.members()[$gameVariables.value(2)]._dotyk
◆
:Else
◆Script:var id = $gameVariables.value(2);
:Script:$gameTroop.members()[id]._dotyk = true;
◆Play SE:Scream (90, 150, 0)
◆Text:wjoska(0), Window, Bottom
:Text:wyglonda na to rze manekin nie hce być
:Text:tfoim pszyjaćielem
◆Play SE:Scream (90, 150, 0)
◆Text:wjoska(0), Window, Bottom
:Text:zmóśmy go do tego
◆Play SE:Scream (90, 150, 0)
◆Text:wjoska(0), Window, Bottom
:Text:pszytól go twojom nowom umiejentnośćiom
◆
:End
◆Change Skill:arnold, + Przytulas Przyjemności
◆
:End
◆
:End
lol - I specifically asked for a screenshot and I said it's to include all the info we need to see. Just giving a list of the commands does not include all the info we need to see.
So could I please get a screenshot of your common event (just the first part - don't need multiple to include all the commands)? And where do you set those three variables back to 0?
They aren't coming back to 0 because of "_" in the name.
Almost everything I made was based on this video:
Your damage formula is wrong.
I said Game_Battler has isEnemy() and isActor() functions, but that doesn't mean you call it as Game_Battler.isEnemy() - Game_Battler is a class, not an object.
Use b.isEnemy() and b.isActor()
So it should look like this:
if(b.isEnemy()) {v[1]=b.enemyId; v[2]=b.index;}else{v[3]=b.actorId;} 0;
or this:
if(b.isEnemy()) {v[1]=b.enemyId; v[2]=b.index;} if(b.isActor()) {v[3]=b.actorId;} 0;
I tried both before but nothing happens. Skill deals 0 damage and there is no common event.
Change the damage to 5, and put a Show Text command at the very top of the common event, not inside any conditions or anything. Just to see if it is being called. If the text does show, change the damage back to 0 and see if it still shows. I didn't think the common event call is dependent on the damage value, but maybe it is.
Damage was dealt and the message poped up.
Then I changed damage back to 0 and message also poped up.
That meas variable wasn't set.
So your common event IS running.
Add a command to the start of the common event, after the Show Text, to abort battle. When you get back to the map, hit F9 to call up the debug console. Go down to the variables and see what's in them.
Edit: okay - you need to use b.enemyId(), b.index() and b.actorId() - with () at the end.
All variables are set to 0.
WOW!
So it was that easy!
Thank you very much for everything! 😀