Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reward system based on char level
Author Message
Snaigel
Journeyman
*

Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0



Post: #1
Reward system based on char level
I'm using this reward system which does a probability to drop a power scroll on @deathcorpse, so it does on any dead npc corpse, but I want to make some exceptions of npcs... any ideas?

This is the reward system script:

Quote:///////////////////////////////////////////////////////////////////
// reward system //
//////////////////////////////////////////////////////////////////
// checks the level - bonus to each level gets more ps/gold from monsters loot
// >level = +ps,+gold
// ps drop rate (r100,r99,98...)
// gold amount (+25,+50,+100,+150...)
// message to each kill
// event to all npc to check lootbonus
//////////////////////////////////////////////////////////////////
[Function e_lootbonus]
IF <tag0.mylevel>
F_check_level_reward
//
e_LOOTBONUS
ENDIF

[FUNCTION F_check_level_reward]
if <eval <tag0.mylevel> ==1>
if <eval <tag0.mylevel> <=1>
tag0.lootbonus=1
elif <eval <tag0.mylevel> <=5>
tag0.lootbonus=2
elif <eval <tag0.mylevel> <=10>
tag0.lootbonus=3
elif <eval <tag0.mylevel> <=15>
tag0.lootbonus=4
elif <eval <tag0.mylevel> <=20>
tag0.lootbonus=5
elif <eval <tag0.mylevel> <=25>
tag0.lootbonus=6
elif <eval <tag0.mylevel> <=30>
tag0.lootbonus=7
elif <eval <tag0.mylevel> <=35>
tag0.lootbonus=8
elif <eval <tag0.mylevel> <=40>
tag0.lootbonus=9
elif <eval <tag0.mylevel> <=45>
tag0.lootbonus=10
elif <eval <tag0.mylevel> <=50>
tag0.lootbonus=11
elif <eval <tag0.mylevel> <=55>
tag0.lootbonus=12
elif <eval <tag0.mylevel> <=60>
tag0.lootbonus=13
elif <eval <tag0.mylevel> <=65>
tag0.lootbonus=14
elif <eval <tag0.mylevel> <=70>
tag0.lootbonus=15
elif <eval <tag0.mylevel> <=75>
tag0.lootbonus=16
elif <eval <tag0.mylevel> <=80>
tag0.lootbonus=17
elif <eval <tag0.mylevel> <=85>
tag0.lootbonus=18
elif <eval <tag0.mylevel> <=90>
tag0.lootbonus=19
elif <eval <tag0.mylevel> <=95>
tag0.lootbonus=20
elif <eval <tag0.mylevel> <=100>
tag0.lootbonus=21
endif
endif

