SphereCommunity
Changing Life Mana Stam Regen *solved* - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Changing Life Mana Stam Regen *solved* (/Thread-Changing-Life-Mana-Stam-Regen-solved)

Pages: 1 2


Changing Life Mana Stam Regen *solved* - AmpereJoule - 09-13-2013 06:34 AM

Hello,


I would like to change the life regen formula to:
" Life_regen_value = str/100 " (min = 1)
" Life_regen_time = 20 - healing/5 " (max = 1)

I know that in sphere.ini there is:
Code:
// Time in seconds for hitpoint regeneration
Regen0=20

So, how can I change it like the formula I said above?


Thank you.


RE: Changing Life Regen - RanXerox - 09-13-2013 06:55 AM

You can override the healing rate of an individual by putting TAG(s) on the player:

TAG.OVERRIDE.REGEN_0 //Is the "rate" of hitpoint regeneration (default is defined by Regen0 in the Sphere.ini)
TAG.OVERRIDE.REGENVAL_0 //Is the "amount" of hitpoint regeneration (default=1)

To set the TAGs, you need a event on all the players and mosters that calls the @SkillChange trigger (to capture changes in Healing) and the @StatChange (to detect changes in STR.)


RE: Changing Life Regen - AmpereJoule - 09-13-2013 10:04 AM

I have a script that is a Stone which the player has to choose:
Warrior <button here>
Archer <button here>
Mage <button here>

these are some lines of it:
Code:
[DIALOG D_classes BUTTON]
ON=0 5
IF !(<ARGN>)
src.skillclass=Class_guerreiro
GO britain
ELIF (<ARGN>==1)
src.skillclass=Class_arqueiro
GO britain
ELIF (<ARGN>==2)
src.skillclass=Class_mago
GO britain
ENDIF

Can I put the TAGs here?


and how can I get the ARGN? (I only know programming C and VBA, and there i would create a variable inside of a function)

Here it looks like:
Code:
@SkillChange
     ARGN1 = "number of healing" //chosing healing
     TAG.OVERRIDE.REGEN_0 = 20 - ARGN2/5 //ARG2 is the new value of healing
     IF ( TAG.OVERRIDE.REGEN_0 <= 0 )
          TAG.OVERRIDE.REGEN_0 = 1 //one second to regenerate
     ENDIF
End @SkillChange (?)

@StatChange
     ARGN1 = 0 //chosing str
     TAG.OVERRIDE.REGENVAL_0 = ARGN2/100 //when the str of the players gets 200, he will recover 2 health points instead of 1
     IF ( TAG.OVERRIDE.REGENVAL_0 < 1 )
          TAG.OVERRIDE.REGENVAL_0 = 1 //default = 1
     ENDIF
End @StatChange (?)

PS: I learn that from: http://wiki.sphere.torfo.org/index.php/@SkillChange and http://wiki.sphere.torfo.org/index.php/@StatChange


PS 2: Is TAG.OVERRIDE.REGEN_1 and TAG.OVERRIDE.REGENVAL_1 the time and value of Stam Regen?
Is TAG.OVERRIDE.REGEN_2 and TAG.OVERRIDE.REGENVAL_2 the time and value of Mana Regen?


RE: Changing Life Regen - Extreme - 09-13-2013 12:41 PM

PHP Code:
[EVENTS E_REGEN]
ON=@SKILLCHANGE
TAG
.OVERRIDE.REGEN_0 100
TAG
.OVERRIDE.REGENVAL_0 <EVAL (<STR>/100) + (<HEALING>/50)>
ON=@STATCHANGE
TAG
.OVERRIDE.REGEN_0 100
TAG
.OVERRIDE.REGENVAL_0 <EVAL (<STR>/100) + (<HEALING>/50)> 
Mana: TAG.OVERRIDE.REGEN_1 and TAG.OVERRIDE.REGENVAL_1
Stam: TAG.OVERRIDE.REGEN_2 and TAG.OVERRIDE.REGENVAL_2


RE: Changing Life Regen - AmpereJoule - 09-13-2013 01:07 PM

(09-13-2013 12:41 PM)Extreme Wrote:  
PHP Code:
[EVENTS E_REGEN]
ON=@SKILLCHANGE
TAG
.OVERRIDE.REGEN_0 100
TAG
.OVERRIDE.REGENVAL_0 <EVAL (<STR>/100) + (<HEALING>/50)>
ON=@STATCHANGE
TAG
.OVERRIDE.REGEN_0 100
TAG
.OVERRIDE.REGENVAL_0 <EVAL (<STR>/100) + (<HEALING>/50)> 
Mana: TAG.OVERRIDE.REGEN_1 and TAG.OVERRIDE.REGENVAL_1
Stam: TAG.OVERRIDE.REGEN_2 and TAG.OVERRIDE.REGENVAL_2

it is only changing the value, right?

The time between the heals is "100" seconds, right?

To activate it only for players,
Code:
//Events related to all players
EventsPlayer=E_REGEN
should I put on "sphere.ini" like this?

PHP Code:
[EVENTS E_REGEN]
ON=@SKILLCHANGE
     TAG
.OVERRIDE.REGEN_0 <EVAL (20) - (<HEALING>/5)> 
     IF (
TAG.OVERRIDE.REGEN_0 <= 0)
          
TAG.OVERRIDE.REGEN_0 1
     
ENDIF
     
TAG.OVERRIDE.REGENVAL_0 <EVAL (<STR>/100) >
     IF ( 
TAG.OVERRIDE.REGENVAL_0 )
          
