ID:150594
 
Yo, Ive been messing with a multi-tile demo I found aggeeees ago, but I keep getting one error I cant track down.. the demo itself goes about using multiple tiles as one mob, but it tends to be rather complex, seing as how its a 2x2 tile mob, and the coder goes through a while pile of calculations to check for density...

Im not gonna bother asking for the fix for my error, instead Im gonna ask for a peice of code I know how to go about doing it, my coding skills just arent 1337 enough to do it *L*

So what I want, is a way to get a non dense mob to stay above a dense one . Id also, if at allpossible like the head to be displayed on a higher layer then the body, or of mobs around it... All verbs and whatnot should be applied to the body, so in essence all the head does is sit there ^^

I know I sound like a stupid lamer.. but Im -really- stumped. Even if you just point me in the right direction, maybe I could code it myself ^^

Thanks in advance! ^-^

Elorien, supan00b
Elorien wrote:
Yo, Ive been messing with a multi-tile demo I found aggeeees ago, but I keep getting one error I cant track down.. the demo itself goes about using multiple tiles as one mob, but it tends to be rather complex, seing as how its a 2x2 tile mob, and the coder goes through a while pile of calculations to check for density...

Im not gonna bother asking for the fix for my error, instead Im gonna ask for a peice of code I know how to go about doing it, my coding skills just arent 1337 enough to do it *L*

So what I want, is a way to get a non dense mob <the head> to stay above a dense one <the body>. Id also, if at allpossible like the head to be displayed on a higher layer then the body, or of mobs around it... All verbs and whatnot should be applied to the body, so in essence all the head does is sit there ^^

I know I sound like a stupid lamer.. but Im -really- stumped. Even if you just point me in the right direction, maybe I could code it myself ^^

Thanks in advance! ^-^

Elorien, supan00b
Same theory as a turret sitting atop a tank ;) The head doesn't even have to be non-dense.
  • Make the head's layer 4.5, so it appears above the body.
  • Make a /mob/head/Head variable on the body, that is a reference to the it's head.
  • In the body New() proc, create a new head and assign it to the body's Head variable.
  • In the body's Move() code, make sure to add the line:
    Head.loc = loc
    near the end to keep the head on top of the body (unless beheading is a game feature ;)
  • Any time the body verbs act on the head, simply reference the Head var. For example:
    mob/body/verb/shakehead()
    for(var/loop = 0, loop <3, loop++) //shake the head three times
    Head.dir = turn(dir,-45) // turn the head 45 deg left of the body direction
    sleep() // pause briefly
    Head.dir = dir // face forward
    sleep()
    Head.dir = turn(dir,45) // turn the head 45 deg right
    sleep() // pause briefly
    Head.dir = dir // face forward
    sleep()

Also, avoid using < and > in the BYOND forum. The forum thinks they mark HTML tags and readers can see what is inside them. Parenthesis () work nicely however. ;)
In response to Shadowdarke
oh ^^ sorry, I didnt know that.. Im just so used to using them..

Anyways, I think -part- of what I was trying to ask got screwed up with teh way I asked it. ^^;;;


By above, I meant 'one tile to the north' @.@ *L* I know, I should think about what Im trying to say before I say it..

*pauses to watch the cat go nuts for no apparent reason*

Uhm..


I know its absurdly simple to do.. Im just not sure of the commands to do it x.x;;;

oh well ^^

Thanks for your post again tho Shadowdarke ^___^

Elorien
In response to Elorien
Elorien wrote:
Anyways, I think -part- of what I was trying to ask got screwed up with teh way I asked it. ^^;;;

By above, I meant 'one tile to the north' @.@ *L* I know, I should think about what Im trying to say before I say it..

The only difference would be in the Move() proc. You would want to change it to

Head.loc = locate(x,y+1,z)

Note that if you walk to the top edge of the map using this, you're head will disappear until you walk away from the edge. It would be a good idea to make the head non-dense in this scenario.

I recomend leaving the layer at a high setting, so that your head doesn't get stomped by items to the north. You may even want to set it higher than 4.5.

*pauses to watch the cat go nuts for no apparent reason*

Cats can see things that would drive mere humans insane if we could sense them. Just be glad they are here to protect our plane of existence! ;)
In response to Shadowdarke
heheh, thanks a lot! ^_^