[events e_LOOTBONUS]
ON=@DeathCorpse
IF <act.TAG0.lootbonus> <= 1
serv.newitem i_gold,{10 20},<ARGO>
//
IF (<EVAL RAND(98)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 2
serv.newitem i_gold,{20 40},<ARGO>
//
IF (<EVAL RAND(94)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 3
serv.newitem i_gold,{30 60},<ARGO>
//
IF (<EVAL RAND(89)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 4
serv.newitem i_gold,{80 100},<ARGO>
//
IF (<EVAL RAND(84)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 5
serv.newitem i_gold,{100 150},<ARGO>
//
IF (<EVAL RAND(79)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 6
serv.newitem i_gold,{150 200},<ARGO>
//
IF (<EVAL RAND(74)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 7
serv.newitem i_gold,{200 220},<ARGO>
//
IF (<EVAL RAND(69)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 8
serv.newitem i_gold,{200 240},<ARGO>
//
IF (<EVAL RAND(64)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 9
serv.newitem i_gold,{240 255},<ARGO>
//
IF (<EVAL RAND(59)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 10
serv.newitem i_gold,{250 270},<ARGO>
//
IF (<EVAL RAND(54)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 11
serv.newitem i_gold,{270 280},<ARGO>
//
IF (<EVAL RAND(49)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 12
serv.newitem i_gold,{290 300},<ARGO>
//
IF (<EVAL RAND(44)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 13
serv.newitem i_gold,{290 300},<ARGO>
//
IF (<EVAL RAND(39)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 14
serv.newitem i_gold,{290 310},<ARGO>
//
IF (<EVAL RAND(34)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 15
serv.newitem i_gold,{295 315},<ARGO>
//
IF (<EVAL RAND(30)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 16
serv.newitem i_gold,{312 315},<ARGO>
//
IF (<EVAL RAND(30)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 17
serv.newitem i_gold,{310 318},<ARGO>
//
IF (<EVAL RAND(30)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 18
serv.newitem i_gold,{318 322},<ARGO>
//
IF (<EVAL RAND(30)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 19
serv.newitem i_gold,{316 325},<ARGO>
//
IF (<EVAL RAND(30)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 20
serv.newitem i_gold,{315 333},<ARGO>
//
IF (<EVAL RAND(30)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
ELIF <act.TAG0.lootbonus> <= 21
serv.newitem i_gold,{333 400},<ARGO>
//
IF (<EVAL RAND(20)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif
//
EndiF
01-31-2017 04:27 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Reward system based on char level
I think you can replace the whole IF structure in F_check_level_reward with just one formula:
Code:
[FUNCTION F_check_level_reward]
tag.lootbonus= <eval ( <tag0.mylevel> / 5 ) + 1 >
01-31-2017 04:55 AM
Find all posts by this user Like Post Quote this message in a reply
Catalan_mistral
Journeyman
*

Posts: 54
Likes Given: 2
Likes Received: 6 in 5 posts
Joined: Jan 2017
Reputation: 0



Post: #3
RE: Reward system based on char level
Hi Snaigel, in answer to your problem, the MOREX on the corpse is the CHARDEF of the creature before death, so you should be able to put whatever exceptions you want in there.

Also as a sidenote Darksun84 posted a condensed version of the function, should also be able to do a condensed version of the event aswell, something along the lines of
Code:
[events e_lootbonus_test]
ON=@DeathCorpse
serv.newitem i_gold,{<EVAL (<act.tag0.mylevel>*3)+<act.tag0.lootbonus>> <EVAL <act.tag0.lootbonus>*20>},<ARGO>
IF (<EVAL RAND(<EVAL (100-<act.tag0.mylevel>)+<act.tag0.lootbonus>>)> == 1)
serv.newitem power_scrolls,1,<ARGO>
endif

This may/maynot work, haven't scripted for many years and forgotten lots but I am sure any of the expert scripters can re-edit it Smile

The One and Only......
(This post was last modified: 02-01-2017 02:00 AM by Catalan_mistral.)
02-01-2017 01:51 AM
Find all posts by this user Like Post Quote this message in a reply
Snaigel
Journeyman
*

Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0



Post: #4
RE: Reward system based on char level
You mean in the Morex of the npc script?, what should I write there?
02-05-2017 01:09 AM
Find all posts by this user Like Post Quote this message in a reply
Catalan_mistral
Journeyman
*

Posts: 54
Likes Given: 2
Likes Received: 6 in 5 posts
Joined: Jan 2017
Reputation: 0



Post: #5
RE: Reward system based on char level
Heya Snaigel, I mean in the @deathcorpse trigger you can add a check like

Code:
IF (<ARGO.MOREX>!=25690)

where the number 25690 in my example is the chardef in decimal.

The One and Only......
(This post was last modified: 02-05-2017 06:20 AM by Catalan_mistral.)
02-05-2017 06:19 AM
Find all posts by this user Like Post Quote this message in a reply
Catalan_mistral
Journeyman
*

Posts: 54
Likes Given: 2
Likes Received: 6 in 5 posts
Joined: Jan 2017
Reputation: 0



Post: #6
RE: Reward system based on char level
Update thanks to xwerswoodx, if you want to check via the basedID can do it with

Code:
IF (<Serv.Chardef.<ARGO.MoreX>.BaseID>!=c_man)

hopefully you can use either bits of code to do what you need.

The One and Only......
02-05-2017 08:52 PM
Find all posts by this user Like Post Quote this message in a reply
Snaigel
Journeyman
*

Posts: 75
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0



Post: #7
RE: Reward system based on char level
And i imagine i should put a Return 1 after that? (To say that if the check is correct and the @deathcorpse is of a c_man, the reward doesn't have chance to spawn)

Thanks.
(This post was last modified: 02-06-2017 12:09 AM by Snaigel.)
02-06-2017 12:05 AM
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)