Clone()
if(usr.power <= 10)
usr<<"Not enough power"
else
new/mob/Npc/clone(locate(rand(1,5),rand(1,5),1))
src = usr
usr.power-=usr.strength/2
usr.strength/=2
usr.defense/=2
This is all I have and it does create a new mob but the mob isnt the same icon as the creater
ID:167176
Apr 18 2006, 12:24 pm
|
|
Apr 18 2006, 12:45 pm
|
|
I would imagine it would go something like this:
|
In response to Crzylme
|
|
its telling me undefined var clone.icon,clone.power etc....
|
In response to IceBlue
|
|
don't just copy and paste it from the forums. but here:
mob/verb/Clone() |
In response to Crzylme
|
|
I copied it and pasted it but it still telling me those are undefined
|
In response to IceBlue
|
|
Did you tab it correctly, taknig out the spaces?
|
In response to Crzylme
|
|
Your problem is actually quite simple, var/mob/NPC/clone is not an actual mob, therefore the game cannoy create a secondary one. Either that or the game its the mob/NPC/clone/clone, the secondary clone may be screwing it up change it to a single letter and try it again.
|
/Clone() I remember not knowing stuff this simple either, I find the help-on file in DreamMaker very useful though. Alot of the terms are common-sense named so by browsing through it you may just find something that appeals to you. I hope this helps, but I also hope you realize that the clone will only appear on the map between world.x 1-5 and world.y 1-5, which is the first group of 25 squares on the map, I fixed it so that the clone appears around the referenced mob. Also, I switched it all to src when referencing the "usr" just in case this was a proc. It's a good idea to get in the habit of not using usr alot, and I'm trying to save you from an attack by Lummox JR. |
In response to Chrisman767
|
|
Chrisman767 wrote:
Your problem is actually quite simple, var/mob/NPC/clone is not an actual mob, therefore the game cannoy create a secondary one. Either that or the game its the mob/NPC/clone/clone, the secondary clone may be screwing it up change it to a single letter and try it again. That is where you are wrong my good sir. It doesn't matter if its one letter or a hundred letters. It'll still some out the same. I have tested it. And it works. the line: var/mob/Npc/clone/clone = new the path is always between "var" and "/varname" |
In response to The Naked Ninja
|
|
The Naked Ninja wrote:
> for(var/v in vars) You also need to remember that some variables should not be copied over (like client or key). ~~> Unknown Person |
In response to Crzylme
|
|
So either his mob is not actually defined anywhere in the code or we missed something.
Have you tried var/mob/N = new/mob/NPC/clone? |
In response to Unknown Person
|
|
I don't believe they are when accessed like that. I'm pretty sure that BYOND has some sort of built-in user protection for something like that.
|
In response to The Naked Ninja
|
|
The Naked Ninja wrote:
I don't believe they are when accessed like that. I'm pretty sure that BYOND has some sort of built-in user protection for something like that. But there isn't any magical protection. You have to prevent those variables that you don't want changed to be copied over yourself. ~~> Unknown Person |
In response to Chrisman767
|
|
Chrisman767 wrote:
So either his mob is not actually defined anywhere in the code or we missed something. Yes. It works the same for me. |
In response to Unknown Person
|
|
What I'm stating is that it doesn't effect predefined variables such as key, ckey, or other related variables that would provide any harm in the process.
What he's doing is cloning the mobile, which is exactly what that function will do, it'll clone everything defined to that mobile, not the client. |
In response to The Naked Ninja
|
|
The Naked Ninja wrote:
What I'm stating is that it doesn't effect predefined variables such as key, ckey, or other related variables that would provide any harm in the process. If you set a clientless mob's key to a logged in player's key, the original player will get disconnected, and connect to the new key, so there is harm. What he's doing is cloning the mobile, which is exactly what that function will do, it'll clone everything defined to that mobile, not the client. Similar to what I mentioned above, if you change another mob's client to your client, then you will start controlling the other mob. I'd also like to add onto my original post that there are some variables that you cannot change, such as type and parent_type. ~~> Unknown Person |
In response to The Naked Ninja
|
|
The Naked Ninja wrote:
I don't believe they are when accessed like that. I'm pretty sure that BYOND has some sort of built-in user protection for something like that. Gads no. In fact just the opposite is true: Changing a key changes the mob assigned to your client, and it's done that way for many reasons. Among them, any time you load a mob from a file it will automatically become your new character. The same behavior applies whether you use the var itself or the vars list. Again, partly that's because of the loading thing above, since that's how Read() works, but also it's because BYOND simply doesn't treat direct var access and vars[] access as different. It thinks they're the exact same thing, which is why vars[] is as useful as it is. Lummox JR |
In response to Unknown Person
|
|
That's funky then, I used the vars list alot in the past for almost the same reasons, and I've never noticed anything other then the developer defined variables (and things like the icon, and the icon_state) transferring over.
It's never logged me out or changed my mob (From what I've noticed at least) when I tried to recreate a copy of myself. |