ID:157768
Jan 3 2010, 3:50 pm
|
|
How can I make it to where if someone picks up an obj, shortly later another one will spawn where the old one was?
|
In response to Garthor
|
|
I was working on an example and I ended up converting it to use Garthors suggestion because it reduced my own code by a couple of lines. :)
ObjectSpawnExample ts |
In response to Tsfreaks
|
|
Thanks so much. I think that should work, but of course I'll have to go try it. Looking at that resource also should be good, so I can know how to adjust it to my needs.
I am new to DM... ok I'm not but never really did much with it. I am working on my currently biggest project. Before this I had tried many things. First of all i thought the World Repop was the problem, but then I realized that until it was deleted completetly without anyone having it, it wouldnt respawn. So what i did was change the Get verb to the individual objects and had them make a copy of themselves to your inventory and delete the old one, so the Repop would create it again. But it caused them to not be able to be equipped (which i still dunno why). Now I got to remember to put it back the way it was so I can try this. Thanks for the help. I will get back to you if this doesn't work for some reason. |
In response to KSDT
|
|
Thanx!It works fine! Just a small delay with it being added to your inventory but thats no problem.
|
In response to Tsfreaks
|
|
Make a hub for those things, it's a pain to download, save as, extract, and then run D:
|
In response to Ruben7
|
|
lol... sorry to put you through so much work.
|
In response to Tsfreaks
|
|
Uh oh didn't work! (Im same guy different acc)
Its not letting me equip the stuff still! |
In response to Garthor
|
|
obj That's what I'm doing, and of course I have the stuff you gave me... Is there a problem in that? (Yes, the notes are from an object rescource I built off of.) obj Uh oh, I think this is turning into a coding problem :( |
In response to ZKR
|
|
You really shouldn't need to be copy-pasting Use() over and over again. They're almost all exactly the same, so just provide that functionality in the base obj/items/Use().
Anyway, one issue is that you are deleting src in Get(), which you shouldn't be. After all, src is what you just moved to the player's contents. Speaking of which, the other issue is that loc is going to be the player now, after you've moved it, so store the current location in some variable, attempt to move it to the player, and if the move succeeds then call Proc_SpawnObject() for the old location. Also note that a player can pick up and drop the same item multiple times to essentially clone it. You might want to have some variable which says whether or not it's been picked up or not, and only create a replacement if it hasn't been. |
In response to Garthor
|
|
Garthor wrote:
You really shouldn't need to be copy-pasting Use() over and over again. They're almost all exactly the same, so just provide that functionality in the base obj/items/Use(). ok as you can tell I'm horrible with code so let me try to figure this out... Ok, so I shouldnt del the src... done. Store the current location in some variable... OH! I think I get it... obj That's that... test it so far... Done, and it worked! I kinda guessed on the coding >_> Now I can see what you meant on cloning it... but then I noticed it didnt clone after I fixed it... Wait, lemme check something... AH, I see... you drop it then after a while it comes back... obj Kinda like that? Testing... HAHA it worked! ^^ Actually that was the third revision up there o.O I kept messing up! I dunno if thats what you meant but hey it works. It started working with the last advice but stopped all of a sudden so I'll come back to you all if it starts screwing up again. You've been all great help! P.S. Is that what you meant? Cause I basically took knoledge and examinations from other things I have done or other sources I have seen to put the puzzle together XD |
In response to ZKR
|
|
That's exactly what I meant. You may wish to name the variable something more informative than "Q", though.
|
In response to Garthor
|
|
Ok, I got another problem stringing from this.
Yeah, I know it's a late reply, I didn't really work on the game lately. mob The item goes into the inventory completely fine, but it isn't able to be equipped. I am still using the same coding string as from the post above. Can anyone help? |
In response to KSDT
|
|
That has nothing to do with this thread.
|
Call this with the appropriate arguments (where the object was, its type, and how long to wait before creating a new one) when you pick up the object.
It's important that this is a global proc, separate from the object being picked up. Otherwise the object being deleted before replacement would prevent it from being replaced.