I made a bunch of spells for my cleric but none of them are doing any damage. I'm not sure what's wrong with them.
c = (1+rand(8)) + (level/19); b.state?(49) ? c * (-1) : c
c = (2+rand(16)) + (level/9); b.state?(49) ? c * (-1) : c
c = (3+rand(24)) + (level/5); b.state?(49) ? c * (-1) : c
c = (4+rand(32)) + level; b.state?(49) ? c * (-1) : c
it's supposed to pick a random number between 1 and 8 per level of spell and then add a portion of her level. State 49 is undead so healing and negative energy damage spells are reversed for them.
however, when I try to use the spells, they deal and heal no damage.
What am I missing?
my inflict and cure spells aren't healing or doing damage.
● ARCHIVED · READ-ONLY
-
-
if it's supposed to be caster level, change it to a.level... using only "level" probably makes the engine try to find it as a method or as a variable of the self class, which in the case of damage calculation is actually the target, not the caster... so it probably errors for enemies which causes the damage to return 0 (since the eval for damage is set to return 0 if it hits an error)
if you use a.level though, make sure that no enemy can cast that skill since it will then cause 0 damage since enemies don't have levels by default
also, if it still returns 0, try modifying the ? part into an if-then-else since I'm not sure if the damage formula supports the ? clause... -
well, it's working now.... sort of. The damage isn't going into negatives when it's used on an undead character (I'm using Yami's Invert Targets script and Yanfly's Passive states so that the zombie gains the Undead state and my cleric can target it with heal spells). The invert target script works normally with the cure spells on living targets.
That means, I'm assuming, that healing can't be converted into damage and vice versa.
Is there any way to bypass or work around that? -
instead of multiplying by -1 (creating negative damage)
just change it to b.hp +=c
This will cause a healing effect -
that doesn't work.
c = (1+rand(8)) + (a.level/19); b.state?(49) ? b.hp +=c : c this is the modified inflict spell damage. It just causes the damage to ramp WAY up.
c = (1+rand(8)) + (a.level/19); b.state?(49) ? b.hp -=c : c this is the modified cure spell healing. It causes the healing to be ramped way up. -
So before moving forward, I should explain that the last number that is output in your formula will be what the database interprets as the damage...
SO in your 2 examples you just mentioned what you have coded states that the output if state 49 is on the target would be equal to b.hp + c and b.hp - c respectively.
You need to reword it as an if statement like this:
c = damage # this is the base damageif b.state?(49) # this is the conditional statement b.hp += c * 0.5 # this is the healing 0 # this is the return of 0 for when the state existselse c # this is the return of damage formula cendWhich should look something like this:
c = damage; if b.state?(49); b.hp +=c; 0; else; c; end
That should work. if not I apologize it is almost 4 am here xD and I will check back if there is issue.
~ Dinhbat -
when I use that formula, I get an error:
unexpected tIDENTIFIER, expecting $end
c = (1+rand(8)) + (a.level/19); b.state?(49) b.hp -=c; 0 : c;
it points toward the Lunatic damage script.... but if I remove the script, it points toward the game_battler 352 line. The lunatic damage script has the same line.
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables) -
you forgot another ? after the condition... or you can just use if-then-else since it might be that the damage formula doesn't support the one liner ? operator
Code:take note though that since if it has the state, ur modifying it's hp directly and returns 0 for damage, it will show either 0 damage or null damage on the battle log...c = (1+rand(8)) + (a.level/19); if b.state?(49); b.hp +=c; 0;else c;end -
After receiving the error, I tried looking through scripts to see if I could find an elemental absorption script. I found one and it actually reverses healing too.
so I added it, along with Yanfly's passive states script, to make it so that any creature with the undead passive state will be healed by negative energy and harmed by positive :p