ID:169120
 
About items i was wondering how is it possible for me to make an item that they must have like 50 strenght or 10 will or somthing like that in order to wear the item or to use it?
It depends completely on the system you are using. I would have a list() of restrictions on each object then loop through them, checking them against usr.vars when the item is being equipped. Of course, such a system might be completely incompatible with whatever you're using.
In response to Hazman
Are there any demos of what i can have a look that i can see if i can make my own items
In response to Govegtos
Simple, heres 1 way fo doing it(Note: Example) :

if(src.something)
src << "You cant use this"
else
src << "You wear the item."
In response to Mecha Destroyer JD
so it would be like eg

if(src.strenght)
src << "You cant use this"
else
src << "You wear the item."

In response to Govegtos
Govegtos wrote:
so it would be like eg

> if(src.strenght)
> src << "You cant use this"
> else
> src << "You wear the item."


That could work.. but if the var strength is already implemented into your game - coinciding with levelling that is, if(src.strength) wouldn't work. All that if check would be doing is seeing if the users var strength is true or not. Regardless of it's value, it would return true if the amount assigned to it isn't null. Therefor, you'd want to restrict your objects according to a certain amount of strength (more than or equal to). And of course, you'd have to Take into consideration what the object would do for you (example: how it would modify your stats) and how much effort user puts into gaining the amount of strength that is prerequisit to wearing the restricted object. In conclusion, a little more brain power is needed rather than just copy / pasting code from the forums. :)

~Sinyc.
In response to Sinyc
So How do i go about it of seeing if the person value of strenght is above the required value of strenght?
In response to Govegtos
Govegtos wrote:
So How do i go about it of seeing if the person value of strenght is above the required value of strenght?

Using the >= operator in your if check.
In response to Sinyc
I am still confused on how do i do i did a read up on Dm Ref but i could find what i was looking for can u give me the peace of coding on how i can add the value for strenght or do i have to do that myself?
In response to Govegtos
Wouldn't it be something like this:

if(src.str>=50)
src<<"You equip the sword!"
else
src<<"You cannot equip this weapon!"
In response to Killerdragon
Thanks

But How do i make it that the player needs 50 strenght before they

obj

GogetaArmor
name = "Gogeta's Vest"
icon = 'GogetaVest.dmi'
worn = 0
verb
Wear()
set category = "Utilities"
if(src.worn == 1)
src.worn = 0
usr.overlays -= 'GogetaVest.dmi'
usr << "You remove [src.name]."
else
src.worn = 1
usr.overlays += 'GogetaVest.dmi'
usr << "You wear [src.name]."
Drop()
set category = "Utilities"
if(src.worn == 1)
usr << "Not while its being worn."
if(src.worn == 0)
src.loc=locate(usr.x,usr.y+1,usr.z)
Get()
set category = "Utilities"
set src in oview(1)
Move(usr)


How do i make so that the player needs 50 strenght and if they are under 50 strenght they cant wear it?
In response to Govegtos
Basically like how it was shown before but just modified.
            Wear()
set category = "Utilities"
if(src.worn == 1)
src.worn = 0
usr.overlays -= 'GogetaVest.dmi'
usr << "You remove [src.name]."
else
if(usr.str < 50){usr << "Sorry but you do not have enough strength to wear this";return 0}

src.worn = 1
usr.overlays += 'GogetaVest.dmi'
usr << "You wear [src.name]."


Just added the line a bit above src.worn = 1
In response to GhostAnime
k

Now on these lines i have

                else
if(usr.Strength < 50){usr << "Sorry but you do not have enough strength to wear this";return 0}
src.worn = 1


And the errors i have are

Restricteditems.dm:13:warning: empty 'else' clause
Restricteditems.dm:14:error::invalid expression
Restricteditems.dm:15:error::invalid expression

above is from lines 13,14,15

So How can i fix this?
In response to Govegtos
Err oops, I forgot to indent the if by one:X

should be
else
if

not
else
if
In response to GhostAnime
Now when i go into the game i get this message when i have 50 streneght i still get Sorry but you do not have enough strength to wear this

And How do i make so you need 50 strenght and 10 Will
and 5 Mana

And if i do it like this

                    if(usr.Strength < 50)(usr.Mentality < 50)(usr.Dexterity < 50){usr << "Sorry but you do not have enough strength to wear this";return 0}


I get

Restricteditems.dm:14::warning: statement has no effect
Restricteditems.dm:14::warning: statement has no effect
Restricteditems.dm:14:error::invalid expression

Strange go any ideas on how to fix it?
In response to Govegtos
if(usr.Strength < 50 && usr.Mentality < 50 && usr.Dexterity < 50)
usr << "Sorry but you do not have enough strength to wear this"
return 0
In response to Govegtos
Paste your whole "wear" verb within the dm tags.
In response to Sinyc
here

            Wear()
set category = "Utilities"
if(src.worn == 1)
src.worn = 0
usr.overlays -= 'GogetaVest.dmi'
usr << "You remove [src.name]."
else
if(usr.Strength < 50){usr << "Sorry but you do not have enough strength to wear this";return 0}
src.worn = 1
usr.overlays += 'GogetaVest.dmi'
usr << "You wear [src.name]."


Is that helpful
In response to Govegtos
I suggest you read up on the if proc and the && operator.

            Wear()
set category = "Utilities"
if(src.worn == 1)
src.worn = 0
usr.overlays -= 'GogetaVest.dmi'
usr << "You remove [src.name]."
else
if(usr.Strength >= 50 && usr.Mentality >= 50 && usr.Dexterity >= 50)
src.worn = 1
usr.overlays += 'GogetaVest.dmi'
usr << "You wear [src.name]."
else
usr << "You are not strong enough to wear this restricted item."


[Edit]: Whoops, had the > operator around the wrong way. :/

~Sinyc.
In response to Sinyc
I did that but when i can wear it when my strenght is 1 and i need it to be 50 in order to wear what is wrong?

heres the wear code a again

            Wear()
set category = "Utilities"
if(src.worn == 1)
src.worn = 0
usr.overlays -= 'GogetaVest.dmi'
usr << "You remove [src.name]."
else
if(usr.Strength <= 50 && usr.Mentality <= 50 && usr.Dexterity <= 50)
usr.overlays += 'GogetaVest.dmi'
usr << "You wear [src.name]."
else
usr << "You are not strong enough to wear this restricted item."


Wear
Page: 1 2