ID:156124
 
welli have basically got what i wanted out of a clone but instead of making one clone at a time i want to make about 5 but if u show me how i can make 2 then i could work the rest out i had wack at it just could seem to work it out this was that best i came up with

mob
TwinClones
New()
flick('Clone.dmi',usr)
verb
FiveClone()
if(Chakra >= 10)
var/mob/Clone/m=new/mob/Clone
m.overlays+=usr.overlays
m.underlays+=usr.underlays
m.Move(get_step(usr,NORTH))
usr.DamageChakra(10)
walk_to(m,usr,1)
m.overlays+=usr.overlays // i thouge that doing it again but summoned in the "SOUTH" direction it would work but it didn't any help plz
m.underlays+=usr.underlays
m.Move(get_step(usr,SOUTH))
usr.DamageChakra(10)
walk_to(m,usr,1)
else
ChakraAlert()
Overlays is not how you should do it..
mob/verb
Clone()
var/mob/Clone/A = new/mob/Clone
A.loc=usr.loc
A.icon=usr.icon
A.icon_state=usr.icon_state
A.y-=1 // To the south of you, like you wanted
Five_Clones()
var/mob/Clone/A = new/mob/Clone
A.loc=usr.loc
A.icon=usr.icon
A.icon_state=usr.icon_state
A.y-=1 // To the south of you, like you wanted
var/mob/Clone/B = new/mob/Clone
B.loc=usr.loc
B.icon=usr.icon
B.icon_state=usr.icon_state
B.x-=1 // To the west of you
var/mob/Clone/C = new/mob/Clone
C.loc=usr.loc
C.icon=usr.icon
C.icon_state=usr.icon_state
C.x+=1 // To the east of you
var/mob/Clone/D = new/mob/Clone
D.loc=usr.loc
D.icon=usr.icon
D.icon_state=usr.icon_state
D.y+=1 // To the north of you
var/mob/Clone/E = new/mob/Clone
E.loc=usr.loc
E.icon=usr.icon
E.icon_state=usr.icon_state
E.y+=2 // 2 spots north of you
mob
Clone
icon='Icons.dmi'
icon_state="Clone"
density=1
//Clone movement and attacking, etc here NOT in the verb

Hope that helps!
In response to Xyphon101
Repeatable code is NEVER a sign of a good way to program something. Use loops. Or, if anything, a proc to assign all the variables.
In response to Emasym
thxs so much man that is a lot of help
In response to Xyphon101
overlays is actually needed so the clones are actually real clones..
In response to Jezblud
Jezblud wrote:
overlays is actually needed so the clones are actually real clones..
What? No, I made it so the icon_state=usr.icon_state and the icon=usr.icon, which is the same thing as an overlay, except better.
Emasym wrote:
Repeatable code is NEVER a sign of a good way to program something. Use loops. Or, if anything, a proc to assign all the variables.

Sure, it wasn't the greatest thing I've coded but it works and that's all he's asking for.
In response to Jamesy577
also is there a way for like you clones to be density 0 to you and descity 1 to every one else
In response to Xyphon101
"It works" is NEVER a good argument.

Yes, I like typing sentences like these.
In response to Emasym
Emasym wrote:
"It works" is NEVER a good argument.

Yes, I like typing sentences like these.
Then why don't you help him instead of criticizing people who do?
Please, go right ahead, I couldn't care less, but as I see it I'm providing him usable code and you're not, so I don't believe you have a right to criticize me.

And, "it works" IS a good argument. If it works, and works well, it doesn't matter efficiency.. Because it's already finished, and it works. Now, if it wasn't working to its fullest ability, that would be a different problem altogether.
In response to Xyphon101
Emasym he kinda owned you, because the last time i check this was a how to do forum not a how to bitch one.
In response to Jamesy577
eah any how would i go about getting to clone to move out of the way as there priotity to there following
i change the coding so that they follow also how would shorten it this is where i ot to

mob
verb
Clones()
if(Chakra >= 10)
var/mob/Clone/A = new/mob/Clone
var/mob/Clone/B = new/mob/Clone
var/mob/Clone/C = new/mob/Clone
var/mob/Clone/D = new/mob/Clone
A/B/C/D.loc=usr.loc
A/B/C/D.icon=usr.icon
A/B/C/D.icon_state=usr.icon_state
A.y-=2 // To the south of you, like you wanted
walk_to(A,usr,2)
B.x-=2 // To the west of you
walk_to(B,usr,2)
C.x+=2 // To the east of you
walk_to(C,usr,2)
D.y+=2 // To the north of you
walk_to(D,usr,2)
usr.DamageChakra(-10)
else
ChakraAlert()
mob
Clone
New()
flick('Clone.dmi',usr)
density = 1

