I'm creating a new RPG, but I came across a snag. I wan't to create an object through a verb, then imbue stats into that object via the verb. For example, I would like it to show on the objects name who created it. Any suggestions? All help appriciated.
James
ID:174582
Aug 5 2003, 4:19 pm
|
|
verb/create_obj() What the above does is create a new object (O) and place it in the container (usr). To put it another way, it adds a new object to the player's inventory. The new object's name is alreay set based on the object type (obj/new_obj will have the name "new_obj"). We add the player's to the end of the object's name. Let's look at an example: We defined an object as obj/new_obj Now, a player named "Bob" will use the create_obj verb to make a new object. We slightly modify the verb like this: mob/verb/create_obj() Bob uses the verb. First, a new object of the type /obj/new_obj is created and placed in Bob's inventory. The object's name is already "new_obj". After the item is transferred to Bob's inventory, we add Bob's name onto it. In this case, the new object is now named "new_obj Bob". You can do any variety of things to modify this, such as putting Bob in front, showing possesion (O.name = "[usr.name]'s [O.name]"). Have fun and good luck :) |
In response to Jotdaniel
|
|
One more question. Using it the way you guys have used, I tried several ways to add a verb (Obviously none are succesful because im back :/ ) Could you put a simple verb up here that applies to the object? Thanks again.
James |
In response to SSJ2GohanDBGT
|
|
We need a little more info on what you're doing.
Are you trying to make a verb accessible from the object? If so, then obj/new_obj will work. The object's verb will only be accessible to the player if it's in his/her contents. You can also do this: obj/new_obj The set src in oview(1) means that anyone within 1 tile of the object can use the verb. |
In response to sapphiremagus
|
|
if("Gloves")
src.createitem = "Leather Gloves" var/obj/wearable/O = new(src.contents) var/O.worn = 0 var/O.defense = 0 if(src.blacksmithery < 15) src.random = rand(1,10) if(src.random < 4) src << "You create a crude [src.createitem]!" O.name += "Crude [src.createitem]" O.defense = 3 obj/wearable verb Wear() if(O.worn == 1) src << "You remove the [O.name]!" src.armoradd -= O.defense else if(src.handworn == 1) src << "You cannot wear more than one!" else src.armoradd += O.defense Drop() if(O.worn == 1) src << "Not while its being worn." else O.loc=locate(src.x,src.y+1,src.z) Tells me that I can't put a proc inside of another. I've defined them as this before? :/ Tell me what i'm doing wrong. Thanks James |
In response to SSJ2GohanDBGT
|
|
SSJ2GohanDBGT wrote:
if("Gloves") The problem lies where I marked it. You defined an object and verbs for objects within a proc. That's a no-no. Best thing to do is to pull that line and everything under it back to 0 indention. Just select that line and everything under it (as shown in the post) and hit SHIFT+TAB and it will remove indentation. Do this until the marked line is flush with the left side of the screen. That should get rid of the problem. |
var/obj/object/O = new(usr.contents)
var/N = O.name
O.name = "[usr.name]'s [N]"
Or were you looking for something more complicated?