ID:179027
 
I wanted rank to be an obj wich you could hold I was wondering if there was a way to do this what I needed was a way to add an obj to inv once a var has reached a certain number

for instance

obj
ranks
icon = 'ranks.dmi'
cadet_rank4th


icon_state = "cadet4"
New()
if(usr.cp == 1)
usr.inventory += ranks

of course the last line is where im haveing my problem.
if var/cp = 1 I want the ranks obj to be added. is there a simple way to do this?
thanks
Treasurecat wrote:
> obj
> ranks
> icon = 'ranks.dmi'
> cadet_rank4th
>
>
> icon_state = "cadet4"
> New(mob/M)//So you can use a mob in the code
> if(M.cp == 1)
> M.contents += src//ranks wasn't a var using the object's name when trying to add won't help you any
>


There, I'm in a giving mood check your code over ^. Don't expect me to do this alot.
Under where you add to 'cp', call a proc that checks it.
mob
proc
Cp_check(mob/M)
if(M.cp == 2)
new/obj/ranks/cadet(M)


hope i helped.

-Rcet
In response to Rcet
doesnt mob/M stand for any mob but usr?
In response to Treasurecat
No it just defines M as a mob var to use in certain places. It's not built-in anywhere.
In response to Nadrew
thanks however that did not do what I needed

what I have so far

obj
ranks
icon = 'ranks.dmi'
cadet_rank4th


icon_state = "cadet4"
New(mob/M)
if(M.cp == 1)
M.contents += src

my problem could be that its adding the obj but my inventory isnt showing it this is what I have for my inventory.


mob/Stat()

if(src == usr) statpanel("inventory",src.contents)


am I missing something?
In response to Treasurecat
Yes you're never calling the object's New() proc to do that you must create the object:

client/New()
new/obj/somethinghere(src)
In response to Nadrew
Nadrew wrote:
Yes you're never calling the object's New() proc to do that you must create the object:

> client/New()
> new/obj/somethinghere(src)
>


obj
ranks
icon = 'ranks.dmi'
name = "cadet_rank4th"


icon_state = "cadet4"
New(mob/M)
if(M.cp == 1)
M.contents += src

I thought this code did create the object??


mob/Stat()

if(src == usr) statpanel("inventory",src.contents)

client/New()
new/obj/ranks(src)

I wasnt to shoure where to put this I put it under stat because thats where I think my problem is but that didnt work so this is what should be happening

an object is created called cadet rank4th
then a new mob based on that object is created and added to the stat panel inventor if the usr.cp = 1
when I try to run this my world doesnt boot up
so its obvious that I put the client/new in the wrong place you also mentioned something about putting a code where the usr.cp gets increased to = 1 do I put the entire object there?

thanks for the help :)

In response to Treasurecat
I think I have all the code I would need to acomplish this I just am a little confused about where to put everything also I havent got a grasp on the inventory Idea is what keeps track of what the usr has? I looked for something in reference that would deal with this but couldnt find it please help
In response to Treasurecat
I think ive got it now

thanks