Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alice24 on Fri 08/03/2024 08:40:15

Title: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: Alice24 on Fri 08/03/2024 08:40:15
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

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

What I am missing?  :-\  would love your help!
Title: Re: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: Khris on Fri 08/03/2024 08:47:33
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.
Title: Re: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: Alice24 on Fri 08/03/2024 08:59:00
Thanks! Yes, that was my mistake I just realized that a minute ago :)
Title: Re: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: Crimson Wizard on Fri 08/03/2024 09:47:26
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.
Title: Re: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: 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?
Title: Re: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: Alice24 on Sat 09/03/2024 16:05:12
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 ;)
Title: Re: NPC scaling under "room_FirstLoad()" doesn't work?
Post by: Snarky on Sat 09/03/2024 17:44:07
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.