Status
Not open for further replies.

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
I'm trying to make a taunt skill, that gives the user a stacking defence buff for each enemy effected by the taunt (which is all enemies). I am using Yanflys Taunt plugin, and Buffs/States Core plugin for the stackable buffs. I have the taunt working perfectly. I even have another skill where the user is given a buff within the damage formula. But i cannot work out how to check for how many enemies are in the battle within the damage formula of the skill. Any help would be great! Thanks.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
$gameTroop.members().length() will tell you the total size of the enemy party.


$gameTroop.aliveMembers().length() will tell you how many LIVING enemies there are.
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
$gameTroop.members().length() will tell you the total size of the enemy party.


$gameTroop.aliveMembers().length() will tell you how many LIVING enemies there are.

 Perfect. Any idea how i can get this to apply a buff the same amount of times as there is enemies?
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
An alternative could be to set the amount of enemies to a variable instead? Then i could apply the buffs with a common event instead. But i would still need help applying it to a variable in the damage formula.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
$gameVariables(2).setValue( $gameTroop.aliveMembers().length() )
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
$gameVariables(2).setValue( $gameTroop.aliveMembers().length() )

 I can't get this to work within the damage formula of a skill. So i tried it within a script call in a common event instead, but it returns an error: object is not a function. Any ideas?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
sorry - that's wrong.


$gameVariables.setValue(2, $gameTroop.aliveMembers().length())


another post before my first cuppa  :headshake:
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
sorry - that's wrong.


$gameVariables.setValue(2, $gameTroop.aliveMembers().length())


another post before my first cuppa  :headshake:

no problem, i can't complain, you are helping!  :D


where would i specify which variable? replace the 2?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
i still keep getting an error. I'm using it in a common event script call. Any other ideas?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
What's the error?  Can you open the dev tools and show what's in the console?  And give a screenshot of your common event?


The variable id should not have leading zeros.


Try this - use the Control Variables command, choose your variable, and put $gameTroop.aliveMembers().length() into the Script box.


Actually, try using just length instead of length() and see if that does the trick.


I've gone back to Ace, so not doing too much in javascript, and it might just be that I've got the syntax wrong.
 
Last edited by a moderator:

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
Screen Shot 2016-06-18 at 23.37.54.pngScreen Shot 2016-06-18 at 23.38.33.pngScreen Shot 2016-06-18 at 23.38.49.png


The common event is not finished, but doesn't cause an error when run without that first script.


Do you need anymore information?


Out of interest, why have you gone back to VX?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
Ace, not VX.  My game is not too far from completion and I paid a lot of money for resources that I would have to have made again if I move over to MV.  Plus MV still has some glitches and I don't want to release a commercial game with it until those are ironed out.  At some point I may fork out the money to have everything redone in MV, but it will depend on a few things happening between now and then.


Did you try the other things I suggested in my last post?  In particular, try removing the () after length as that may not be a function at all.
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
I meant to put Ace xD But thats understandable then, it already takes so long without having to redo everything.


yeah, still nothing, i get a syntax error for unexpected end of input  :|  I'm actually having tons of problems at the moment! They all seem to come at once.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
All your other script calls are wrong.  And because everything executes without a break, there's really no indication which one is generating the error.


After the first script call (before any of the tests), do a Show Text with \v[200] - this will make sure the first script call is executing correctly, and will show you that the variable contains the correct amount.  If that gives you the unexpected end of input error, put the () back in again and see if it gets you further.


All the add_buff commands are formatted for VX/Ace, not for MV.  You've got $game_actors[1].add_buff(id, value) but it should be $gameActors.actor(1).addBuff(id, value)


If you fix all of those and get the correct value showing for the variable, and you still get errors, can you please give a new screenshot of your event showing what the current commands are?
 
Last edited by a moderator:

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
Well like i said, the rest of the common event was just thrown together, but it didn't cause the game to crash on their own, so i focused on the the one piece of script. But now i think about it.. how would i know if it worked, cos the rest of the scripts would cause an error. Well that was dumb!  :p  


This should be a fixed up version, but I'm still getting an error:Screen Shot 2016-06-19 at 01.16.43.pngScreen Shot 2016-06-19 at 01.18.00.png


I will be awhile responding now, its about time i got some sleep! But thanks a lot for your help so far, it must seem infuriating from your side, i'm still pretty useless when it comes to any kind of scripting or coding. Thanks again.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,390
Reaction score
15,202
First Language
English
Primarily Uses
RMMV
Yeah, just get rid of the () after length and it'll work.  Then you can worry about the rest :)
 

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
Perfect! Everything runs exactly as i want it to, thanks a lot. Loads of the problems i had with other things have been fixed as well, so i obviously needed to restart the PC. Hope you are around if i need anymore help. Which i probably will! Thanks again!  :D
 

Nemesis666

Veteran
Veteran
Joined
Sep 5, 2019
Messages
50
Reaction score
3
First Language
FR
Primarily Uses
RMMV
Okay so I just wanted to add more intel on this subject :

You need to put this at the beggining of a fight...

Code:
Control Variables : #0001 VarNbEn = $gameTroop.aliveMembers().length

... Without the two "()" after "length" if you dont want to have an error like :

TypeError
number is not a fonction

That's all, I will ask for closing the post now ;) .

Thank you a lot :) .
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,932
Reaction score
5,851
First Language
Dutch
Primarily Uses
RMXP

Nemesis666, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

 
Last edited:
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

LunarFlareStudios wrote on Solar_Flare's profile.
Hey, my name is Lunar Flare Studios, and you're Solar Flare? That's so weird!
How has this place been dead quiet since after I posted about Deltarune? That's the only post that people are reacting to now... will you please read my other statuses?
Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.

Forum statistics

Threads
115,295
Messages
1,088,719
Members
149,939
Latest member
Kionea
Top