and i hav stoped northeast northwest southeast southwest so at the moment i can't move when i make them
In response to Xyphon101
And, "it works" IS a good argument. If it works, and works well, it doesn't matter efficiency.. Because it's already finished, and it works.

Tiberath has posted an excellent article on exactly this kind of behaviour.

http://www.byond.com/members/ DreamMakers?command=view_post&post=95390

And on your comment of me "not helping", better helpful comments than sloppy code.
In response to Emasym
okay then to be fair tht post is right but i wont say i am smart because i am genrally not some of the coding goes over my haed but i am willing to learn i would perther to learn the right way. But if the wrong way work the way i want it to that i couldn'n really care less in the long right i understand his articale is right but if cocacola and pepsi where in a shop and cocacola was a £1.50 and pepsi was a £1 (you don't have to be in GB to know witch one is the better chiose) i would buy the pepsi because frankly they taste the same to me.
In response to Emasym
Emasym wrote:
And, "it works" IS a good argument. If it works, and works well, it doesn't matter efficiency.. Because it's already finished, and it works.

Tiberath has posted an excellent article on exactly this kind of behaviour.

http://www.byond.com/members/ DreamMakers?command=view_post&post=95390

And on your comment of me "not helping", better helpful comments than sloppy code.
Not true, I am at least attempting to help while you are just insulting my attempts. Despite it being sloppy, it's still helpful, but he clearly does not know much about coding if he is asking such a basic question so telling him "You should do a loop or yadayadayada" will most likely not help him at all.

Again, if you want to help him with his loops or what have you, be my guest, but please don't interrupt peoples helping to provide information completely useless to them, and in the end not helping anyone at all.

On the article, I never said it works, so it must be right, I clearly said it works, so there's no use changing it anymore. If you can tell me a flaw that will seriously hinder how his game works, then please, go right ahead, but right now you've failed to do so. That article falls under the category of when you refuse to listen, and in the end it will effect the game negatively.

To my knowledge, making a loop does not make a difference. It just makes it easier to seep through and looks nicer, as well as lowering the space it takes up. However, a loop still must process for each of them, so in the end it is doing the same thing.

I think you've obtained the mentality that just because someone states that "it works, so why change it", that they don't know how to program. Unfortunately, that is not necessarily always the case. For me, I've never gone in depth as to the "right" or "wrong" ways, but I still know how to generally do most things and it DOES work, with little to no lag and no problems aside from possible unknown ones. Mainly this is because for a lot of people, they just code as soon as something pops to their head and they don't plan it all out. Admittedly, this is a flaw, but I'm not going back to change all of my coding at this stage in the game.

I have this flaw with many other things, specifically PHP. As I've been programming PHP for 3 years now, and I can create generally anything in it(with some trouble at certain times, of course, but not likely), and I always seem to lengthen things beyond their need. Now, with PHP I've gotten a lot better at this and I normally don't have this happen any more, but with DM I haven't been programming for as long, so my scripts are still unnecessarily long.

Sorry, I went off on a tangent a bit. The bottom line is, although it is not the prettiest looking, it still works, and I am at least attempting to help him. If I saw someone attempting to help someone and they weren't doing it "correctly"(or perfectly, would be a better word), I would at least provide them with the "correct"(or perfect) code, which you have failed to do.
In response to Xyphon101
To my knowledge, making a loop does not make a difference. It just makes it easier to seep through and looks nicer, as well as lowering the space it takes up. However, a loop still must process for each of them, so in the end it is doing the same thing.

proc/constant_save(){
for(var/client/C) {C.Save();}
sleep(600);
for(var/client/C) {C.Save();}
sleep(600);
// ...
for(var/client/C) {C.Save();}
}


You have admitted it's a flaw, so we have a term of agreement, but you saying the information provided isn't helpful is bogus. If you have been programming in PHP for 3 years, you should be able to accept that, no matter how proud of your code you are, if there's a better method you should employ it. Programming isn't an ego-thing.

And I'd rather not provide people with "the" "correct" code, as you call it, because there is no such thing, and because this is Developer How-To, not Developer GimmeSnippets.
In response to Emasym
Oh no no, I knew exactly how to implement it myself, but you aren't helping him at all by telling him to use a loop when he's asking how to make 2 mobs appear, because clearly he doesn't know the essence of what you are saying if he has not delved too far into coding.

And yes, I know it is ideal to implement it, but I just don't have the time to sort everything out, or moreover, I'm just sort of lazy.