I have checked the manual and read quite a lot of questions about this topic however I'm having trouble with it. I'm using 3.0.
From my GlobalScript.asc
function cMayor_Talk()
{
if (GetGlobalInt(1) ==1) {
dMayor2.Start();
}
else {
dMayor1.Start();
SetGlobalInt(1, 1);
object[2].Visible = true;
}
}
When I play and I talk to the Mayor an error message appears:-
Error: ObjectOn: invalid object specified
The object is oJail (Object; ID 2)
If anyone can help thanks alot
Are you definitely in the same room as the object when you talk to the mayor?
Sorry I forgot to mention. The object is in a different room to the mayor. What happens is when you finish talking to the mayor the first time an object appears in a different room.
The object[] array always accesses the current room.
You can't directly access objects in other rooms. There are various ways to do it, but the simplest is probably to use the OtherRoom module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20650).
Sorry the download is for AGS 2.70 etc.
I have AGS 3.0 so I don't think it would work. Do you know of any scripting that could make it turn on. I have tried before OtherRoom.Object_On(2,2) but it doesn't understand 'OtherRoom'.
Why do you have to do it from different room anyway? In that "other room" use globalint and in the room where thing happens, let function start when globalint is something you set in other room -- "before fadein" event.
I mean--
in the other room, when you want to manipulate things in another room...
SetGlobalint(a,b)
and in the room itself, before fadein
if (GetGlobalInt(a) == b)
-- do stuff
Since it's before fadein, when player sees the room, it's changed already.
Or use "after fadein" if you want stuff to happen as soon as player sees the room.
OtherRoom module should probably work in 3.0 AFAIK. Why not try it?
I know how to use global ints and i have tried using OtherRoom.
What I don't understand is what i put as a function. You said before fade in type getglobalint...
But what is the function? That is where i get confused
Go to the room's events, select "player enters room (before fadein)" in the list, then click the little ... button.
This should take you to / create the roomLoad function. Put the code in there.
Why don't people rtfm before posting here anymore...?
Quote from: KhrisMUC on Tue 29/04/2008 19:21:14
Why don't people rtfm before posting here anymore...?
I'm sorry, I have done the tutorial and read quite a bit about scripting. It's just that I didn't realise rooms had events. I'm sorry, I wasn't thinking right.
But thanks anyway, it's working perfectly now. Cheers