Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: PERXEO on Thu 13/04/2023 19:50:58

Title: Initialice objects in AGS (SOLVED)
Post by: PERXEO on Thu 13/04/2023 19:50:58
What is the best place and the best method to determine if an object is solid or not? I mean to know in which part of the code should this type of thing be initialized? That is, at what point should I set oObjectX.Solid=true? In roomxxx.asc? In globalScript.asc?
Title: Re: Initialice objects in AGS
Post by: Crimson Wizard on Thu 13/04/2023 20:10:52
"Enter room before fade-in" is a correct event for initializing anything inside the room.

If there's a similar initialization or action that has to be done for a number of rooms, then use "on_event" with eEventEnterRoomBeforeFadein in the GlobalScript:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Event.html#on_event
Title: Re: Initialize objects in AGS
Post by: Khris on Thu 13/04/2023 20:41:15
You can only use object names in room scripts anyway. In the global script you can only access the current room's objects (using the object[n] array).

Also, note that if you want to initialize a property that is supposed to change during the game, putting the line in room_Load will reset the state each time the player enters the room, so you should probably use the "first time player enters room" event instead.
Title: Re: Initialice objects in AGS
Post by: PERXEO on Thu 13/04/2023 21:44:30
Thanks!!! As effective as always!!