SphereCommunity
Can anyone help create this function? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Can anyone help create this function? (/Thread-Can-anyone-help-create-this-function)



Can anyone help create this function? - victorstelzer - 09-08-2012 03:16 AM

Can anyone help create this function?

When you get 100 of intelligence, not use the pot
[itemdef i_pote_mana]
NAME = +3 Of Mana
ID = i_flask1_blue_anim
TYPE = t_normal



on = @ dclick
src.modint + = 3
src.anim 17
src.sound snd_spell_gate_travel
consumes one i_flask1_blue_anim
return 1


RE: Can anyone help create this function? - RanXerox - 09-08-2012 03:31 AM

Code:
[itemdef i_pote_mana]
ID = i_flask1_blue_anim
NAME = +3 Of Mana
TYPE = t_normal
On=@dclick
   IF (<SRC.INT> > 99)
      SRC.SYSMESSAGE You spit the potion out in disgust... this potion is for babies!
      RETURN 1
   ENDIF
   src.modint + = 3
   src.anim 17
   src.sound snd_spell_gate_travel
   REMOVE



RE: Can anyone help create this function? - victorstelzer - 09-08-2012 03:35 AM

RanXerox, Thanks ....


RE: Can anyone help create this function? - RanXerox - 09-08-2012 04:16 AM

I am not sure if you realize, the code in this potion gives the person who drinks it a permanent +3 increase in intelligence... and while it is true that does also come with more mana, its not like it will ever "wear off".

On another topic...

If you intended to just modify mana (the by-product of intelligence) and not intelligence itself, that is possible too. However, since there is no "built-in" function for modifying mana (or hitpoints which are the by-product of strength or stamina which is the by-product of dexterity), you might want to use these functions (I left some logging entries in the script that are commented out so you can uncomment them and see how the functions work):

Code:
[FUNCTION MODMAXHITS]
LOCAL.Results=<EVAL <ARGS>>
IF (<ISEMPTY <ARGS>>)
//   SERV.LOG MODMAXHITS returns <dTAG0.MODMAXHITS> for <NAME>.
   RETURN <EVAL <TAG0.MODMAXHITS>>
ELSE
//   SERV.LOG MODMAXHITS changed from <dTAG0.MODMAXHITS> by <dLOCAL.Results> for <NAME> (<UID>).
   TAG.MODMAXHITS=<EVAL <TAG0.MODMAXHITS>+<LOCAL.Results>>
//   SERV.LOG - MAXHITS was <MAXHITS>
   IF !(<TAG0.MODMAXHITS>)
      TAG.MODMAXHITS=
      MAXHITS=
   ELSE
      MAXHITS=<EVAL <MAXHITS>+<LOCAL.Results>>
   ENDIF
//   SERV.LOG - MAXHITS is now <MAXHITS>
ENDIF

[FUNCTION MODMAXSTAM]
LOCAL.Results=<EVAL <ARGS>>
IF (<ISEMPTY <ARGS>>)
//   SERV.LOG MODMAXSTAM returns <dTAG0.MODMAXSTAM> for <NAME>.
   RETURN <EVAL <TAG0.MODMAXSTAM>>
ELSE
//   SERV.LOG MODMAXSTAM changed from <dTAG0.MODMAXSTAM> by <dLOCAL.Results> for <NAME> (<UID>).
   TAG.MODMAXSTAM=<EVAL <TAG0.MODMAXSTAM>+<LOCAL.Results>>
//   SERV.LOG - MAXSTAM was <MAXSTAM>
   IF !(<TAG0.MODMAXSTAM>)
      TAG.MODMAXSTAM=
      MAXSTAM=
   ELSE
      MAXSTAM=<EVAL <MAXSTAM>+<LOCAL.Results>>
   ENDIF
//   SERV.LOG - MAXSTAM is now <MAXSTAM>
ENDIF

[FUNCTION MODMAXMANA]
LOCAL.Results=<EVAL <ARGS>>
IF (<ISEMPTY <ARGS>>)
//   SERV.LOG MODMAXMANA returns <dTAG0.MODMAXMANA> for <NAME>.
   RETURN <EVAL <TAG0.MODMAXMANA>>
ELSE
//   SERV.LOG MODMAXMANA changed from <dTAG0.MODMAXMANA> by <dLOCAL.Results> for <NAME> (<UID>).
   TAG.MODMAXMANA=<EVAL <TAG0.MODMAXMANA>+<LOCAL.Results>>
//   SERV.LOG - MAXMANA was <MAXMANA>
   IF !(<TAG0.MODMAXMANA>)
      TAG.MODMAXMANA=
      MAXMANA=
   ELSE
      MAXMANA=<EVAL <MAXMANA>+<LOCAL.Results>>
   ENDIF
//   SERV.LOG - MAXMANA is now <MAXMANA>
ENDIF

If you want to try it out, change SRC.MODINT +=3 to SRC.MODMAXMANA += 3


RE: Can anyone help create this function? - victorstelzer - 09-08-2012 06:37 AM

After using the first pot. I can no longer use