ID:175943
 
As some of you know, i have been trying and trying to make these multi tiled players when they enter a town, castle, dungeon etc. But I still dont know whats wrong. I havent got a clue what to do here but below is the coding, of course it is wrong. I am a newbie to multi tiling so please help me as best you can.

mob
Fighter
icon = 'fighter.dmi'
pixel_y=0
Warrior
icon = 'warrior.dmi'
pixel_y=0

obj
head
if(new_mob = "Fighter")
icon_state="head"
pixel_y=32
layer = MOB_LAYER
if(new_mob = "Warrior")
icon_state = "head"
pixel_y=32
layer = MOB_LAYER

How do I get the obj/head to work correctly so when I enter somewhere the src.overlays += new/obj/head works for ALL players?

Rii wrote:
As some of you know, i have been trying and trying to make these multi tiled players when they enter a town, castle, dungeon etc. But I still dont know whats wrong. I havent got a clue what to do here but below is the coding, of course it is wrong. I am a newbie to multi tiling so please help me as best you can.

mob
Fighter
icon = 'fighter.dmi'
pixel_y=0
Warrior
icon = 'warrior.dmi'
pixel_y=0

pixel_y is 0 by default, so you don't have to set that.

obj
head
if(new_mob = "Fighter")
icon_state="head"
pixel_y=32
layer = MOB_LAYER
if(new_mob = "Warrior")
icon_state = "head"
pixel_y=32
layer = MOB_LAYER

There are three problems with this:

First, those if() blocks are happening outside of a proc; they should be run within a proc.

Second, those if() blocks are doing exactly the same thing, so there's no need to use if() at all. The vars they set can be set where they are, without using if() and therefore without even needing a proc.
obj/head
icon_state = "head"
layer = 5 // this should be MOB_LAYER+1 or you'll have overlap issues
pixel_y = 32
Third, what you probably want for setting the head icons for different classes, and for adding the head to overlays, is something like this:
mob
proc/CreateHead()
var/obj/head/H = new
H.icon = icon
overlays += H

I can think of other ways to do that, but they'd get confusing.

Lummox JR
In response to Lummox JR
Ok the coding works but now the icon is still just the players lower half. Can you give me an example of what a turf, say grass, would look like with the commands to make the players icon switch and add its head please?
In response to Rii
Rii wrote:
Ok the coding works but now the icon is still just the players lower half.

It sounds like you're not calling CreateHead() like you're supposed to; that proc has to be called in order to do anything. Calling it in New() is as good a place as any.

Can you give me an example of what a turf, say grass, would look like with the commands to make the players icon switch and add its head please?

No idea what you mean by that. Please clarify.

Lummox JR
In response to Lummox JR
Ok here is an example of entering a castle, what I mean by that is:

turf
castle_entrance1
icon = 'buildings.dmi'
icon_state = "left_entrance"
Enter()
src << sound('music.wav',1)
src.icon_state = "body"
*src.overlays += new /obj/head*

Something like that, the pieces between the *'s are what Im really after.
In response to Rii
Rii wrote:
Ok here is an example of entering a castle, what I mean by that is:

turf
castle_entrance1
icon = 'buildings.dmi'
icon_state = "left_entrance"
Enter()
src << sound('music.wav',1)
src.icon_state = "body"
*src.overlays += new /obj/head*

Nope, this isn't what you'd do. The overlays should be added when the mob is created. If you're going more for an overworld/underworld system where the mob has one appearance in one map, and a bigger appearance with the overlay in another, then you should give the mob a proc that switches the appearance back and forth.

As for your use of Enter() to react to entering a castle, it couldn't be more wrong. What you really need is Entered(). You also should not be using src here because src is the turf (and especially don't use usr). The first argument to Entered() is the atom that just walked in, and that's what you need to use.

Lummox JR
In response to Lummox JR
I understand that VERY slightly, can anyone show me what it should look like. I wouldnt copy and paste because Id probably end up ruining it. I just need something to get me started with it.