The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 786 - File: showthread.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/showthread.php 786 errorHandler->error






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exp System - Doesn't work from 0.56b to 0.56d
Author Message
Claus
Apprentice
*

Posts: 22
Likes Given: 2
Likes Received: 0 in 0 posts
Joined: Jan 2014
Reputation: 0



Post: #1
Exp System - Doesn't work from 0.56b to 0.56d
Hello everyone, i'm here for a "porting" problem between sphere 0.56b and 0.56d
I have this exp system
Quote:[DEFNAME levelSystem]
levelBase 1 //Incrementa di 1 tag.levelup, tag.levelUp tiene i livelli
levelCap 50
levelMultiplier 1000

[EVENTS e_exp_gain]
ON=@DEATHCORPSE
Ref1 = <argo.more2> // More 2 store the killer uid
IF (<Ref1.ISPLAYER>) && (<Ref1.tag0.levelUp> < <def.levelCap>)
LOCAL.EXP_GAIN = <calcNewExp <TAG0.EXP>,<ref1.tag.LevelUp>>
Ref1.TAG0.EXP += <dLOCAL.EXP_GAIN>
Ref1.LEVELUP //check if you have lvl up.
Ref1.SYSMESSAGE Hai guadagnato <dLOCAL.EXP_GAIN> punti esperienza.
RETURN 0
ENDIF

[FUNCTION levelup]
IF <TAG0.EXP> >= ((<TAG0.LEVELUP> @ 2) * <def.levelMultiplier>) // L'operatore @ è l'elevamento a potenza,if fa l'eval in automatico
SYSMESSAGE You have level up!
TAG0.EXP=0
TAG0.LEVELUP += <def.levelBase> //Aggiungi 1
EFFECT=3,i_fx_bless,6,15,1 //l'id dell'effetto non so se è giusto
STR += 5
DEX += 3
INT += 3
Anatomy += 25
Swordmanship += 25//qui mettiamo che al levelup, salgono le stat di un punto, potete anche mettere skill o altro..
RETURN 1
ELSE
SYSMESSAGE Hai bisogno di <EVAL (((<TAG0.LEVELUP> @ 2) * <def.levelMultiplier>)-<TAG0.EXP>)> punti per salire di livello.
ENDIF

[FUNCTION exp]
SYSMESSAGE Hai <dTAG0.EXP> punti esperienza e il tuo livello <dTAG0.LEVELUP>
//
IF (((<TAG0.LEVELUP> @ 2) * <def.levelMultiplier>)-<TAG0.EXP>) < 1
SYSMESSAGE Hai bisogno di 0 punti esperienza per salire di livello.
RETURN 1
ELSE
SYSMESSAGE You need <EVAL (((<TAG0.LEVELUP> @ 2) * <def.levelMultiplier>)-<TAG0.EXP>)> points of experience to level up.
RETURN 1
ENDIF
//////
[PLEVEL 1]
exp
levelup

[EOF]

and i apply to the every single NPC these parameters
TAG0.EXP = 5000 (the exp point i prefer for the kind of monster)
TEVENTS=e_exp_gain
and
ON=@deathcorpse
local.exp_gain = <calcNewExp <TAG0.EXP>,<ref1.tag.LevelUp>>

[FUNCTION calcNewExp]
if <argn2> < 5
argn1 -= 125
return <argn1>
endif
if <argn2> < 8
argn1 -= 150
return <argn1>
endif

here a example with skeleton

Quote:[CHARDEF 0900]
DEFNAME=c_m_skeletonarcher
NAME=Skeleton Archer
TAG0.EXP = 500
ID=c_SKELETON_W_AXE
CAN=MT_WALK|MT_RUN|MT_EQUIP
DAM=2,8
ARMOR=8
RESOURCES=8 i_reag_bone
FOODTYPE=
//ALIGNMENT=EVIL
//SHELTER==r_spooky
TEVENTS=e_undead
TEVENTS=e_exp_gain
CATEGORY=Monsters
SUBSECTION=Undeads
DESCRIPTION=Skeleton Archer


ON=@Create
NPC=brain_undead
STR=75
DEX={56 75}
INT={16 40}
ARCHERY=100.0
PARRYING={45.0 55.0}
MAGICRESISTANCE={45.0 60.0}
TACTICS={45.0 60.0}
WRESTLING={45.0 55.0}
FAME={100 2000}
KARMA={-1999 -4999}

ON=@NPCRestock
ITEM=i_bow
ITEM=rich_undead_backpack
ITEM=i_arrow,{10 70}
ITEM={ random_gold_pile 1 0 2 }
ITEM={ i_bone_chest 1 i_bone_leggings 1 i_bone_arms 1 i_bone_gloves 1 i_bone_helmet 1 0 5 }

ON=@deathcorpse
local.exp_gain = <calcNewExp <TAG0.EXP>,<ref1.tag.LevelUp>>

[FUNCTION calcNewExp]
if <argn2> < 5
argn1 -= 125
return <argn1>
endif
if <argn2> < 8
argn1 -= 150
return <argn1>
endif
if <argn2> < 10
argn1 -= 200
return <argn1>
endif
if <argn2> < 12
argn1 -= 250
return <argn1>
endif


This script work very well on 0.56b but in 0.56d i have some problem with the e_exp_gain event. When i kill a monster, the event don't start.
Can some1 help me?

[excuse me for grammatical mistake, i don't speak eng very well]
09-08-2019 10:08 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Exp System - Doesn't work from 0.56b to 0.56d - Claus - 09-08-2019 10:08 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)