[King] Spell Upgrade NPC

smoochy boys on tour

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
I've got all the basics of the script how I want to, but I can't get it to upgrade skill levels.

Code:
[@upgrade()]
#IF
#ACT
Mov A1 {BOOK} %ARG(1)
Mov A2 {COST} %ARG(2)
goto @UpgradeSpell1

[@UpgradeSpell1]
#IF
CHECKFAME %A2 {COST}
CHKMAGICLEVEL %A1 {BOOK} 3
#ACT
actcmd CHANGEMAGLVL %A1{BOOK} 4
SETFAME - %A2 {COST}
#SAY
You now have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} Level 4
#ELSESAY
I'm not working properly yet.\

[@upgrade1()]
#IF
#ACT
Mov A1 {BOOK} %ARG(1)
Mov A2 {COST} %ARG(2)
goto @UpgradeSpell12

[@UpgradeSpell12]
#IF
CHECKFAME %A2 {COST}
CHKMAGICLEVEL %A1 {BOOK} 4
#ACT
actcmd CHANGEMAGLVL %A1{BOOK} 5
SETFAME - %A2 {COST}
#SAY
You now have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} Level 5
#ELSESAY
I'm not working properly yet.\

Each spell is set like this.

Level 4 Upgrade
Code:
<[ Fire ball ]/@upgrade(Fireball,500)>\
Level 5 Upgrade
Code:
<[ Fire ball ]/@upgrade1(Fireball,1000)>\

But the spells are not upgrading.
 

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
It looks right, only ting I can think of is the Maglvl Code could be wrong, Look in my Item scripts for level 5 spells.

In my kings release I had a script for level 5 skills in the Items Scripts, so that you could only learn the skill when another skill was level 5 but that should help you in this code.
 
Upvote 0

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
It looks right, only ting I can think of is the Maglvl Code could be wrong, Look in my Item scripts for level 5 spells.

In my kings release I had a script for level 5 skills in the Items Scripts, so that you could only learn the skill when another skill was level 5 but that should help you in this code.
In the bookstore one, it shows as CHANGEMAGLVL

This is the code I've gone from, but simplified it down

Code:
[@Translatewar3()]
#IF
#ACT
Mov A1{BOOK} %ARG(1)
Mov A2{COST} %ARG(2)
goto @TrainMagic4_Warrior12

[@TrainMagic4_Warrior12]
#IF
checkgold %A2{COST}
#ACT
goto @TrainMagic4_Warrior13
#ELSESAY
Sorry you do not have {FCOLOR/1}<$OUTPUT(A2)>{FCOLOR/12} Gold.\\
<Leave/@Exit>

[@TrainMagic4_Warrior13]
#IF
chkmagiclevel %A1{BOOK} 4
#ACT
goto @TrainMagic4_Warrior14
#ELSESAY
Sorry you do not have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} at Level 4.\\
<Leave/@Exit>
 
Last edited:
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
In the bookstore one, it shows as CHANGEMAGLVL

I said Itemscript Code, The check for level 5 skills I put in ItemScripts in the QuestSystem.

I dont think I ever actually used th book shop for spells becsue I made spells semi easy to level, but the check should be in the Itemscripts.
 
Last edited:
Upvote 0

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
I said Itemscript Code, The check for level 5 skills I put in ItemScripts in the QuestSystem.
The only one I have in Itemscripts is the manual.txt and it's not in there. But looking at the book store for the Tao Pet, that also shows as actcmd CHANGEMAGLVL
 
Upvote 0

lraccajr

Dedicated Member
Dedicated Member
Jul 16, 2007
123
2
64
CHECKFAME %A2 {COST}
CHKMAGICLEVEL %A1 {BOOK} 3

should be this shouldnt it?

CHECKCMD CHECKFAME %A2 {COST}
CHECKCMD CHKMAGICLEVEL %A1 {BOOK} 3


this works for me only i haven't got it to take the fame yet
 
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
Yes I know that the CHANGEMAGLVL works fine as I used it to fixed pets on bookshop, but are you sure your check command is correct otherwise it wont call the change command. The Manual.txt should be there :/ its how you doubleclick spell books..

CHECKFAME %A2 {COST}
CHKMAGICLEVEL %A1 {BOOK} 3

should be this shouldnt it?

CHECKCMD CHECKFAME %A2 {COST}
CHECKCMD CHKMAGICLEVEL %A1 {BOOK} 3


I alway use CHECKCMD on kings if the check isnt checking so could be the problem.
 
Upvote 0

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
CHECKFAME %A2 {COST}
CHKMAGICLEVEL %A1 {BOOK} 3

should be this shouldnt it?

CHECKCMD CHECKFAME %A2 {COST}
CHECKCMD CHKMAGICLEVEL %A1 {BOOK} 3

Don't need CHECKCMD for either, as it's all ready doing that with CHECKFAME & CHKMAGICLEVEL

---------- Post added at 03:00 PM ---------- Previous post was at 02:57 PM ----------

Yes I know that the CHANGEMAGLVL works fine as I used it to fixed pets on bookshop, but are you sure your check command is correct otherwise it wont call the change command. The Manual.txt should be there :/ its how you doubleclick spell books..




I alway use CHECKCMD on kings if the check isnt checking so could be the problem.
The only commands I can see in Manual.txt are the following

Code:
CHKMAGICLEVEL
ACTCMD ADDMAGIC
 
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
I know that code works fine, as I used it for ages. Maybe rewrite your code or show us all the code? where its calling the A2 and A1 from?

