ID:163610
 
I've posted this before but it's been awhile and I never put what I got before to use. I need to know how to put two icon together and merge them to make one mob. I cannot use a demo for reasons that you'll have to trust me for so I need someone to explain it to me themselves.

Thanks alot!
-moocow696
In response to Foomer (#1)
ok but iv'e already found a way to do that by simply connecting them manually. what I need is(or maybe You already told me and I don't know how to figure it out on my own) I need a way so that when you attack the icon you don't attack either a head or a foot I need you to attack just a body. and when you kill it, both of them are deleted. I don't need a turf or obj. what I'm looking for in an mob that can move around as one object and is also playable by the user.
In response to Moocow696 (#2)
anyone know? did i ask another stupid question for which I am notorious of asking? I'm sorry but I don't have much time left. If he already told me then can you tell me how to use his code to make an mob that can move around and is playable by the user? I've tryed many things within my knowledge but nothing works.
In response to Moocow696 (#3)
you could have them refer to each other using variables, and share variables

What I mean is that have each have a variable called otherpart, and have that = the other part of it. Then, whenever it gets hit, do mob.otherpart.hp = mob.hp, and the same for any other stat that might go down, and do a check like normal. Then when you del it, it might delete the other part as well, but if it doesnt, before you delete it do del(mob.otherpart) then del(mob)
In response to Polantaris (#4)
ok then thats one problem solved but I also need to make it playable. say I want a giant to be playable but he's to big. I don't wanna just play as a legs or just as the head I want to play as a giant.
In response to Moocow696 (#5)
Sorry for the quick double post but.

The code that I was just given does not work. In fact it does nothing different. instead, the person that I kill doesn't get deleted. I also get an error when I put del(mob) or something like that(you didn't say del(mob but you get the picture) does anyone have some code that would work? Or maybe I'm not doing it right.
var/otherpart="otherpart"

Bob
icon='bob.dmi'
otherpart="gregg"

is this right?
In response to Moocow696 (#6)
No, it is not.

otherpart has to equal the other part, literally. For example, when you create the bottom, do something like this:

mob/guybottom/New()
..()
var/mob/guytop/g = new /mob/guytop
src.otherpart = g
g.otherpart = src


You see what I'm doing? I'm setting the otherpart of each mob to the other mob. Not a name, not a path, the actual instance of another mob, then they are linked exactly. If there is any change in stats, for example, an attack.

mob/proc/Attack()
src << "You hit [monster] for [damage] damage!"
monster.hp -= damage
monster.otherpart.hp -= damage
deathcheck()


You see what I'm doing? I'm creating an exact reference of the other mob to the first part. Therefore, if either part receives a hit, both will get it, and you won't have to worry about the wrong one receiving damage. Because they are exact references to each other, you can easily refer between them. If you want part A to move, you can make part B move as well.

mob/proc/Movee()
dir = pick(1,2,4,5,6,8,9,10)
src.otherpart.dir = src.dir
step(src,src.dir)
step(src.otherpart,src.dir


You can easily do anything to the other part of that mob by this method.
In response to Polantaris (#7)
OK, this is helpful to a certain degree. I think I know what your saying now but I'm not quite sure how to apply this to my code in a way that works. For example, if I have two icons called A1 and A2, how can I apply it to them. What I mean is, where in what you gave me do I write to icon or icon_state? Or do I write it somewhere else? Also, How can I make it so that when I login, I am all two or three of those icon. This last sentance also brings up one more problem. How can I make THREE otherparts? I HAVE tryed other things on my own but my general knowledge of coding isn't helping.
In response to Moocow696 (#8)
I'm sorry man but I've tryed to Input your code and everything that you wrote comes up in an error when I try it. Obviously you can't match your post to my code to make I work correctly but is there anything I need to have in that code that would make it work. I'm at a loss because I have tryed many things on my own. Sorry!
In response to Moocow696 (#9)
There are two primary ways (that I know of) to go about creating multi-tiled objects/mobs.

Foomer showed you the first, which is to simply add an overlay on top of the mob in question. This is a simple solution because it's still considered one entity by BYOND so you can still handle movement and interaction like you would with any other single tile mob. The drawbacks to this method are that it's mostly just an "illusion" - the only place you'll be able to right click and get a menu is on the one tile that isn't an overlay. The other drawback is that if you put the overlays too far out (six tiles or more, I believe), they tend to just pop onto the middle of the screen. This happens because they aren't rendered until the mob that's handling the overlays appears on the player's screen a few tiles later. There are ways around the first issue, I don't know of any around the second.

Polantaris went a more direct route. Effectively, he wants you to just create a duplicate of the mob and change its icon to the other icon you want displayed and then just stick 'em together. The code he showed you was to exemplify how you could go about making the two mobs move and get hurt together.

I'm not going to post any code because they've both already been posted before. If you still don't understand the concepts behind those methods, I recommend you go read up on overlays. I'm also a little curious as to why you can't use demos - there are two or three that have working examples of what you want.
In response to Evre (#10)
Evre wrote:
Foomer showed you the first, which is to simply add an overlay on top of the mob in question. This is a simple solution because it's still considered one entity by BYOND so you can still handle movement and interaction like you would with any other single tile mob. The drawbacks to this method are that it's mostly just an "illusion" - the only place you'll be able to right click and get a menu is on the one tile that isn't an overlay. The other drawback is that if you put the overlays too far out (six tiles or more, I believe), they tend to just pop onto the middle of the screen. This happens because they aren't rendered until the mob that's handling the overlays appears on the player's screen a few tiles later. There are ways around the first issue, I don't know of any around the second.

Just some corrections, you CAN right-click on objects that are "extended" with overlays anywhere where there's an overlay beneath the mouse cursor, not just on the main tile. And there is a 1-turf border around the game's view area that gets loaded but isn't readily seen, which means that you can only have objects 96x96, or 3x3 tiles, before they start "popping" onto the screen. However, they'll tend to pop onto the screen anyway if you're using opacity in any way.
In response to Evre (#10)
Evre wrote:
I'm not going to post any code because they've both already been posted before. If you still don't understand the concepts behind those methods, I recommend you go read up on overlays. I'm also a little curious as to why you can't use demos - there are two or three that have working examples of what you want.

About the fact that I can't use demos its just because I have some parental controls on my internet. It allows me to talk on the forums but for some odd reason it won't let me view the demos.