ID:178391
 
proc/powerupgen()
var/obj/powerup/T = pick(typesof(/obj/powerup - /obj/powerup))
new T(pick(locations1))
world << "Debug : a [T] has been made!"


This is producing:

runtime error: type mismatch
proc name: powerupgen (/proc/powerupgen)
source file: powerups.dm,32
usr: Sariat (/mob/spectator)
src: null
call stack:
powerupgen()
Sariat (/mob/spectator): test()

Line 32 is the var/obj/powerup/T line. And I am calling the proc from a test verb.

Thanks for reading!

-ST
Sariat wrote:
> proc/powerupgen()
> var/obj/powerup/T = pick(typesof(/obj/powerup - /obj/powerup))
>


I have not used typesof() much. However, I believe it returns a list. The purpose of the subtraction is to remove the base type from that list. Should the subtraction be done outside of the typesof() argument rather than as input?
In response to ACWraith
Acwraith I believe you are correct
var/blahtype/blah = pick(typesof(blahtype)- blahtype)
In response to Exadv1
Something like this may work.


var/list/L = newlist()
L.Add(typesof(/obj/powerup))
L.Remove(/obj/powerup)
var/hahah = input("") in L

and so on..
In response to Super16
Nah, Exadv1 had already helped me, I misplaced a ")". Thanks anyways!