XuN 
Sphere Developer
    
Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30
![]()
|
RE: My Shrink Potion
Just a tip, to improve it using less code and creating in the proccess a function that you can use in another situations:
Instead of calling the same code twice in both triggers you can create a function with all your checks:
Code:
ON=@TARGON_CHAR
SRC.TARG.f_shrink
IF (<AMOUNT> > 1)
AMOUNT -= 1
ELSE
REMOVE
ENDIF
RETURN 1
ON=@DROPON_CHAR
ARGO.f_shrink
IF (<AMOUNT> > 1)
AMOUNT -= 1
ELSE
REMOVE
ENDIF
RETURN 1
[function f_shrink]
IF (<DISTANCE> > 2)
SRC.SMSGL=-1,500446 // That is too far away.
RETURN 1
ENDIF
IF (<FLAGS> & STATF_CONJURED)
SRC.SMSG=@03B2,0,1 You cannot shrink summoned creatures.
RETURN 1
ENDIF
IF (<FLAGS> & STATF_WAR)
SRC.SMSG=@03B2,0,1 You cannot shrink your pet while it is in combat.
RETURN 1
ENDIF
IF (<FLAGS> & STATF_ONHORSE)
SRC.SMSGL=-1,1040016 // You cannot use this while riding a mount
RETURN 1
ENDIF
IF (<ISPLAYER>)
SRC.SMSGL=-1,500329 // That's not an animal!
RETURN 1
ENDIF
IF (!<ISMYPET>)
SRC.SMSGL=-1,502676 // That's not your pet!
RETURN 1
ENDIF
IF (((<BASEID> = C_HORSE_PACK) || (<BASEID> = C_LLAMA_PACK)) && (<FINDLAYER.LAYER_PACK.FCOUNT> > 0))
SRC.SMSGL=-1,1042563 // You need to unload your pet.
RETURN 1
ENDIF
SHRINK 1 // shrink will create the figurine in the char's position, shrink 1 will bounce it automatically
So this way the function is being called on both triggers and you can call it via script whenever you need it with a simple x.f_shrink or trysrc <whoever> x.f_shrink, etc.
|
|
01-25-2015 01:17 AM |
|
|