So I wanna do an event where I use an item on an hotspot and walkable area restores in another room where the hotspot doesnt exist.
I tried a code like this
function hexample_UseInv()
if (player.ActiveInventory==iItem) {
RestoreWalkableArea(2);
}
I see that it would restore the walkable are number 2 in the same room. But what code should I use so I could restore walkable area number 2 in room number 5 for example.
I hope someone can help
Hello,
If you can't access the other rooms walkable areas then you may want to use a switch, basically it is just a global variable, you could use it like this:
-Create the global variable from the right panel in the editor, name it MySwitch -> INT -> default value 0
-When the player triggers the "restore area" event, you can put this:
if(MySwitch == 0)
MySwitch = 1;
Now inside the target room "enters_room_before_fadein", the one where you have to restore the walkable area, put this:
if(MySwitch == 1)
{
RestoreWalkableArea(2);
MySwitch = 2;
}
The walkable area should be restored next time you enter the room, and everything will only be triggered once. Hope it helps.
Wow it worked.
Thanx man :D
Ooops. I noticed that the rooms walkable area is also walkable when I havent triggered the switch.
What do i do?
Inside the same "enters_room_before_fadein" you could put that instead:
if(MySwitch == 0)
{
RemoveWalkableArea(2);
}
else if(MySwitch == 1)
{
RestoreWalkableArea(2);
MySwitch = 2;
}
Also you can edit your post with the modify button to avoid double-posting :)
This should do the trick, hopefully.
Yay, I got it working !
Thnx
But I'm also having problems with my cutscene.
I wan't it so when the game would start different pictures would come one after another.
this is what I did so far.
function load_AfterFadeIn()
{
StartCutscene(eSkipAnyKey);
Mouse.Visible=false;
Wait (40);
Mouse.Visible=true;
player.ChangeRoom(9, 111110000, 1111111);
EndCutscene();
}
did it by following a tutorial
I'm sure this subject has been covered many times, anyways you could create a GUI that is exactly the size of the screen, import the differents pictures as sprites, make player start in empty room with the gui ON, then use something like :
MyGui.BackgroundGraphic = imported_sprite_number_1;
WaitKey(40*10); //10 seconds with GameSpeed=40
MyGui.BackgroundGraphic = imported_sprite_number_2;
WaitKey(40*10);
MyGui.BackgroundGraphic = imported_sprite_number_3;
//and so on
MyGui.Visible = false;
player.ChangeRoom(2, 300, 100);
player.ChangeRoom() needs valid X,Y coordinates, I highly doubt "111110000, 1111111" are valid. This is just one way to do it.
// room script file
function room_AfterFadeIn()
{
gGui1.BackgroundGraphic = 41;
WaitKey(40*10); //10 seconds with GameSpeed=40
gGui2.BackgroundGraphic = 42;
WaitKey(40*10);
gGui3.BackgroundGraphic = 43;
//and so on
gGui1.Visible= false;
gGui2.Visible = false;
gGui3.Visible = false;
player.ChangeRoom(1, 160, 160);
}
I did this and when I tested the game it would start as a black window, waited a second and last gui (the picture) showed up. And nothing happened from that forward. It didn't go to the next room or anything
I think you misunderstood something, the gui that displays the pictures is always the same, so you only need one gGui1, then reuse :
gGui1.BackgroundGraphic = 42;
gGui1.BackgroundGraphic = 43;
You may want to check that the created gui is visible by default, or that you used gGui1.Visible = true; before.
Are you sure player should be transported to Room 1 after that? Maybe wrong number?
Quote from: beenf on Mon 04/04/2011 19:00:14
did it by following a tutorial
Could you post the link to that tutorial?
Thnx it worked now
Edit: Ohh I have a silly problem now. How can I create the game now so I could share it to my friends and they could play it without having ags?
I didn't found any tutorial teaching me that
I think if you needed AGS to play AGS games CJ would be flooded with complaints/requests :p
+1 for the use of modify button!
There aren't tutorials for everything because many things are already explained in the manual, if you can believe that.
http://www.adventuregamestudio.co.uk/manual/DistGame.htm
Also, I'd still like the link to the tutorial that tought you to use player.ChangeRoom(9, 111110000, 1111111);
And please, take a deep breath now and stop posting about every single little thing you get stuck with. It's obvious that you are the kind of ambitious, probably young, impatient, "can't be bothered to figure things out by themselves" guy we've already seen so many come and go here.
Check the resources and do basic programming tutorials for Java or C++; AGS isn't Game Maker, you'll need a few weeks at least to get the hang of it.
What makes you think I haven't searched about those problems first ?
http://www.youtube.com/watch?v=3LCiL1YCaWU