Also Might be the checkfame command, I could help more but i dont have the files handy, try checkcmd
 
Last edited:
Upvote 0

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
I know that code works fine, as I used it for ages. Maybe rewrite your code or show us all the code? where its calling the A2 and A1 from?

Level 4 Upgrade
Code:
<[ Fire ball ]/@upgrade(Fireball,500)>\
Level 5 Upgrade
Code:
<[ Fire ball ]/@upgrade1(Fireball,1000)>\

Also CHECKCMD doesn't work with CHECKFAME or CHKMAGLEVEL
 
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
Level 4 Upgrade
Code:
<[ Fire ball ]/@upgrade(Fireball,500)>\
Level 5 Upgrade
Code:
<[ Fire ball ]/@upgrade1(Fireball,1000)>\

Also CHECKCMD doesn't work with CHECKFAME or CHKMAGLEVEL

And you have 500 fame? Do you not need to mov fame to a temp variable?


[@upgrade()]
#IF
#ACT
Mov A1 {BOOK} %ARG(1)
Mov A2 {COST} %ARG(2)
goto @UpgradeSpell1

[@UpgradeSpell1]
#IF
CheckFame
#ACT
Mov A2 %P9
goto @UpgradeSpell2

[@UpgradeSpell2]
#IF
CHECKFAME %A2 {COST}
CHKMAGICLEVEL %A1 {BOOK} 3
#ACT
actcmd CHANGEMAGLVL %A1{BOOK} 4
SETFAME - %A2 {COST}
#SAY
You now have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} Level 4
#ELSESAY
I'm not working properly yet.\

You need to say whats its doing, is it taking points but not upgrading, is it not taking point and not upgrading ect ect
 
Last edited:
Upvote 0

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
And you have 500 fame? Do you not need to mov fame to a temp variable?




You need to say whats its doing, is it taking points but not upgrading, is it not taking point and not upgrading ect ect
It's not doing either, I've also used a similar script with the Mov variable

This works on another script.

Code:
#IF
#ACT
Mov A1{BOOK} %ARG(1)
Mov A2{COST} %ARG(2)
goto @move

[@move]
#IF
checkfame %A2{COST}
Checkmagic %A1{BOOK} 1
#ACT
actcmd delmag %A1 {BOOK} 1
setfame - %A2 {COST}
#SAY
Your {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} Spell has been removed.\\
#ELSESAY
Sorry you do not have {FCOLOR/1}<$OUTPUT(A2)>{FCOLOR/12} FamePoints\
or the spell {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12}.\\
<Leave/@Exit>

And that works.
 
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
So your check or change magic level commands must be wrong, have you done a search for the commands?

KINGSCRIPTCMD CHANGEMAGLVL
or
ACTCMD CHANGEMAGLVL

Code:
[@upgrade()]
#IF
#ACT
Mov A1 {BOOK} %ARG(1)
Mov D2 {COST} %ARG(2)
Mov D0 3
Mov D1 4
goto @UpgradeSpell1

[@UpgradeSpell1]
#IF
CHECKFAME %D2
CHKMAGICLEVEL %A1 %D0
#ACT
ACTCMD CHANGEMAGLVL %A1 %D1
SETFAME - %D2 {COST}
#SAY
You now have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} Level 4
#ELSESAY
I'm not working properly yet.\
 
Last edited:
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
Does thsi work?

Code:
[@upgrade()]
#IF
#ACT
Mov A1 {BOOK} %ARG(1)
Mov D2 {COST} %ARG(2)
Mov D0 3
Mov D1 4
goto @UpgradeSpell1

[@UpgradeSpell1]
#IF
CHECKFAME %D2
CHKMAGICLEVEL %A1 %D0
#ACT
ACTCMD CHANGEMAGLVL %A1 %D1
SETFAME - %D2 {COST}
#SAY
You now have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} Level 4
#ELSESAY
I'm not working properly yet.\
 
Upvote 0

Phantom

Banned
Banned
Dedicated Member
Feb 4, 2012
255
5
45
Resolved:

That was strange that it didn't work in the shortened version, so changed it too the following.

[@upgrade()]
#IF
#ACT
Mov A1{BOOK} %ARG(1)
Mov A2{COST} %ARG(2)
goto @Trainmagic1

[@Trainmagic1]
#IF
checkfame %A2{COST}
#ACT
goto @TrainMagic2
#ELSESAY
Sorry you do not have {FCOLOR/1}<$OUTPUT(A2)>{FCOLOR/12} Fame.\\
<Leave/@Exit>

[@TrainMagic2]
#IF
chkmagiclevel %A1{BOOK} 3
#ACT
goto @TrainMagic3
#ELSESAY
Sorry you do not have {FCOLOR/1}<$OUTPUT(A1)>{FCOLOR/12} at Level 3.\\
<Leave/@Exit>

[@TrainMagic3]
#IF
chkmagiclevel %A1{BOOK} 3
checkfame %A2{COST}
#ACT
actcmd CHANGEMAGLVL %A1{BOOK} 4
setfame - %A2{COST}
#SAY
Your spell was upgraded.\\
<Leave/@Exit>\
It's now fully working
 
Last edited:
Upvote 0

Azura

Mir3 Coder & Adviser
Legendary
Mar 12, 2005
3,249
111
300
Ok good, doesn't matter how long the script is if it works, people dont see the script only the output :)

Glad you got it working.
 
  • Like
Reactions: Phantom
Upvote 0