The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strength of a Potion
Author Message
Hustensaft
Apprentice
*

Posts: 24
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2013
Reputation: 0



Post: #1
Strength of a Potion
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?
05-14-2013 08:30 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Strength of a Potion
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.
(This post was last modified: 05-14-2013 09:18 PM by darksun84.)
05-14-2013 09:17 PM
Find all posts by this user Like Post Quote this message in a reply
Hustensaft
Apprentice
*

Posts: 24
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2013
Reputation: 0



Post: #3
RE: Strength of a Potion
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?
05-15-2013 04:12 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #4
RE: Strength of a Potion
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 
(This post was last modified: 05-15-2013 08:03 AM by darksun84.)
05-15-2013 08:02 AM
Find all posts by this user Like Post Quote this message in a reply
Hustensaft
Apprentice
*

Posts: 24
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2013
Reputation: 0



Post: #5
RE: Strength of a Potion
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
05-15-2013 08:35 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: Strength of a Potion
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.
05-15-2013 08:38 AM
Find all posts by this user Like Post Quote this message in a reply
Hustensaft
Apprentice
*

Posts: 24
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2013
Reputation: 0



Post: #7
RE: Strength of a Potion
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
05-15-2013 11:04 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)