Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

i just wanna know a script call to access the number of stacks of a particular status effect since i want to make the poison from slay the spire (does n damage then removes a stack at the end of the turn n= number of stacks)

$gameParty.battleMembers()[member_index]._states.filter(state_id => state_id == req_state_id).length

- $gameParty.battleMembers() is the function call to get the battle members

- $gameParty.battleMembers()[member_index] specifies a battle member, member_index must be a number (begins at 0 for first member)

- $gameParty.battleMembers()[member_index]._states gives the states for that member in ID form

- $gameParty.battleMembers()[member_index]._states.filter(state_id => state_id == req_state_id) filters the states and returns an array that meets the required ID. req_state_id must be a number

- $gameParty.battleMembers()[member_index]._states.filter(state_id => state_id == req_state_id).length gives the number of states in the array

I recommend you learn array filter going forward before continuing. 

googling the array filter did not help me understand the arguments

whats the required state id?

i figured out that req_state_id is the only one that gets changed

do the state ids also start at 0 ?

i = 0;

req_state_id = 4;

var = $gameTroop.members()[i]._states.filter(state_id => state_id == req_state_id).length

$gameVariables.setValue(172,var)

this is the script call i used but its getting a unexpected = error

no matter what i try, it still throws a syntax error

Var is a keyword used to declare a variable. Please refer to a relevant JavaScript guide before continuing.

You have not declared your other variables either. Would you like some YouTube recommendations?

changing var to something else worked so far,
cant get the multiple stacks to display though
they display on the player but not enemies

To display stacks on enemies, the icon display sprite needs to have a draw function attached to it after the status icon has been drawn

how do i remove just one stack of a state? telling it to remove one removes all of them

Access the states object and then remove the index of the state from the battler object

did you make your mz version of this yet?

I start plugin modifications from the 15th

Also yes but that version is paid and is named status construct