ID:169120
![]() Jul 26 2005, 11:10 pm
|
|
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?
|
![]() Jul 26 2005, 11:24 pm
|
|
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.
|
Simple, heres 1 way fo doing it(Note: Example) :
if(src.something) |
Govegtos wrote:
so it would be like eg > if(src.strenght) 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. |
So How do i go about it of seeing if the person value of strenght is above the required value of strenght?
|
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. |
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?
|
Wouldn't it be something like this:
if(src.str>=50) |
Thanks
But How do i make it that the player needs 50 strenght before they obj How do i make so that the player needs 50 strenght and if they are under 50 strenght they cant wear it? |
Basically like how it was shown before but just modified.
Wear() Just added the line a bit above src.worn = 1 |
k
Now on these lines i have else 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? |
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? |
if(usr.Strength < 50 && usr.Mentality < 50 && usr.Dexterity < 50) |
here
Wear() Is that helpful |
I suggest you read up on the if proc and the && operator.
Wear() [Edit]: Whoops, had the > operator around the wrong way. :/ ~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() Wear |