Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: tamika on Sat 07/06/2008 10:34:00

Title: moving to a certain area (hotspot?) triggers an event
Post by: tamika on Sat 07/06/2008 10:34:00
hello. sorry if this is posted before, but i have been trying this for several hours, and have searched with no luck. As you see this is my first post so please dont flame. I am very excited and have just discovered this remarkable tool.

I am in the process of making a really basic game, and a really basic function is what i cannot seem to get to work.

Basically, i have a scene with a raincloud, when my character walks underneath it i would like it to rain.

I have tried defining a hotspot for this area but my very limited knowledge of this scripting is not doing me any favours. I have scoured the manuals, tutorials and forums for an answer, so hopefully you can help me.

Thanks in advance,

Tamika
Title: Re: moving to a certain area (hotspot?) triggers an event
Post by: Creator on Sat 07/06/2008 10:50:50
Look in the manual for 'Regions'. That should be what you're looking for.
Title: Re: moving to a certain area (hotspot?) triggers an event
Post by: tamika on Sat 07/06/2008 11:05:14
thanks for your reply, but as i said I'm extremely new at this scripting lark... if possible can you throw me an example?

Quoteregion[4].RunInteraction(1);

will run the actions defined in the interaction editor for "Player walks onto region" for region 4.

what/where is the interaction editor and how do i define region 4
Title: Re: moving to a certain area (hotspot?) triggers an event
Post by: Matti on Sat 07/06/2008 11:11:44
Which AGS-Version are you using? If it's 3.x then the interaction editor is obsolete..
Title: Re: moving to a certain area (hotspot?) triggers an event
Post by: tamika on Sat 07/06/2008 11:13:48
it is 3.x...

if its obsolete how do i go about doing what i want. i have defined the region... this is where im stuck especially if im looking for an obsolete function
Title: Re: moving to a certain area (hotspot?) triggers an event
Post by: Matti on Sat 07/06/2008 11:29:01
Via the panel on the right side you should access the room's script. There is a section for your created region. The interaction you want to happen should be placed in the player_walks_onto_region-section.

EDIT: When your room is viewed you can click on the [...] next to interaction at the right bottom as far as I remember. But you have to select "regions" in your rooms view first.

Unfortunately I can't use the editor at the moment and can't look the things up, so someone else should help you, but basically you have to do one of the following:

1. Create an object: "Cloud", if it's supposed to move.
2. Check, whether the character is within the x-coodinates of the cloud or not.
3. If he is, then start an animation for the cloud, the rain.

(2. and 3. have to be scripted in the repeatedly_execute function in your room's script)

or:

1. Just draw the cloud, if it's supposed to stand still.
2. Create a region beneath it.
3. In player_walks_onto_region start an animation, in In player_walks_off_region stop the animation. EDIT 2: You can either set the backgroundanimation here (every background can have 4 frames) or set an object visible (the rain).

But you should really go through the tutorials first and look up things like object(-animation), regions, views and interactions...  ...and of course scripting...

The interaction-editor was just a little tool to avoid basic scripting, but isn't used in the latest versions anymore, which I think is good, because now you have to learn scripting right from the beginning, which is neccessary anyway.
Title: Re: moving to a certain area (hotspot?) triggers an event
Post by: tamika on Sun 08/06/2008 06:36:27
thanks matti, between your help, and you pointing me in the right direction of the tutorial, i got it working.