ID:179633
 
[Edit]
1. I finally found a way to fix this...

Now for No.2

2.I've been trying to make a magic shop where you can learn a magic spell only once.
Thx to Nadrews spell system, I made a spell and a small shop.
The only problem i've had is to find a code that allows the magicshop to know if I already have learned the spell or not.

//part of the shop code.
if("Charm")
if(...) // I need to find something to put here...
alert("You know this spell!","Sorry")
return 0
else
usr.verbs+=new/mob/proc/Charm
... //rest of the code here.



This is the only spell I have for now (it works):

mob/proc/Charm(mob/M as mob in view(10))
set category = "Magic"
if(usr.mp>=10)
view() <<"[usr] casts Charm!"
M.hp=min(M.hp+100,M.maxhp)
usr.mp-=10
else
usr<<"You don't have enough MP !"


Thx for those who tried to help before.
Any new suggestions?

THX
Cravens wrote:
1. Thx to some of you, my shopkeeper code works perfectly.
Only problem is, when I sell something that I have equipped,
I still keep the attack or defense power from the item.

Just before deleting the item, check to see if it's equipped and if so, unequip it. Alternatively, you could add that code to the item's Del() proc.

Lummox JR

2.I've been trying to make a magic shop where you can learn a magic spell only once.
Thx to Nadrews spell system, I made a spell and a small shop.
The only problem i've had is to find a code that allows the magicshop to know if I already have learned the spell or not.
This is the only spell I have for now:

mob/proc/Charm(mob/M as mob in view(2))
> set category = "Magic"
> if(usr.mp>=10)
> view() <<"[usr] casts Charm!"
> usr.hp=min(usr.hp+100,usr.maxhp)
> usr.mp-=10
> else
> usr<<"You don't have enough MP !"

Thx for those who tried to help before.
Any new suggestions?

THX

I'd say that your spell code is fine.. you just have to work on the shop... Although you mught want to try mob/verb/Charm, but I'm new to this whole thing so don't listen to me :\.
In response to StinkyCrapNapkin
I'm guessing he doesn't want the verb there apon login so making it a proc and adding it later is what he needed to do.
In response to Nadrew
Nadrew wrote:
I'm guessing he doesn't want the verb there apon login so making it a proc and adding it later is what he needed to do.

Ahhh okay... I'm still trying to get the haang of this..
In response to Nadrew
Nadrew wrote:
I'm guessing he doesn't want the verb there upon login so making it a proc and adding it later is what he needed to do.

Yep, that's what i want.
I'm still trying some stuff.
Someone suggested putting a hascall(),
like if(hascall(usr.verbs,"Charm")).
It compiles well, but the magicshop just ignores that part of the code.

Any ideas ?