obj
DblClick()
set src in usr
if(src.suffix == "Equipped")
src.suffix = null
usr.attack-=src.attackadd
usr.defense-=src.defadd
usr.maxmagic-=src.maxmagicadd
usr.maxhealth-=src.hpadd
else
src.suffix = "Equipped"
usr.attack+=src.attackadd
usr.defense+=src.defadd
usr.maxmagic+=src.maxmagicadd
usr.maxhealth+=src.hpadd
How do I make it so I can only equip one weapon at a time, 1 armor at a time, and 5 rings at a time?
ID:175880
Mar 1 2003, 2:40 pm
|
|
In response to Siientx
|
|
Now, why would you ever do that?
mob/var/obj/armor = null Then, if(armor) you have armor equipped, else you don't. Just set armor to the object you equip. Do the same for weapons, helmets, whatever. For rings, you'll need a list... mob/var/list/rings = list() Then, if(rings.len < 5) you have a finger left to put a ring on, else you don't. |
In response to Garthor
|
|
Garthor wrote:
For rings, you'll need a list... However, the ring list has to be initialized with New(), or else mobs will share the same list. mob mob Lummox JR |
In response to Lummox JR
|
|
Hmm, I've never encountered that problem with the initializing it outside of New() before....
|
In response to Garthor
|
|
Garthor wrote:
Hmm, I've never encountered that problem with the initializing it outside of New() before.... If you initialize a list at compile-time, all objects of that type (and descended from it) use the same list. Lummox JR |
In response to Lummox JR
|
|
Ah, never noticed that.
|
then check if the player's hasarmor vare is 0 before putting armor on.
Siientx