Object only works correctly in one room.

S

SamSolo

Guest
Hey there,

I know this is so basic but could not find any previous posts that applied. I have an object that only exists to display/ change sprite based on player states. It works perfectly in roomA but always displays the same incorrect sprite in every other room. There are NPCs in these other rooms that change their behavior based on the same player state data so I know the room knows the player state. I don't understand why it always grabs the same random incorrect sprite out of the relevant index instead of changing based on state like it correctly does in roomA. Any insight on what I might be overlooking/misunderstanding would greatly appreciated.

PS forgot to mention that the object has an associated script that manages the very large sprite index. script is called clothingType as referenced in the cide below.

shirt = 0
pants = 0
underwear = 0
cursed = 0
with(obj_apparel)
{
if(equipped && type = "shirt")
{
other.shirt = sprite_get_name(sprite_index)
}
if(equipped && type = "pants")
{
other.pants = sprite_get_name(sprite_index)
}
if(equipped && type = "underwear")
{
other.underwear = sprite_get_name(sprite_index)
}
if(equipped && type = "cursed")
{
other.cursed = sprite_get_name(sprite_index)
}
}
sprite_index = clothingType(shirt,pants,underwear,cursed)
 
Last edited by a moderator:

samspade

Member
Hey there,

I know this is so basic but could not find any previous posts that applied. I have an object that only exists to display/ change sprite based on player states. It works perfectly in roomA but always displays the same incorrect sprite in every other room. There are NPCs in these other rooms that change their behavior based on the same player state data so I know the room knows the player state. I don't understand why it always grabs the same random incorrect sprite out of the relevant index instead of changing based on state like it correctly does in roomA. Any insight on what I might be overlooking/misunderstanding would greatly appreciated.

PS forgot to mention that the object has an associated script that manages the very large sprite index.
You should post the code.
 
Top