del src //This is part of the attack verb, not the whole thing
spawn(20)
new/mob/bug(src.loc) //Create a new bug in place of the dead one
Any reasons why it won't work?
PS, the reason I didn't use demos is because I want something simplier. ;)
ID:164028
![]() Jul 21 2007, 6:58 am
|
|
I set up a code where the player kills a monster and after a while, it creates a new one (I used spawn and sleep). The reason I made this code to make it simpler but it seems not to work, here it is:
del src //This is part of the attack verb, not the whole thing Any reasons why it won't work? PS, the reason I didn't use demos is because I want something simplier. ;) |
![]() Jul 21 2007, 7:06 am
|
|
What are you deleting? If src is the bug you're killing, it won't work because the bug doesn't exist when you tell a new bug to be at its location.
|
DadGun wrote:
Ah, I see. Is it possible to still create the mob (bug) at the position? Yes, you could do it two ways: 1. Recommended if you make the bug while the game is running(as in the bug wasn't placed on the map in Dream Maker): var/x2 = src.x 2. Recommended if you put the bug on the map and might be placing other monsters on the map: //this would respawn EVERYTHING in the world that was deleted |
When an object is deleted, all procs which use the object as src are deleted. So the proc you're calling, which refers to your object as src, will stop running the moment it is deleted. (Actually that's more of what I hear than what I know, since I've never fiddled with it much.)
Based on that, there are several possible solutions: mob/monster // Since this proc doesn't belong to any objects, it won't |
I used it and got 1 error and 1 warning dealing with B.
B :warning: variable defined but not used Any reasons why there is errors? |