Yea, I want the head to be non-dense anyways. think something along the lines of FF3, walk the body up to the wall, the head is still displayed, even if it is on the wall tile, keeping the illusion of the head being -above- the body, rather then just to the north ^^

Thanks a bunch! Now lets see if I can get it to work... this is something that Ive been wanting to get working for awhile ^_^

Elorien

Shadowdarke wrote:
Elorien wrote:
Anyways, I think -part- of what I was trying to ask got screwed up with teh way I asked it. ^^;;;

By above, I meant 'one tile to the north' @.@ *L* I know, I should think about what Im trying to say before I say it..

The only difference would be in the Move() proc. You would want to change it to

Head.loc = locate(x,y+1,z)

Note that if you walk to the top edge of the map using this, you're head will disappear until you walk away from the edge. It would be a good idea to make the head non-dense in this scenario.

I recomend leaving the layer at a high setting, so that your head doesn't get stomped by items to the north. You may even want to set it higher than 4.5.

*pauses to watch the cat go nuts for no apparent reason*

Cats can see things that would drive mere humans insane if we could sense them. Just be glad they are here to protect our plane of existence! ;)
In response to Shadowdarke
Shadowdarke wrote:
Elorien wrote:
Yo, Ive been messing with a multi-tile demo I found aggeeees ago, but I keep getting one error I cant track down.. the demo itself goes about using multiple tiles as one mob, but it tends to be rather complex, seing as how its a 2x2 tile mob, and the coder goes through a while pile of calculations to check for density...

Im not gonna bother asking for the fix for my error, instead Im gonna ask for a peice of code I know how to go about doing it, my coding skills just arent 1337 enough to do it *L*

So what I want, is a way to get a non dense mob <the head> to stay above a dense one <the body>. Id also, if at allpossible like the head to be displayed on a higher layer then the body, or of mobs around it... All verbs and whatnot should be applied to the body, so in essence all the head does is sit there ^^

I know I sound like a stupid lamer.. but Im -really- stumped. Even if you just point me in the right direction, maybe I could code it myself ^^

Thanks in advance! ^-^

Elorien, supan00b

Same theory as a turret sitting atop a tank ;) The head doesn't even have to be non-dense.
  • Make the head's layer 4.5, so it appears above the body.
  • Make a /mob/head/Head variable on the body, that is a reference to the it's head.
  • In the body New() proc, create a new head and assign it to the body's Head variable.
  • In the body's Move() code, make sure to add the line:
    Head.loc = loc
    near the end to keep the head on top of the body (unless beheading is a game feature ;)
  • Any time the body verbs act on the head, simply reference the Head var. For example:
    mob/body/verb/shakehead()
    for(var/loop = 0, loop <3, loop++) //shake the head three times
    Head.dir = turn(dir,-45) // turn the head 45 deg left of the body direction
    sleep() // pause briefly
    Head.dir = dir // face forward
    sleep()
    Head.dir = turn(dir,45) // turn the head 45 deg right
    sleep() // pause briefly
    Head.dir = dir // face forward
    sleep()

Also, avoid using < and > in the BYOND forum. The forum thinks they mark HTML tags and readers can see what is inside them. Parenthesis () work nicely however. ;)


Okay, waitasec here.

Is it possible to do this with an overlay? Setting it up so another mobs -body- can go under the overlay? That help to simplify the verb thing. If I can make the head an overlay which cant be teh target of a verb, then I wont have to bother with describing it to the body ^^;;

Uhm.. and one more question.. this is gonna sound sooo stupid.. but how would you go about setting the head to pop up when a user logs in? I know it has something to do with the new command.. but Im not exactly sure of how to go about it ^^;;;;;

Sorry for being such a pain ;;

Elorien
Elorien wrote:
So what I want, is a way to get a non dense mob <the head> to stay above a dense one <the body>. Id also, if at allpossible like the head to be displayed on a higher layer then the body, or of mobs around it... All verbs and whatnot should be applied to the body, so in essence all the head does is sit there ^^

I'll be releasing a library for all this in the near future. The code started in DragonSnot, has been enhanced a bunch for Living & Dead, and it about to be turned into its own library for Sneak II, at which point I'll also release it publically.
In response to Elorien
Elorien wrote:
Okay, waitasec here.

