1
2
ID:180343
Jul 18 2001, 12:39 pm
|
|
To make items start out in your inventory when you log on, what command do I use to do this?
|
In response to Vortezz
|
|
mob switch(i) if("Spy") icon = 'spy.dmi' if("Terrorist") icon = 'terrorist.dmi' if("Soldier") icon = 'soldier.dmi' how would I add usr.contents onto this? under "Spy" I want them to start with a obj in the inventory(stats) not sure on how to add this, I tried like: switch(i) if("spy") icon = 'spy.dmi' usr.contents and: if("spy") usr.contents ... Is there any examples i could use? |
In response to Oblivian
|
|
I've uploaded a demo, but the project files aren't there.. Lemme go see if I can get that to work and I'll lead you that way.
|
In response to Vortezz
|
|
Alright
|
In response to Oblivian
|
|
On 7/18/01 3:59 pm Oblivian wrote:
Alright It's up! Go check it out under Demos! :) Add the usr.contents += theobject under the selection dealie.. |
In response to Vortezz
|
|
On 7/18/01 3:41 pm Vortezz wrote:
On 7/18/01 3:39 pm Oblivian wrote: Almost, Vortezz. You need to create an instance of it first: mob Login() var/A = new obj/monkey(usr) usr.contents += A I think that should work (not too sure). |
In response to Cinnom
|
|
On 7/18/01 4:00 pm Cinnom wrote:
On 7/18/01 3:41 pm Vortezz wrote: Yeah, I think that'd work. LOL, you decided to use a monkey? LOL! |
In response to Vortezz
|
|
On 7/18/01 4:03 pm Vortezz wrote:
var/A = new obj/monkey(usr) Well, it was going to be either 'cheese','monkey', or both. |
In response to Cinnom
|
|
On 7/18/01 4:06 pm Cinnom wrote:
On 7/18/01 4:03 pm Vortezz wrote: Cheesemonkey. LOL. My demo's up. I'm gonna start work on a project about the Humans, Gorans, Nitoks, and Slimres. I've already got some ideas brewing up here. ^ |
In response to Vortezz
|
|
Ok, thanx for the help.. the Demo helped alot :)
|
In response to Vortezz
|
|
On 7/18/01 4:09 pm Vortezz wrote:
On 7/18/01 4:06 pm Cinnom wrote: Nice, wish you the best of luck :). |
In response to Vortezz
|
|
On 7/18/01 4:00 pm Vortezz wrote:
On 7/18/01 3:59 pm Oblivian wrote: When adding an object to the users inventory, all you have to do use is one simple command, called new(). contents doesn't need to be changed since it refers to any object inside the atom neways. So, if you wanted to add an object to the players inventory on login, all you would have to do is this: mob/Login() ..() new/obj/blahblahblah(src) new allows you to specify a location when creating the new atom, so you can just put src in and it creates the object inside src, which is the player. Basically, the only thing you will ever use contents for is to find out what the player has, not add more stuff to what player has. For instance: mob/verb/Inventory() usr << "You are holding :" for(var/obj/o in usr.contents) usr << o.name To make it even simpler, you dont even have to say usr.contents. mob/verb/Inventory() usr << "You are holding :" for(var/obj/o in usr) usr << o So their aren't many, if any, situations where you would have to use the contents variable. |
In response to Ebonshadow
|
|
Well heres what I have done..
I created an object: obj/knives knife attack = 5 description = "This is a normal two handed sword! Attack = 5" locname = /obj/knives/knife typew = "weapon" then in the main dm file under Login() I put.. if("Spy") icon = 'spy.dmi' usr << "You have choosen to play as a Spy." usr << "The spy is a stealthy character, which has special items to sneak up on people." /obj/knives/knife I run the game, I guess its in my inventory? How do I get it to show up on a statpanel though? |
In response to Oblivian
|
|
On 7/18/01 5:07 pm Oblivian wrote:
Well heres what I have done.. Use usr.contents as the variable data... mob/Stat() statpanel("Inventory",usr.contents) |
In response to Oblivian
|
|
On 7/18/01 5:07 pm Oblivian wrote:
Well heres what I have done.. Remember to put new() in there. It should be : new/obj/knives/knife(src), src is the location and /obj/knives/knife is the type of object to create. To make it so the player sees all the items he owns inside a statpanel, first do some reading on Stat() proc. In the example for that proc, it shows you how to make it stat the user's inventory. Basically, this is all you would have to do: mob/Stat() stat(src.contents) Simple eh? =) |
In response to Vortezz
|
|
On 7/18/01 5:10 pm Vortezz wrote:
Use usr.contents as the variable data... NOOOO...this is yet more "evil usr" stuff creeping in and will likely result in subtle bugs. NEVER EVER use usr except in a verb, and then only if you really have to, because if it's not a verb, then you don't actually know what the value of usr is. It could be a random player. In all non-verb cases, use src to mean "the current object". |
In response to Deadron
|
|
On 7/18/01 5:14 pm Deadron wrote:
On 7/18/01 5:10 pm Vortezz wrote: Ack, sorry Deadron.. I always was confused on what to use. So src in all non-verbs, eh? |
In response to Deadron
|
|
On 7/18/01 5:14 pm Deadron wrote:
On 7/18/01 5:10 pm Vortezz wrote: I normally do but I didn't think that in Stat(), src could be anything other than the usr. I have never ran into a situation where the usr in Stat() wasn't also src. |
In response to Ebonshadow
|
|
Remember to put new() in there. It should be : new/obj/knives/knife(src), src is the location and /obj/knives/knife is the type of object to create.
To make it so the player sees all the items he owns inside a statpanel, first do some reading on Stat() proc. In the example for that proc, it shows you how to make it stat the user's inventory. Basically, this is all you would have to do: I did both of those things... and i get an error : gumbatarena.dm:33:error:/new/obj/knives/knife:bad path |
1
2
mob
Login()
usr.contents += blah
I beleive..