Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom meditation
Author Message
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #1
Custom meditation
Hello, I'm trying to make my meditation so it will instantly increase mana when the skill starts, instead of it gradually increasing. I have a little bit so far, I'm just stumped on how to make it so the higher the meditation skill, the more mana you get.

Here's what I have so far, don't laugh Tongue

Quote:[SKILL 46]
DEFNAME=SKILL_MEDITATION
KEY=Meditation
FLAGS=SKF_SCRIPTED
TITLE=Stoic
DELAY=2.0,1.0
STAT_STR=10
STAT_INT=100
STAT_DEX=10
BONUS_STR=5
BONUS_DEX=90
BONUS_INT=5
BONUS_STATS=20
ADV_RATE=10.0,200.0,800.0

on=@skillgain
skilllock.<argn1>=0

ON=@Fail
SRC.SYSMESSAGE You failed to meditate!

ON=@start
if (<mana> = <int> )||(<mana> > <int> )
sysmessage=You already have full mana!
return 1
endif

IF (<SRC.FINDID.i_med_timer>)
src.sysmessage You must wait before you can meditate!
RETURN 1
ENDIF
SRC.MANA=<SRC.MANA>+<VAR.MEDITATION>
SRC.NEWITEM i_med_timer
SRC.ACT.TIMER 6
SRC.ACT.CONT <SRC.UID>
RETURN 1
ENDIF

[ITEMDEF i_med_timer]
ID=i_worldgem_bit
NAME=Meditation Timer
LAYER=layer_special
TYPE=t_eq_script

ON=@CREATE
ATTR=0c
TIMER=6

ON=@TIMER
REMOVE
RETURN 1
09-24-2013 06:14 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #2
RE: Custom meditation
<VAR.MEDITATION>, is that created in another place? You can try to change that line for this one: src.mana=<src.mana>+<src.f_GetManaFromMedit>

and add this function above:

Code:
[Function f_GetManaFromMedit]
return <eval <meditation>/30> //100.0/30 will return 33, here you can adjust how mana you want to restore.

Edit: You may also want to add this check after mana regeneration.
Code:
IF (<mana>><int>)
mana=<int>
endif
So no one ends up with more than your int cap, and btw IDK wich version are you using (here will come mordaunt!) but if you use nightlies you might want to use <maxmana> instead of <int>, wich will be the same by default if you don't make any changes but will also provide you better 'movility' if you plan to make changes related to mana in the future.
(This post was last modified: 09-24-2013 06:32 PM by XuN.)
09-24-2013 06:28 PM
Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #3
RE: Custom meditation
and, dont use VAR's, you have locals, u have tags, ctags, etc etc, dont use VAR's, not only are they a bit resource consuming, but they are global as well, which could interfere with someone else using meditation in the same time frame.

[Image: matts_siggy.gif]
09-24-2013 07:56 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #4
RE: Custom meditation
To be clear, there is no difference between a VAR, a LOCAL, or CTAG, or a TAG when it comes to resources like memory etc.

Here is an alternate version of your @Start trigger that checks a CTAG (Character TAG) to decide if enough time has passed instead of creating a new memory object with a ticking timer (which does consume quite a bit of resources unnecesarily.) I also fixed some other issues:

* use two == in an IF statement, not just one = sign... in your case, just combine the greater than and the equals into one conditional test
* put the successful result (the addition of extra mana) in the @Success trigger instead instantly granting it when the skill is first attempted

Code:
ON=@start
  if (<mana> => <int> )
     SYSMESSAGE You already have full mana!
     return 1
  endif
  if (<EVAL <SERV.TIME>-<CTAG0.LastMeditationTime>> < 6)
    SYSMESSAGE You must wait before you can meditate!
    RETURN 1
  endif
ON=@Success
  SRC.MANA += <VAR0.MEDITATION>

Alternatively, instead of forcing it like this, you could instead temporarily alter the player's RATE of Mana regeneration (by adding/increasing TAG.OVERRIDE.REGEN_1 to them) or the AMOUNT of Mana regenerated (by adding/increasing TAG.OVERRIDE.REGENVAL_1 to them).
09-25-2013 09:00 AM
Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #5
RE: Custom meditation
i was told back in the day that since a var is global its always loaded, where a tag on a char is only loaded when called. this is what makes them consume more resource than a tag. i may be mistaken

but, the var is global, so if it changes for one, it changes for all, if 2+ ppl are meding at the same time and both are supposed to have a different rate, they will end up interfering with themselves giving the wrong character the other characters rate.

should make a tag at creation, and it will be there for you to update with w/e trigger u need to, and read from w/e script you got.

[Image: matts_siggy.gif]
09-25-2013 03:44 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)