ID:178240
 
mob/var
mutantpowers = newlist(/skill/mutant/invisibility)


How could I make that easier? I tried typesof(), I tried making a global list that generates all of the powers at runtime. I dont want to have to type out all of the powers...
Oh yes, this is a bump :)

Let me explain it more,

I have:
skill/mutant/xrayeyes
skill/mutant/invisibility
skill/mutant/teleport

mob/var
mutantpowers = newlist(/skill/mutant/invisibility)


How would I make all of them show on the usr.mutantpowers list WITHOUT having to put them in all at once? ie:

mob/var
mutantpowers = newlist(/skill/mutant/invisibility,/skill/mutant/ invisibility/,/skill/mutant/teleport)


-ST
Maybe,
mob/proc/AddPowers()
src.mutantpowers.Add(typesof(/skills/mutant))

mob/var/list/mutantpowers = newlist()

mob/mutant/New()
..()
src.AddPowers()
In response to Super16
Super16 wrote:
Maybe,
mob/proc/AddPowers()
src.mutantpowers.Add(typesof(/skills/mutant))

mob/var/list/mutantpowers = newlist()

mob/mutant/New()
..()
src.AddPowers()


Ah, okay, I'll try that.

obj/powers
verb/getpowers()
set src in oview(1)
usr.gettingpowers = 1
usr.powerslist = usr.mutantpowers
mob/proc/AddPowers()
var/I = typesof(/skill/mutant)-/skill/mutant
mutantpowers+=I
mob/New()
..()
src.AddPowers()
mob/var
gettingpowers = 0
powerslist
mutantpowers = newlist()
mob/Stat()
..()
if(src.gettingpowers)
statpanel("Powers",src.powerslist)


Thats not showing anything in the statpanel....

PS- this works for my costume code....but I typed every single last of them in the list....
In response to Sariat
//THIS WORKS!!

mob/var
gettingpowers = 0
powerslist
mutantpowers = newlist(/skill/mutant/invisibility/Invisible)//etc with all the other powers


obj/powers
verb/getpowers()
set src in oview(1)
usr.gettingpowers = 1
usr.powerslist = usr.mutantpowers
mob/Stat()
..()
if(src.gettingpowers)
statpanel("Powers",src.powerslist)

That shows the objects in the statpanel.... now when I do this:
mob/var
gettingpowers = 0
powerslist
mutantpowers = newlist()

obj/powers
verb/getpowers()
set src in oview(1)
usr.gettingpowers = 1
usr.powerslist = usr.mutantpowers
mob/proc/AddPowers()//THIS PROC ADDS THE MUTANT POWERS!!
var/I = typesof(/skill/mutant)-/skill/mutant
mutantpowers+=I

mob/New()
..()
src.AddPowers()

//I MADE A TEST VERB AND IT DOES ADD THE POWERS TO THE SRC.MUTANTPOWERS LIST


mob/Stat()
..()
if(src.gettingpowers)
statpanel("Powers",src.powerslist)//IT WONT SHOW THE POWERS IN THE STATPANEL!



Please tell me why the first one works, and the second was wasn't working. Its easier for me to do the second one.... but it doesnt work!

In response to Sariat
I really have no idea what precisely you're trying to do with which list; it's a jumbled mess to me. You have one that's powerslist, and another is mutantpowers, and an empty newlist() (which is pointless--you can use list() for that).

One important thing: You should create any list you don't want to be shared in New(); otherwise all mobs will have the exact same list.

Lummox JR
In response to Lummox JR
This is what I'm trying to do:


Have a mutant power trainer that lets you select powers from a statpanel, if you dont have them already. But with the second code, it won't show up on the statpanel but the 1st code shows all the powers in the statpanel.

Example:

Super Hobo Man has Teleportation and wants to learn memorize location for his teleportation skill. He goes over to the mutant trainer, uses the getpowers verb and selects memorize location from his statpanel titled "Powers".

I hope that cleared things up.