NPC scaling under "room_FirstLoad()" doesn't work?

Started by Alice24, Fri 08/03/2024 08:40:15

Previous topic - Next topic

Alice24

Heya! So my goal is to scale NPC's, and they might be scaled differently per room. I tried putting the NPC scaling code under room_FirstLoad(), but nothing changed

Code: ags
// room script file
function room_FirstLoad()
{
      cChar3.ManualScaling = true;
      cChar3.Scaling = 10;
}

What I am missing?  :-\  would love your help!

Khris

Most room script functions aren't called as soon as they exist but need to be linked to the event.
Did you just type that function yourself? If so, you need to open the room, click the thunderbolt icon, then the "first time player enters room" event, then the ellipses button. This will create and link the function.

Alice24

Thanks! Yes, that was my mistake I just realized that a minute ago :)

Crimson Wizard

Also, "first time in room" event may be a bit misleading, it is actually run AFTER fade in, while character setup is best done in "Before fade-in" event, before room is shown on screen.

If you need something done strictly the first time, Game.DoOnceOnly function may help.

Snarky

Quote from: Alice24 on Fri 08/03/2024 08:40:15Heya! So my goal is to scale NPC's, and they might be scaled differently per room. I tried putting the NPC scaling code under room_FirstLoad(), but nothing changed

Can you not use the walkable area scaling properties to adjust the scale from room to room without the need for any code?

Alice24

#5
Quote from: Snarky on Fri 08/03/2024 10:31:41
Quote from: Alice24 on Fri 08/03/2024 08:40:15Heya! So my goal is to scale NPC's, and they might be scaled differently per room. I tried putting the NPC scaling code under room_FirstLoad(), but nothing changed

Can you not use the walkable area scaling properties to adjust the scale from room to room without the need for any code?

Well, that assumes all uploaded characters are scaled correctly in relation to each other, that requires careful planning, I'm not that great of a pre-planner ;)

Snarky

If that's the issue, it's probably less work to rescale the sprites in an image editor and reimport them, but whatever works for you.

SMF spam blocked by CleanTalk