TAG.OVERRIDE.REGENVAL_0 //default = 1
     
ENDIF 
ON=@STATCHANGE
     TAG
.OVERRIDE.REGEN_0 <EVAL (20 - (<HEALING>/5)>
     IF (
TAG.OVERRIDE.REGEN_0 <= 0)
          
TAG.OVERRIDE.REGEN_0 1
     
ENDIF 
     
TAG.OVERRIDE.REGENVAL_0 <EVAL (<STR>/100)> 
     IF ( 
TAG.OVERRIDE.REGENVAL_0 )
          
TAG.OVERRIDE.REGENVAL_0 //default = 1
     
ENDIF 

Is it Right?


RE: Changing Life Regen - Extreme - 09-13-2013 01:24 PM

(09-13-2013 01:07 PM)AmpereJoule Wrote:  it is only changing the value, right?

The time between the heals is "100" seconds, right?
No, if you use '1' on tag, it will wait few seconds.. I don't know why, but using 100 will regen in every 1 second as you want.

To activate it only for players,
Code:
//Events related to all players
EventsPlayer=E_REGEN
should I put on "sphere.ini" like this?
Yes.

Is it Right?
You should use that I wrote...



RE: Changing Life Regen - AmpereJoule - 09-13-2013 01:33 PM

(09-13-2013 01:24 PM)Extreme Wrote:  
(09-13-2013 01:07 PM)AmpereJoule Wrote:  it is only changing the value, right?

The time between the heals is "100" seconds, right?
No, if you use '1' on tag, it will wait few seconds.. I don't know why, but using 100 will regen in every 1 second as you want.

To activate it only for players,
Code:
//Events related to all players
EventsPlayer=E_REGEN
should I put on "sphere.ini" like this?
Yes.

Is it Right?
You should use that I wrote...

I do not want to regen in 1 second.
I want that it regenerates on 20 seconds - (healing of the player)/5, and then when the player gets healing 100.0 it will be 1 second
I also want that the value that regenerates is 1 and then it grows as the str grows.

and in your code it looks like it will always be 1 second to regen, and the healing will affect the value that will regenerate.


(But thank you, you opened my mind \o\)


RE: Changing Life Regen - AmpereJoule - 09-14-2013 04:41 AM

Hello?

Is my code right?

I do not know how to use "IF" here, please someone help!


RE: Changing Life Regen - Extreme - 09-14-2013 04:54 AM

Ahh, now I understand you...
You wrote this:
Code:
I would like to change the life regen formula to:
" Life_regen = str/100 + healing/50 " (per second)
So I understood you wanted to regen str/100 + healing/50 on every second...

Well, the TAG.OVERRIDE.REGEN_0 is not in seconds and I don't know how it works... I just know that setting to 1 it will not work on every second, and setting 100 you will get on every second.

Then I don't know how to do what you want.
You will need test again and again until you get what you need.

PHP Code:
[EVENTS E_REGEN]
ON=@SKILLCHANGE
     TAG
.OVERRIDE.REGEN_0 <MAX 1,<EVAL 20-(<HEALING>/5)>>
     
TAG.OVERRIDE.REGENVAL_0 <MAX 1,<EVAL <STR>/100>>
ON=@STATCHANGE
     TAG
.OVERRIDE.REGEN_0 <MAX 1,<EVAL 20-(<HEALING>/5)>>
     
TAG.OVERRIDE.REGENVAL_0 <MAX 1,<EVAL <STR>/100>>

[FUNCTION 
MAX]
IF <
ARGV[0]> >= <ARGV[1]>
 RETURN <
ARGV[0]>
ENDIF
RETURN <
ARGV[1]> 

It will work as you want... just check the regen_0 timer thing... do tests!!!!!!!!!!


RE: Changing Life Regen - AmpereJoule - 09-14-2013 05:58 AM

(09-14-2013 04:54 AM)Extreme Wrote:  Ahh, now I understand you...
You wrote this:
Code:
I would like to change the life regen formula to:
" Life_regen = str/100 + healing/50 " (per second)
So I understood you wanted to regen str/100 + healing/50 on every second...

Well, the TAG.OVERRIDE.REGEN_0 is not in seconds and I don't know how it works... I just know that setting to 1 it will not work on every second, and setting 100 you will get on every second.

Then I don't know how to do what you want.
You will need test again and again until you get what you need.

PHP Code:
[EVENTS E_REGEN]
ON=@SKILLCHANGE
     TAG
.OVERRIDE.REGEN_0 <MAX 1,<EVAL 20-(<HEALING>/5)>>
     
TAG.OVERRIDE.REGENVAL_0 <MAX 1,<EVAL <STR>/100>>
ON=@STATCHANGE
     TAG
.OVERRIDE.REGEN_0 <MAX 1,<EVAL 20-(<HEALING>/5)>>
     
TAG.OVERRIDE.REGENVAL_0 <MAX 1,<EVAL <STR>/100>>

[FUNCTION 
MAX]
IF <
ARGV[0]> >= <ARGV[1]>
 RETURN <
ARGV[0]>
ENDIF
RETURN <
ARGV[1]> 

It will work as you want... just check the regen_0 timer thing... do tests!!!!!!!!!!

nice! But I want that 1 to be the min of REGENVAL_0, and the MAX i want to be str/100

About REGEN_0 I want that it initiates at 20 seconds and the max must be 1 second, but i want that it changes as the healing changes ( 20 - healing/5 ).

Can you explain your code to me? (every single simbol, like "<" and "(" please?)


pleeeease?