Jump to content


Photo

Mana Shield

effect

  • Please log in to reply
18 replies to this topic

#1 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 08 October 2012 - 12:22 PM

Effect: Mana Shield
-Tsukihime

effect_mana_shield.JPG

This script adds "Mana Shield" effect to a state.
When this effect is active, all damage will be directed to the battler's MP.
If the battler has no MP, then HP damage will be inflicted as usual.

This handles boundary cases where the amount of damage to be absorbed by
MP is greater than the battler's current MP and the difference will be
inflicted as HP damage.

Download

Script: Download here
Required: Effect Manager (you will need the latest version that does not remove states upon death)

Usage

Tag your state with


<eff: mana_shield x>
Where x is the amount of damage absorbed by MP, as a percentage.
By default it is 100%, which means you will try to use as much MP as you can.

50% means you will only use half your MP to absorb damage.
200% means each point of MP can absorb 2 points of damage.

Edited by Tsukihime, 28 February 2016 - 12:06 AM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#2 Ashern

Ashern

    Advanced Member

  • Member
  • 73 posts
  • RM Skill - Jack of All Trades

Posted 09 October 2012 - 12:13 PM

Thanks for this, nice script!

#3 ZombieSchematic

ZombieSchematic

    Member

  • Member
  • 11 posts

Posted 20 November 2012 - 08:13 AM

So I was trying to create skills like Lesser Shell and Major Shell. Lesser would only absorb 50% of the damage and Major would absorb 100%
I just can't get the 50% to work I've tried <eff: mana_shield0.5>, <eff: mana_shield0.05>, <eff: mana_shield0.50>, <eff: mana_shield50>
None of them seem to work it always absorbs 100%.

#4 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 20 November 2012 - 10:43 AM

You need spaces after mana_shield.
All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#5 ZombieSchematic

ZombieSchematic

    Member

  • Member
  • 11 posts

Posted 20 November 2012 - 03:45 PM

Ha, wow, sorry that was a typing error on my part. I do put spaces <eff: mana_shield 0.5> it looks like that. Always uses 100% instead of 50%

#6 Quack

Quack

    Advanced Member

  • Member
  • 149 posts

Posted 20 November 2012 - 04:24 PM

Ha, wow, sorry that was a typing error on my part. I do put spaces <eff: mana_shield 0.5> it looks like that. Always uses 100% instead of 50%


You are probably not doing anything wrong. The problem is the script does not work like you think it does, which is understandable as it is a little confusing. The script does not work the way you figure it would from reading the description.

If you replace the method state_effect_mana_shield_guard with the code I put below it should work the way you are expecting it to (though with this change you can no longer put values above 1.0 or you are gonna get weird behaviour. If you want to change how many hp are absorbed per mp it would be better to introduce a second parameter for that instead)
Spoiler

Edited by Quack, 21 November 2012 - 04:02 PM.


#7 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 20 November 2012 - 04:31 PM

Ha, wow, sorry that was a typing error on my part. I do put spaces <eff: mana_shield 0.5> it looks like that. Always uses 100% instead of 50%


Suppose you have 100 MP.

By 100%, you mean the enemy does 100 damage, and you now have 0 MP?
While because it is 50%, you expect to have 50 MP, and receive 50 HP damage?

Edited by Tsukihime, 20 November 2012 - 04:32 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#8 Quack

Quack

    Advanced Member

  • Member
  • 149 posts

Posted 20 November 2012 - 05:01 PM

The thing is he was probably expecting the shield to absorb 50% of the damage. So if you have 100 mana and recieve 40 damage, that would be 20 damage absorbed by the shield and mana lost.
And if the damage was 80, it would absorb 40 damage.

However the way your shield works it would absorb 40 damage if you took 40 damage. And it would absorb 50 damage if you took 80.

#9 Tsukihime

Tsukihime

    Advanced Member

  • Member
  • 7120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 20 November 2012 - 05:11 PM

I sort of overloaded the effect with a bunch of things and ended up not working out.

If x is something like 2, then each point of MP absorbs 2 points of damage.
However if x is something like 0.5, then you only absorb 50% of the damage and take the rest as HP.

I guess I should separate them into two separate effects, since you could conceivably have a shield that loses 2 points of MP for each point of damage...so you're basically losing MP a whole lot faster than usual cause your shield is weak.
All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.pnglogo_instagram40x40.png

Go here for Bugs and Requests.
 
Want to become a beta tester for my plugins before they are released to the public?

#10 Quack

Quack

    Advanced Member

  • Member
  • 149 posts

Posted 20 November 2012 - 05:32 PM

Actually thats not completely it.

I've checked you code and this is how it works:
If X is 2 it can POTENTIALLY absorb 2 points per damage. However that is only if the damage is equal to or greater than your MP.
If damage is less than MP it will absorb 1 damage per 1 MP.
If damage is 150 and MP is 100 it will absorb 1,5 damage per MP.

If X is 0.5 it will absorb damage UP TO 50% of your MP at a rate of 1 damage per 1 MP. Not 50% of the damage

