Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Andrechan on Thu 20/07/2006 15:33:27

Title: Remove&Restore walkable areas at certain conditions
Post by: Andrechan on Thu 20/07/2006 15:33:27
Hi ! :)
I want to make my character fly to a certain place(hotspot 2) only if the player clicks on it with the pick up
I've made a walkable area (2) in the sky and I've set "change player view while on this area " to the "fly" view.
Then I've inserted this script in the room

// room script file
#sectionstart hotspot2_a  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot2_a() {
  // script for Hotspot 2 (Hotspot 2): Pick up hotspot
RestoreWalkableArea(2); 
}
#sectionend hotspot2_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: Player enters room (before fadein)
RemoveWalkableArea(2); 
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

But the walkable area isn't restored if the player picks hotspot2 :-[
What can I do?
Title: Re: Remove&Restore walkable areas at certain conditions
Post by: Khris on Thu 20/07/2006 16:44:31
How do you know it isn't restored? The code looks okay to me.
Title: Re: Remove&Restore walkable areas at certain conditions
Post by: strazer on Thu 20/07/2006 16:59:41
Put a Display("Test"); command in there to make sure the function is called at all.
Title: Re: Remove&Restore walkable areas at certain conditions
Post by: Andrechan on Thu 20/07/2006 17:10:50
Ah I got it! It's not Pick up I wanted but Interact. SorryÃ,  ;D
But now I would like to convert it with "if player press inventory item 3 on the hot spot 2 restore walkable area 2".
I've tried to do it with the interaction editor but it doesn't work  :(
Title: Re: Remove&Restore walkable areas at certain conditions
Post by: Khris on Thu 20/07/2006 21:01:54
Go the hotspot's interactions, then double-click on "Use inventory on hotspot", then add your RunScript action.
The script should look like this:
  if (player.ActiveInventory==iKeycard) {   // e.g.
    RestoreWalkableArea(2);
    ...
  }