ID:169071
 
Sorry for the no text if u read this before.
Okay, I know about istype(), and all that stuff, but i have a problem.

Okay, in my game, Im trying to make it so that u cant equip certain things, if you dont have the right ship. Conviently, I have a variable, called oldship, that has your current ship type recorded (for other stuff). So I do

if(!istype(src.design,usr.oldship)) in the equip command. Then a "You cannot equip this" blah blah blah because src.design is not the type of usr.oldship! then a return command. otherwise, it goes on as normal. (design = the type of ship u need to be, to be able to equip the item, in this case, design = /mob/ships/Fighters/Red and oldship = /mob/ships/Fighters/Red/Lvl3)

But it doesnt work. I get "You cannot equip" blah blah blah. as if either src.design or usr.oldship werent the same class -_-. If you need a more detailed explanation using the code that i use, then here:

            proc
Equip()
if(!istype(src.design,usr.oldship))
usr << "Your ship is not the correct design for this equipment!"
return
//rest of equip stuff


hopefully, that helps. Thanks for anyone that can give me help!

*EDIT* I've done this about 100 different ways, please tell me of potential ways that i can do =/
Dude, your posts empy :D

EDIT
Now its not.
Nice body there. :|

istype(src,/datum) - look it up

-Ryan
In response to Ry4n
Ry4n wrote:
Nice body there. :|

istype(src,/datum) - look it up

-Ryan

Please, re read it, I accidentally left it out, and I know about istype, just read my problem.
In response to Polantaris
Wait, so you're checking to see if usr.oldship and src.design are equal(or not equal)? Why not use the <> operator?
(or im missing something)
In response to Nukes4U
Im trying to see if usr.oldship is in the same class as src.design (if i remember correctly, thats what istype should do)

ex: src.design = /mob/Items
usr.oldship = /mob/Items/Item2

if what i remember correctly is true, then that should make istype output 1(true)

except, its not.

*EDIT*
See if i check EXACTLY by what they are, then I would have to make 1 variable for EVERY ship that can use that design. Which means if there are 10000000 ships that can use that design, i will have to make 10000000 variables for it, which would be VERY VERY aggrivating! That is why I wish to do istype, if it still works the way i seem to remember, to check the CLASS of the ship, using only 1 varaible and not 10000000.
In response to Polantaris
Why would you need to make more than one statement? The dynamicness lies in src and usr, not istype.
(at least i dont think)
In response to Nukes4U
Because, if I did if(src.design == usr.oldship) that would make src.design AND usr.oldship both had to be /mob/ships/Fighters/Red/Lvl1 or something along those lines, that means, id have to do 1 version of src.design, as well as an if statement (Hah, Missed that one before XD) for every version of the ship so that i check every possibility that you could have the correct ship for it. If I have 5 million Red Ships and they call all equip Red Hull 1, then i need 5 million versions of the varaible design, one for each design of ship, and 5 million if statements, one for each check that design5million = usr.oldship. Thats why I was sure that istype = what i thought it did.
In response to Polantaris
Ah, i see what you're trying to do now, sorry for before :P
In response to Nukes4U
No problem, so can anyone help? I've given up, because i've done it, what feels like, a hundred million times, and I'm getting sick of redoing a code thats not working! so if anyone has a solution (without being an ass about it because it is "so simple" to you) please help.

The above comment is because I've run into problems like this before and some random person calls me a moron because it was SOOOOO easy for him...ahem, im getting off topic.

Please help =)
In response to Polantaris
If I understand you correctly you're sending two type paths to istype(), but the first argument is supposed to be an instantiated object. You can use ispath() with two arguments to check if a type path is derived from another type path, though. =)
In response to YMIHere
AHHHHH Ill try that! Thanks!

Yes! It works! Thanks a lot! I never knew about ispath() before, so Thank you VERY VERY much =)
Try istype(usr.oldship,src.design) instead. :P
In response to Xooxer
Yeah, we've established it already, thanks anyway! =) if you were 5 min earlier (or however long ago that was) we wouldnt have had this big thread =P Thanks anyway, Xooxer =)