To me it seems like a really weird way of calculating absorbed damage and I think that you should do what I mentioned earlier and give the effect 2 parameters. One for percent of damage absorbed and one for damage absorbed per point of mana.
Like this (only spent a minute on this code and have not tested it at all. Might have errors):
Spoiler


edit: noticed and fix a small error and renamed a variable so code is easier to understand.

Edited by Quack, 21 November 2012 - 04:09 PM.


#11 lostboyrufio

lostboyrufio

    Totes Pupsicles

  • + Sponsor
  • 8 posts
  • LocationMesa, AZ
  • RM Skill - Jack of All Trades

Posted 20 November 2012 - 10:11 PM

Not sure if this will help anyone with how the standard calculations for a mana shield would work but someone once wrote a Mana Shield snippet for me a long time ago. I honestly forget who it was so I'm sorry for not being able to give credit. Maybe this snippet can help solve some issues as it has worked perfectly for a project of mine without fail.

Spoiler


#12 ZombieSchematic

ZombieSchematic

    Member

  • Member
  • 11 posts

Posted 21 November 2012 - 02:32 PM

Suppose you have 100 MP.

By 100%, you mean the enemy does 100 damage, and you now have 0 MP?
While because it is 50%, you expect to have 50 MP, and receive 50 HP damage?

Yeah, You guys are amazing by the way. I unfortunately haven't gotten it to work. I a complete novice but I was messing with a few lines. I still got nothing. at one point it waited until MP was practically gone before only taking away 50%

#13 Quack

Quack

    Advanced Member

  • Member
  • 149 posts

Posted 21 November 2012 - 04:11 PM

Yeah, You guys are amazing by the way. I unfortunately haven't gotten it to work. I a complete novice but I was messing with a few lines. I still got nothing. at one point it waited until MP was practically gone before only taking away 50%


Did you try replacing the method state_effect_mana_shield_guard with either of the two ones I posted earlier?
Because I tried that code myself now and it works (the way you want it to work).

#14 estriole

estriole

    Advanced Member

  • Member
  • 1999 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 22 November 2012 - 09:54 PM

i modify my version mana shield calculation to this:

Spoiler


haven't test it intensively. but i think the logic already correct.

#15 Quack

Quack

    Advanced Member

  • Member
  • 149 posts

Posted 23 November 2012 - 01:57 AM

i modify my version mana shield calculation to this:

Spoiler


haven't test it intensively. but i think the logic already correct.


Well, it doesn't look like it would throw any errors, but the calculation is either incorrect or weird (depending on what your goal were).
You didn't mention how your mana shield is supposed to work but from looking at it, it seems like your shield absorbs all damage where mod is the damage absorbed per point of mana.
If that is the case I'm pretty sure the line hp_damage =@result.hp_damage - mp_damage is wrong. It should be hp_damage =@result.hp_damage - mp_damage * mod instead.

#16 estriole

estriole

    Advanced Member

  • Member
  • 1999 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 23 November 2012 - 09:51 PM

@quack: yes i didn't explain what i want with my mana shield :D.
what i want is when tagging the object with mana shield: 2 means = for every 1 mp it could absorb 2 hp damage.
and if the mp is sufficient then no hp damage at all (not like medusa from warcraft mp shield which still get damaged :D but rather like energy shield from some anime :D).

so if there's still mp then this character is immortal :D. but if the mp is not sufficient. the rest of damage dealt to hp damage.
so if we have 100 hp damage. then we have 20 mp. then the character will lose 20 mp and 60 hp.

but i also add some protection to at lest dealt 1 mp damage if there's damage. (for those 1 mp = 10 hp damage :D)

thx for the advice quack. you're right about multiplying with mod. :D

i think we could share what mana shield we develop here and seek advice how to correct the calculation if there's something wrong :D.

#17 SirCumferance

SirCumferance

    Advanced Member

  • Member
  • 325 posts
  • LocationLakewood, Washington
  • RM Skill - Jack of All Trades

Posted 28 April 2013 - 08:21 PM

Hey, I tried replacing all mentions of mp with tp, so that the shield uses TP instead. However, it does not work...any ideas as to why not?



#18 SirCumferance

SirCumferance

    Advanced Member

  • Member
  • 325 posts
  • LocationLakewood, Washington
  • RM Skill - Jack of All Trades

Posted 29 September 2013 - 02:06 PM

Bump?

 

EDIT: On the serious tip, how can I get it to go off of TP instead of Mana, I use TP as the primary fuel for abilities (Energy or NRG) and use MP as a form of ammo, the numbers are small. Any help here?


Edited by SirCumferance, 29 September 2013 - 06:06 PM.


#19 SirCumferance

SirCumferance

    Advanced Member

  • Member
  • 325 posts
  • LocationLakewood, Washington
  • RM Skill - Jack of All Trades

Posted 30 July 2014 - 05:42 PM

No love? I dabbled into Necromancy and would enjoy some feedback/help







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users