ID:263215
 
Code:
        rock
icon_state = "3"
MouseDrag()
MouseDrop(obj/branch)
var/X = new/obj/hammer
usr.contents.Add(X)
del(branch)
del(src)
mouse_drag_pointer = "3"


Problem description: I got the main objective to work, it deletes the two objects and creates the new one in my inventory. However, it works on any object; Ex1: Rock+Branch = Hammer (This is what I want); Ex2: Rock+Herb = Hammer (It does this too, and I don't want it to) Every item works for the combo, how do I get it to work only when you drop a rock on a branch and not anything else? I've checked all the nice little demos (theres only 1 btw) and experimented with several different formats to try and filter only the two objects but nothing works, what am I doing wrong?

        rock
icon_state = "3"
MouseDrag()
MouseDrop(obj/branch/A)
var/X = new/obj/hammer
usr.contents.Add(X)
del(A)
del(src)
mouse_drag_pointer = "3"
In response to Seasons..
That will only give you an error stating:

Error:A:Undefined Type:A

and don't try:

        rock
icon_state = "3"
MouseDrag()
MouseDrop(/obj/branch/A)
var/X = new/obj/hammer
usr.contents.Add(X)
del(A)
del(src)
mouse_drag_pointer = "3"


That will just give you and "Undefined Var" Error
In response to Vahn_Moon
Make sure the obj "branch" is defined somewhere.
In response to Seasons..
lol sorry forgot heres the code for it:

obj
icon = 'combo.dmi'
stuff
rock
icon_state = "3"
MouseDrag()
MouseDrop(obj/stuff/branch/A)
var/X = new/obj/hammer
usr.contents.Add(X)
del(A)
del(src)
mouse_drag_pointer = "3"
herb
icon_state = "5"
branch
icon_state = "4"
hammer
icon_state = "7"


Even after applying those changes, it still works on any item under stuff....
In response to Vahn_Moon
obj
icon = 'combo.dmi'
stuff
rock
icon_state = "3"
MouseDrag()
MouseDrop(obj/A)
if(istype(A, /obj/stuff/branch))
var/X = new /obj/hammer
usr.contents.Add(X)
del(A)
del(src)
mouse_drag_pointer = "3"
herb
icon_state = "5"
branch
icon_state = "4"

hammer
icon_state = "7"
In response to Vahn_Moon
You're not checking the type of the object sent. Don't assume that just because you define it as a branch, that that's all it will send you:

obj
icon = 'combo.dmi'
stuff
rock
icon_state = "3"
MouseDrag()
MouseDrop(obj/stuff/branch/A)
if(istype(A,/obj/stuff/branch)) //If A is a branch (Could also use if(istype(A)), where it checks what you defined the variable as)
new/obj/hammer(usr) //No need to define that variable if you aren't going to do anything with it. Also, by passing "usr" with new(), it will create the hammer inside the usr.
del(A)
del(src)
mouse_drag_pointer = "3"

In response to DarkCampainger
Umm... why hasn't anyone pointed out asking 'why is there MouseDrag() if it's not being used'?

- GhostAnime
In response to DarkCampainger
Perfect, thanx.

Now I see what I did wrong.... lol

I had tried the if(istype()) but I forgot to set as A and place A, with the istype.... my bad.
In response to GhostAnime
if your not going to help don't comment, if you have a comment that might be helpful don't talk about someone in the process.... just state your helpfull comment.
In response to Vahn_Moon
He did help. You're blatantly unknowing of which he is talking about.