Is it possible to do this with an overlay? Setting it up so another mobs -body- can go under the overlay? That help to simplify the verb thing. If I can make the head an overlay which cant be teh target of a verb, then I wont have to bother with describing it to the body ^^;;

Uhm.. and one more question.. this is gonna sound sooo stupid.. but how would you go about setting the head to pop up when a user logs in? I know it has something to do with the new command.. but Im not exactly sure of how to go about it ^^;;;;;

Sorry for being such a pain ;;

Elorien

You could use an overlay, but you would have to add and subtract the overlays from turfs each time the mob moves. An overlay will also be stuck on the layer of the item it's attached to, so it might end up underneath objs or mobs in the turf. That is why you need to alter the layer variable of the head mob.

You could use an obj instead of a mob for the head if you wish. That wouldn't really change the theory. You could make it so that whenever someone acts on a head mob, it acts on the head's body. That's how I did it in tanks, if you damage a turret the damage is transfered to the primary body of the tank.

If you create and attach the head in the body's New() proc, it should show up when the mob is created. If you directly set the loc of the body without using Move() the head's loc won't move to match, so anyplace you set the body's loc you should be certain to set the head's loc as well.
In response to Shadowdarke
Ok.. I am, once again, completely and utterly lost.

From what I did understand tho, an obj as the head would prolly work best, cuz it allows mobs to share the same tile as it, as long as you could layer the obj in question so it was -above- the mob.


I dont understand how to implement this.. the faq and f1 doesnt give a good enough example on how to run new(), and my move proc doesnt even compile right, keeps giving me bad var errors *L*

Anychance anyone could write me up a couple of lines of code that could do it? <it could be as simple as you like, I can prolly pick up on how it works fairly quick and adapt it to what I need..

Thanks in advance.. Im slowly learning.. eveyrhting I get running means that Im learning that much more ^^;;;

Elorien
In response to Elorien
Elorien wrote:
I dont understand how to implement this.. the faq and f1 doesnt give a good enough example on how to run new(), and my move proc doesnt even compile right, keeps giving me bad var errors *L*

Anychance anyone could write me up a couple of lines of code that could do it? <it could be as simple as you like, I can prolly pick up on how it works fairly quick and adapt it to what I need..

Here is some code fom a little side project of mine.
mob
player
var
obj/playertop/top // this is the top of the mob
movetimer // used to limit how quickly the player walks

proc
playerstate(T as text) // changes the icon state of the mob and it's top
icon_state = T
top.icon_state = T

playerflick(T as text) // flicks the icon_state of the mob and top
flick(T,src)
flick(T,top)


Move(Loc)
// delay movement
if(world.time < movetimer) return
movetimer = world.time + 5

// do the normal movement routine
. = ..()

playerflick("walk")

// find the space one step north of the mob
var/turf/T = get_step(src,NORTH)
if (T) // if that space exists...
top.loc = T // move the top there
else
top.loc = null // if not, hide the top
playerstate("")

New(Loc)
..() // do normal New() stuff
top = new() // and create a new top when the mob is made


joe // a typical player
icon = 'joe.dmi' // the typical player's icon

New()
..() // do everything you do for another New player mob
top.icon = 'joetop.dmi' // and make the top icon 'joetop.dmi'

obj
playertop // define the playertop obj
density = 0 // other things should pass through it
layer = 5 // draw it above everything else
In response to Shadowdarke
Im really starting to think of just giving up on byond in general x.x;;;; I just suck too much at this..

Thanks for the help ShadowDarke, once again..

Upon making a new dm file to test this, and puting it in (with proper indentation (see, no greater or less then signs this time around XD )) I got no less then 27 errors @.@ oh, and 2 warnings.. *sigh*

Oh well.. thanks again x.x;;; *closes it*

Elorien
In response to Shadowdarke
Hey, that just cleared up all my old, crappy multi-tile code!

Thanks, Shadow! Now, my mobs can have heads separate from their bodies, and I can have Giants!

You never cease to amaze me!
In response to Vortezz
Vortezz wrote:
Hey, that just cleared up all my old, crappy multi-tile code!

Thanks, Shadow! Now, my mobs can have heads separate from their bodies, and I can have Giants!

You never cease to amaze me!

please release it as a library, ill give you a cookie
PLEASE

