ID:155609
 
Why yes, I do ask a lot of questions.

At one point in the game, I store this information:

var/potato = /obj/food

Essentially what I stored was the class path for something. If I wanted to create an obj based off of the type path stored in potato, how would I do that? I tried

var/potato/n = new

But that gets me errors. Any help? Sorry if the question is worded strangely, comment if you need clarification.

edit: One way I've thought about doing it is saying

if(potato == /obj/food) var/obj/food/a = new

But that's not very modular. Usable, but annoying.
Kel
proc
respond(var/mob/kenan)
kenan << "Kel loves orange soda..."


mob
verb
Who_Loves_Orange_Soda()
var/some_type = /Kel
var/V = new some_type()
if (istype(V, /Kel))
var/Kel/K = V
K.respond(src)


100% untested, but that's what my memory says. Give it a whirl.
var/Food = "/obj/Potatoe"

mob/verb/Boopie()
new Food(usr.loc)


Doing var/[whatever] defines a new var, you dont need to define your potato var again since you already defined it. So typically you would just create a new atom with "new /example/example" but since you defined the path in a var you can just replace it with the var.
In response to Turles
That worked, thank you!
In response to Stephen001
Works for making multiple instances pretty well. Thanks.
In response to Stephen001
kenan << "Kel loves orange soda..."

Is it true?