Thread Rating:
- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
Function not Checking?!
|
Author |
Message |
Chukwuemeka
Apprentice
Posts: 12
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Nov 2016
Reputation: 0
|
Function not Checking?!
Hey folks,
I'm editing a level system script and I'm getting a problem.
Code:
[FUNCTION f_levelup]
f_show_xp_title
IF (<TAG0.EXP> >= <TAG0.LEVELUP>)
SYSMESSAGE @030 You gain a level!
TAG0.EXP=0
TAG0.LEVELUP += 1000
TAG0.MYLEVEL += 1
When I use it with a player, it checks the TAG and works great.
Code:
ON=@DEATHCORPSE
REF1 = <ARGO.MORE2>
IF (<REF1.ISPLAYER>) && (<i.ISNPC>)
LOCAL.EXP_GAIN=<EVAL ((<i.STR> + <i.DEX>)/5)>
REF1.TAG0.EXP += <dLOCAL.EXP_GAIN>
SAY @030 You gain <eval <dLOCAL.EXP_GAIN>> experience.
REF1.f_levelup
RETURN 0
ENDIF
Now, I want to make summons and pets give the player EXP. It says I got the right EXP, but I always level up.
Code:
IF (<REF1.FLAGS> & statf_pet) && (<REF1.ISNPC>) && (<i.ISNPC>)
LOCAL.EXP_GAIN=<EVAL ((<i.STR> + <i.DEX>)/5)>
TRY UID.<REF1.MEMORYFINDTYPE.memory_ipet.LINK>.tag0.exp += <EVAL <LOCAL.EXP_GAIN>>
SAY @030 You gain <eval <dLOCAL.EXP_GAIN>> experience.
TRY UID.<REF1.MEMORYFINDTYPE.memory_ipet.LINK>.f_levelup
RETURN 0
ENDIF
It seems to be missing this check (<TAG0.EXP> >= <TAG0.LEVELUP>).
Where am I going wrong?
Thank you!
|
|
11-11-2016 03:30 AM |
|
|
ShiryuX
Journeyman
Posts: 249
Likes Given: 1
Likes Received: 19 in 14 posts
Joined: Mar 2010
Reputation: 4
|
RE: Function not Checking?!
Maybe you have to go basic at the start of the script.
Code:
ON=@DeathCorpse
if (!<uid.<argo.more2>.isplayer>)
if <uid.<argo.more2>.memoryfindtype.memory_ipet>
ref1 = <uid.<argo.more2>.memoryfindtype.memory_ipet.link>
endif
else
ref1 = <argo.more2>
endif
// your normal gain code.
if your npcs gain level also, just put an "else" after setting the pet link as ref1.
|
|
11-12-2016 03:12 AM |
|
|
User(s) browsing this thread: 1 Guest(s)