FIREking
In response to FIREking
FIREking wrote:
Vortezz wrote:
Hey, that just cleared up all my old, crappy multi-tile code!

Thanks, Shadow! Now, my mobs can have heads separate from their bodies, and I can have Giants!

You never cease to amaze me!

please release it as a library, ill give you a cookie
PLEASE

FIREking

Erm... Knowing you, you could probably sort that through. I did, didn't I?

Plus, I wouldn't feel comfortable releasing something that Shadowdarke did as a library and take credit for it. Then again, I could heavily edit it... -gets a bright idea-

...Nah...

Shadowdarke, library it! =)
In response to Vortezz
oh i didnt understand the circumstances, hehe

anyways, i have tried, but i did it in a unefficient way.

im just looking for a library to tie everything together. once i get the multimob thing happening, my game will be in full effect as of what i wanted it to be, well of course, except the grand master spell that i have been working on forever.(when elements collide)
In response to FIREking
FIREking wrote:
oh i didnt understand the circumstances, hehe

anyways, i have tried, but i did it in a unefficient way.

im just looking for a library to tie everything together. once i get the multimob thing happening, my game will be in full effect as of what i wanted it to be, well of course, except the grand master spell that i have been working on forever.(when elements collide)

Oh. Anyhow, here's the code I used, exactly, in a brand new environment.



<code> obj/head density = 0 layer = 5 mob var obj/head/top // this is the top of the mob movetimer // used to limit how quickly the player walks Move(Loc) // delay movement if(world.time < movetimer) return movetimer = world.time + 5 ..() var/turf/T = locate(x,y + 1,z) if(T) top.loc = T else top.loc = null New(Loc) ..() top = new() joe icon = 'body.dmi' New() ..() top.icon = 'head.dmi' turf grass icon = 'grass.dmi' world/mob = /mob/joe world/turf = /turf/grass </code>



There we go, varmint.. I just made the correct icons, and a map, and ran it up. It gave me quite the feeling of joy when it worked!

=)
In response to Elorien
Elorien wrote:
Im really starting to think of just giving up on byond in general x.x;;;; I just suck too much at this..

Thanks for the help ShadowDarke, once again..

Upon making a new dm file to test this, and puting it in (with proper indentation (see, no greater or less then signs this time around XD )) I got no less then 27 errors @.@ oh, and 2 warnings.. *sigh*

Oh well.. thanks again x.x;;; *closes it*

Elorien

Most likely the first error is the one making it think there are others. Fix it, then you can see which ones were just shadows of the first error. I've been known to get 30 or more errors from one simple mistake before.

Tell me the first error, and give me a chunk of code around the error line (usually 2 lines of code (not whitespace) above and below the error line are all you need). We'll get it fixed. :)
In response to Vortezz
Vortezz wrote:

Oh. Anyhow, here's the code I used, exactly, in a brand new environment.

There we go, varmint.. I just made the correct icons, and a map, and ran it up. It gave me quite the feeling of joy when it worked!

=)

You should include the playerflick() and playerstate() procs too. For a short demo, you don't need them, but on larger projects they are important to make sure the top's icon matches the bottom.

I'm glad you liked it. :)
In response to Shadowdarke
Shadowdarke wrote:
Vortezz wrote:

Oh. Anyhow, here's the code I used, exactly, in a brand new environment.

There we go, varmint.. I just made the correct icons, and a map, and ran it up. It gave me quite the feeling of joy when it worked!

=)

You should include the playerflick() and playerstate() procs too. For a short demo, you don't need them, but on larger projects they are important to make sure the top's icon matches the bottom.

I'm glad you liked it. :)

Well yeah, but pshhh!

I loved it, Shadow. You really oughta release loads of libraries. You know so much ;).

Tried out the new nifty <DM> tag? It's really funky.
In response to Vortezz
Vortezz wrote:
Shadowdarke, library it! =)

Hehee, the tall_darke library (handsome not included)!

I'll work on it. I have several libraries in a half complete state. My map maker, movement modes (like Darke Dungeon where you can select quick, directional, and rotational modes), and now the tall mobs library. I just don't feel right releasing them as libraries until they are nearly foolproof. (Nearly foolproof, because anything can be ruined by a sufficiently qualified fool!)

Map maker will be a while, but the others aren't so hard. I'll just have to set aside Tanks for a couple hours and work on them.
Page: 1 2