SphereCommunity
Strength of a Potion - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Strength of a Potion (/Thread-Strength-of-a-Potion)



Strength of a Potion - Hustensaft - 05-14-2013 08:30 PM

Hi all,

i'm currently setting up my Alchemysystem and i want to have Potions in different strengths. Like a Healing Potion, which heals 20 HP, a Potion of gerater Heling, which heals 40 HP, a Potion of superior Healing, which heals 60 HP and so on.
Wiki tells me, that i can set the strength of a Potion with More2, but it doesn't seem to work. No matter what i put on More2, the Potions always heal like 9 HP.
What am i doing wrong there?


RE: Strength of a Potion - darksun84 - 05-14-2013 09:17 PM

Potion Theory :

While potion more2 is the strength of a potion, potion more1 is the spell that the item "use" when the player drink it.

In the heal spell script block there is this field :
EFFECT=5,20

When an healing potion is drinked, its more2 value just give more chance to heal a number of hitpoints more near to 20 than to 5.

Anyway i don't know why you get always 9hp.

But you should try to use this sort of template for you custom potion
PHP Code:
[SPELL 1000]
DEFNAME=s_healing_potion
NAME
=Healing Potion Effect
SOUND
=snd_SPELL_HEAL
RUNES
=IM
FLAGS
=SPELLFLAG_TARG_CHAR SPELLFLAG_FX_TARG SPELLFLAG_GOOD
EFFECT_ID
=i_fx_HEAL_EFFECT
EFFECT
=20  //should heal always 20, no matter potion  strength
DURATION=0.0
MANAUSE
=4
SKILLREQ
=MAGERY 10.0
INTERRUPT
=100.0,100.0

then on your healing potion item script
in more1 you will put s_healing_potion and so on.

Remember that you have to restart the server everytime you create a new spell 

Anyway i can't test it right so i don't know if it will work Big Grin

There are faster way to create custom various potion, but i consider this the more correct.


RE: Strength of a Potion - Hustensaft - 05-15-2013 04:12 AM

Hi,

thx for the answerSmile I tried this, but the new spell had no healing effect. So i added this to the spell:

PHP Code:
ON=@Effect
    
if <src.hits> >= <src.maxhits>
    
src.SysMessage But you are healthy?
    return 
1
    
elseif <src.hits> >= <eval(<src.maxhits>-20)>
    
src.SysMessage Your last wounds heal.
    
src.hits=<src.maxhits>
    return 
0
    
elseif <src.hits> < <src.maxhits>
    
src.SysMessage Some of your wounds heal.
    
src.hits +=20
    
return 0
    
endif 

The Spell works now as intented, it heals 20 HP or less, if the Player is less then 20 HP missing. I now edited the script of the potion to the new Spell and the intented strength of 20:

PHP Code:
ON=@Create
    color
=055
    MORE1
=s_healing_potion_lesser
    MORE2
=20 

but the Potion doesn't work at all, you just drink it, but without any effect, no sound, no magic sparkles, no healing. Just gulp and an emtpy bottle. Do you have any idea, what i missed?


RE: Strength of a Potion - darksun84 - 05-15-2013 08:02 AM

Actually i don't know, I think there is still something needed for activating the spell properly.

Considering that both item and spell are custom, maybe it's possible that item potion need

PHP Code:
ON=@Dclick
src
.spelleffect <more1>,<more2>,<src.uid>,<uid>
 
//with commas or without don't remember :o 



RE: Strength of a Potion - Hustensaft - 05-15-2013 08:35 AM

This is very strange. I tested this, and it worked (with commas), but the effect was double. So i deleted the lines and tried it as it was before, and suddenly it worked exactly as intended.

PHP Code:
[SPELL 1000]
DEFNAME=s_healing_potion_lesser
NAME
=Healing Potion Effect
SOUND
=snd_SPELL_HEAL
RUNES
=IM
FLAGS
=SPELLFLAG_TARG_CHAR SPELLFLAG_FX_TARG SPELLFLAG_GOOD
EFFECT_ID
=i_fx_HEAL_EFFECT
EFFECT
=20  //should heal always 20, no matter potion  strength
DURATION=0.0
MANAUSE
=4
SKILLREQ
=MAGERY 10.0
INTERRUPT
=100.0,100.0

ON
=@Effect
    
if <src.hits> >= <src.maxhits>
    
src.SysMessage But you are healthy?
    return 
1
    
elseif <src.hits> >= <eval(<src.maxhits>-20)>
    
src.SysMessage Your last wounds heal.
    
src.hits=<src.maxhits>
    return 
0
    
elseif <src.hits> < <src.maxhits>
    
src.SysMessage Some of your wounds heal.
    
src.hits +=20
    
return 0
    
endif 

and in the Potion script

PHP Code:
ON=@Create
    color
=055
    MORE1
=s_healing_potion_lesser
    MORE2
=20 

work perfectly. Maybe i forgot to restart the server after adding the ON=@EFFECT Stuff or something like that. A little strange, but it works Smile

Thanks a lot for the help Smile


RE: Strength of a Potion - darksun84 - 05-15-2013 08:38 AM

Ahhh yes sorry, you have to restart everytime even if you have to modify some spell parts..

Maybe the console command load spherespells.scp can avoid the restart.


RE: Strength of a Potion - Hustensaft - 05-15-2013 11:04 PM

Ah, good to know, i'll better add that in my "Important Notes", maybe i'll have to deal with some other spells later Smile