EDIT
Never mind, I've solved my question.
you're probably missing a ; and a few other parts...
a.add_state(80) doesn't return a number (as far as I know) and therefore the + behind it doesn't make sense.
Close it with a ;
Then check your remaining damage calculation - I don't see a difference before and after the else (other than adding the state), so you might use that damage formula behind the end; or add the missing number to the part before the else.
I can get one of two characters to do damage but never the id 8, the one with the state applied. Even after moving some things around.
if a.id == 8; a.add_state(80); end; a.atk * 3 - b.mdf * 1.0
Yes. That did it, thanks.
Is there a way to make a formula where the actor gains an attack power will increase as long as an ally(s) are dead. Like the damage is multiplied by two for each dead ally (so 6 would be the max if all 3 allies are dead at the same time) but returns to normal when the allies are revived.
Try:
[(4 - $game_party.alive_members.size) * 2,1].max * formula
I am trying to make a spell that sacrifices the user, killing them and heals/revives the target for the caster's current health. Kinda like an explosion spell that heals rather than used for damage.
How would I do this?
I tried using a formula I seen for explosion spell and changed to healing but didn't work.
c = a.hp; a.add_state(1); c^^ above formula works great to damage, but doesn't to squat to heal.
Edit: I had the Scope set to One Ally (Dead), works fine on One Ally. 😛
However, the spell doesn't work on dead allies.
How do I get it to remove death from a dead ally, and not let it affect the user if he is targeted with his own spell?
I want to be able to use an item to give protection in battle against an element e.g. to reduce damage from fire by 20%
Is it possible to do this in the damage formula for that item?
I want to make a spell that targets all enemies, but divides the total damage by the number of enemies targeted.
For example, it would deal 1000 damage to 1 enemy, or 250 damage each to 4 enemies.
and ksjp17, probably the easiest way to have a consumable item grant element protection would be to make a state for each element and have the item's effect apply that state. Basically you make a state called Fire Protection with the feature Element Rate [Fire] * 80%. Then your item will have the effect Add State [Fire Protection] 100%.
@Ministry
Yes, I'm using the State approach at the moment as a placeholder, but I'm using States for quite a wide range of things, and I'm fairly sure I've read somewhere that there is a fairly low maximum number of states that you can stack onto an actor at any one time. I therefore want to avoid using States unless there is no other choice.
Allright, I got it sorted out exactly how I want it!
So first thing I have to do is set a variable at the start of each encounter. So every Troop gets a Battle Event with the condition of Turn No. 0 that does Control Variables: [0004:# of enemies] = $game_troop.alive_members.size
I also need to decrease this variable by 1 every time an enemy dies. I created a Common Event called "Dec # of enemies" with the Content of Control Variables: [0004:# of enemies] -= 1. Then for every enemy within a Troop I made a New Event Page with Condition: enemy [1. Slime]'s HP 0% or below to Call Common Event: [Dec # of enemies]. The enemy ID gets changed to match each enemy, of course. For some reason this event is not called until the spell finishes doing it's business (which is a good thing as it will not deal more damage as it goes if it's killing weaker enemies).
Lastly the Skill's Formula just checks the variable and uses: 100 / v[0004]
This way the number of enemies is updated at the beginning of each battle and gets decreased if an enemy is killed BEFORE the spell is actually cast (however it does not change if an enemy is killed by the spell until the spell completes dealing damage to all targets).
I know this is not exactly a custom formulae solution, and therefore is a little off-topic, but in case anyone else was following my issue to use in their own RPG I want them to see how it was solved.
1) Try:
b.state_spread
class Game_Battler < Game_BattlerBase def State_Spread for c in 2..41 if self.state?(c) for m in $game_troop.members next unless m.alive? m.add_state(c) end end end end end2) It's one way of doing it.3) No $game_troop.members is an array of objects type Game_Enemy.
Awesome!
If you wanted to use that loop for damaging enemies, would you put the damage formula after m? do you need anything else?
for that point you would probably use the all enemies scope for the skill