Upgrade NPC

Join Discord

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
Heres a quick Upgrade NPC I scripted using UpgradeOrbs and UpgradeGems.

Orbs = 50% rate
Gems = 100% rate

Please give credit as it took me 2 hours to code and if you use it a thanks wouldnt go a miss. Thanks to IdaBigA for the Idea.
 

Attachments

  • upgrade.txt
    21.8 KB · Views: 283
Last edited:

mythonline

Known Cheater
Golden Oldie
Oct 2, 2005
546
1
125
can you add to the npc some limits? for example u can add up to +3 on some ring ect
anyway looks great ^^
 

idaBigA

Holley Mir 3!!
VIP
Oct 28, 2003
1,966
110
310
Stoke, UK
Nice m8, just 1 change. You could have shrunk the code (and the time it took to write) considerably by grouping alot of the commands together.

i.e.

Code:
[@Upgrade]
#SAY
What would you live to Upgrade?\\
<Weapon/@Upgrade1(1,Weapon)>\
<Ring(Left)/@Upgrade1(7,Ring(Left))>\
<Ring(Right)/@Upgrade1(8,Ring(Right))>\
<Brace(Left)/@Upgrade1(5,Brace(Left))>\
<Brace(Right)/@Upgrade1(6,Brace(Right))>\
<Necky/@Upgrade1(3,Necklace)>\
<Helm/@Upgrade1(4,Helmet)>\
<Armour/@Upgrade1(0,Armour)>\
<Footwear/@Upgrade1(10,Footwear)>\

[@Upgrade1()]
#ACT
Mov  D0  %ARG(1)
Mov  A0  %ARG(2)
#SAY
You want to upgrade your <$OUTPUT(A0)>\
What would you like to add?\\

Etc Etc...

This next section would still have to group certain items together, but it can still be shortened. i.e. Both Rings can be done together, Both Braces, etc.

To check the amount of upgrades on an item is done via the command
Code:
   HLSCRIPTCMD CHECKITEMAMULETCOUNT %D0 %D2
This checks that the item (slot) "D0" has no more than "D2" added stats on it.

I.e.
Code:
   Mov  D0  0
   Mov  D2  4
   HLSCRIPTCMD CHECKITEMAMULETCOUNT %D0 %D2
This will check that item 0 (Armour) has AT MOST 4 stats on it.


Hope that helps. :)
 

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
Nice m8, just 1 change. You could have shrunk the code (and the time it took to write) considerably by grouping alot of the commands together.

i.e.

Code:
[@Upgrade]
#SAY
What would you live to Upgrade?\\
<Weapon/@Upgrade1(1,Weapon)>\
<Ring(Left)/@Upgrade1(7,Ring(Left))>\
<Ring(Right)/@Upgrade1(8,Ring(Right))>\
<Brace(Left)/@Upgrade1(5,Brace(Left))>\
<Brace(Right)/@Upgrade1(6,Brace(Right))>\
<Necky/@Upgrade1(3,Necklace)>\
<Helm/@Upgrade1(4,Helmet)>\
<Armour/@Upgrade1(0,Armour)>\
<Footwear/@Upgrade1(10,Footwear)>\
 
[@Upgrade1()]
#ACT
Mov  D0  %ARG(1)
Mov  A0  %ARG(2)
#SAY
You want to upgrade your <$OUTPUT(A0)>\
What would you like to add?\\
 
Etc Etc...

This next section would still have to group certain items together, but it can still be shortened. i.e. Both Rings can be done together, Both Braces, etc.

To check the amount of upgrades on an item is done via the command
Code:
   HLSCRIPTCMD CHECKITEMAMULETCOUNT %D0 %D2
This checks that the item (slot) "D0" has no more than "D2" added stats on it.

I.e.
Code:
   Mov  D0  0
   Mov  D2  4
   HLSCRIPTCMD CHECKITEMAMULETCOUNT %D0 %D2
This will check that item 0 (Armour) has AT MOST 4 stats on it.


Hope that helps. :)

Yup I knew you would post a better way of doing the script, Least it will all help members with new ideas for servers.
 

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
i no this topic is old, but adding onto this..
a command such as...
#IF
Random 2

i understand that means there is a 50% chance of failure and success

but
#IF
Random 3

does this mean.. 33% chance of failing, or 33% chance of success? thanks :)
and also thanks for the stat cap limit idabiga, it worked like a charm.
 

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
sorry i forgot to add this in lol. feel like i bug you everyday :P

now say.. i want a 75% chance.. would i do
Random 3 4
or a 60% chance..
Random 6 10

or there is some other method?
 

idaBigA

Holley Mir 3!!
VIP
Oct 28, 2003
1,966
110
310
Stoke, UK
There are a couple of ways of doing it..

You can either use Movr (Picks a random number between 0 and the number you choose) or Random, which is shown above..

10% = Random 10
20% = Random 5
33% = Random 3
50% = Random 2

To use Movr, do the following..

Code:
#ACT
Movr  D0 10   ;Choose a number between 0 and 4 and puts it into D0
Inc   D0  1   ;Makes the number from 1 > 5 instead of from 0 to 4

#IF
Large  D0  6  ;If D0 is larger than 6 (i.e. 7, 8, 9 or 10) - 40% Chance
#SAY
This is a 40% chance of succeeding\

#IF
Large D0 4    ;If D0 is larger than 4 (i.e. 5, 6, 7, 8, 9 or 10) - 60% Chance
#SAY
This is a 60% chance of succeeding\


ETC
 
Last edited:

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
i no this is old, but for any new server makers or old server makers who didnt catch this earlier... there is a major flaw in this script, and i also believe the upgrade NPC released with the liquidsilver files.. take a careful look at where it does the check for the Bonus item, its near the start.. someone can get past the check, then drop the item of their bag onto the floor, and recieve a free upgrade :) and keep getting free upgrades this way. its better to do the item check much later in the script, when you cant drop it out of your bag :)
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,181
30
2,783
540
why do you need to use a script now anyway? dm2, td, and unleashed files all have the gem/orb system working like its meant too.
 

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
this is mir3 :) not mir2 hehe
and i no alot of mir3 servers still use this kind of script or some form of it
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,181
30
2,783
540
so it is sorry. didnt realise :P
 

Geordiehc

Mad Dog Geo
VIP
Jul 4, 2007
2,827
49
195
Redditch, UK
in line

----
<M-Nature or M-Soul/@ringrmagic> \

only upgrade M-Soul ?¿, no m-nature?
The item will already have it set in the database what magic it uses therefore if its a mc ring it will add mc, if its a sc ring it will add sc, if its m-all it will add m-all