ID:167783
 
Is it possible to define an atom like mob, obj, and turf? If this is possible, can you explain how i would do this?
Well sure.


mob
player
icon = 'player.dmi'
turf
grass
icon = 'grass.dmi'
obj
rock
icon = 'rock.dmi'


Not sure if that's what you mean, please be more specific.


-Doh
In response to XxDohxX
He probably means creating a new atomic path type that can be on the map, but act differently than the existing ones. You can't do that, but tell us what you want to do, because you probably won't need to do anything like that.

~~> Unknown Person
In response to Unknown Person
I want to make something that works like an object, but can't be picked up by the "Get" verb. Here's my Get verb:

mob/verb/
Get(mob/M as mob in view(0), obj/O as obj in oview(1))
if(O.loc==usr.contents)
usr << "You can't get your own stuff! What were you thinking?"
else if(O.loc!=usr.contents)
usr.contents += O


It picks up any object that's under you. The only problem is, in order to make something "un-getable", I have to set them to turfs or mobs, and I don't want to do that. (Don't ask me what the mob/M as mob in view(0) part is for, I didn't code it, my brother did.)
In response to KirbyRules
Eum, instead of the if(O.loc==usr.contents), use
mob/verb/Get()
set src in usr
In response to Mysame
Mysame wrote:
Eum, instead of the if(O.loc==usr.contents), use
> mob/verb/Get()
> set src in usr


You mean like this?

mob/verb
Get(mob/M as mob in view(0), obj/O as obj in oview(1))
set src in usr
usr.contents += O


I don't want to do that. Why would I want to get an object that's already in my inventory?

Hmm... Could I do something like:

mob/verb
Get(obj/O as obj in oview(1))
if(O.loc != usr.contents)
if(O == /obj/GoldMine)
usr.contents += O
else
usr << "You can't get that."
In response to KirbyRules
Well basically you would want to have sub objects derived from obj.


obj
nongettables
stone
gettables
sword
armor


Then you would just check it's type.

if(istype(O,/obj/nongettables/))
src << "You cannot get this type of item."
return


Using istype() is very helpful. Look it up in the F1 Reference and read up on it. Any questions feel free to post them.

-Doh


EDIT: Fixed my istype() error.
In response to KirbyRules
Who's your brother? Anyway, instead of having a verb for the mob, have a verb for the object.
obj/Weapon/verb/Get()
set src in view(1)-usr //not sure if this will work, it should exclude the usr's contents
usr+=src

In response to CaptFalcon33035
CaptFalcon33035 wrote:
Who's your brother?

My brother is XKirby2.

XxDohxX wrote:
Using istype() is very helpful. Look it up in the F1 Reference and read up on it. Any questions feel free to post them.

Uuuh...When I use istype("typepath"), it says it's an unknown variable type.

Anyway, I did the nongetables thing but instead of using istype() i just did this:

mob/verb
Get(obj/O as obj in oview(1))
if(O.loc != usr.contents)
if(O != /obj/nongetables)
usr.contents += O
else
usr << "You can't get that."
In response to KirbyRules
Thats because you need to use if(istype(O,/obj/nongettables/)) . Sorry about the messup.


-Doh
In response to XxDohxX
Ok...I tryed this:

obj/verb
Get(obj/O as obj in oview(1))
set src in oview(1)
if(O == istype(O,/obj/nongetables/))
usr << "You can't get that."
else
if(O.loc != usr.contents)
usr.contents += O
usr << "You got a/the/an [O]"


But when I try getting a "nongettable" obj, it puts it in my inventory. Then I tryed this:

obj/verb/Get()
set src in view(0)
if(O.loc == usr.contents)
usr.contents += O
usr << "You got a/the/an [O]"

obj/nongetables/Get()
set src in view(0)
usr << "You cant get that."


But I get an error saying "O.loc:undefined var".
In response to KirbyRules
KirbyRules wrote:
Ok...I tryed this:

obj/verb
> Get(obj/O as obj in oview(1))
> set src in oview(1)
> if(O == istype(O,/obj/nongetables/))
> usr << "You can't get that."
> else
> if(O.loc != usr.contents)
> usr.contents += O
> usr << "You got a/the/an [O]"

But when I try getting a "nongettable" obj, it puts it in my inventory.

First of all, your doing this slighly wrong since you've changed the verb to an object verb.

All you need is Get() since you've defined set src in oview(1). Then, when needed to refer to the object, just use src.

Next, you are using istype() a little wrong. istype() checks the first argument to see if it is the type of the second argument. So after all these changes you should come up with something like this:

obj/verb
Get() //Notice I took out what wasn't needed
set src in oview(1)
if(istype(src,/obj/nongetables/)) //Notice the changes
usr << "You can't get that."
else
if(src.loc != usr.contents)
src.Move(usr) //Changed your way of moving the object to the contents
usr << "You got a/the/an [src]"


If you have any questions let me know.

-Doh
In response to XxDohxX
Thanks!