Remove&Restore walkable areas at certain conditions

Started by Andrechan, Thu 20/07/2006 15:33:27

Previous topic - Next topic

Andrechan

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?

Khris

How do you know it isn't restored? The code looks okay to me.

strazer

Put a Display("Test"); command in there to make sure the function is called at all.

Andrechan

#3
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  :(

Khris

Go the hotspot's interactions, then double-click on "Use inventory on hotspot", then add your RunScript action.
The script should look like this:
Code: ags
  if (player.ActiveInventory==iKeycard) {   // e.g.
    RestoreWalkableArea(2);
    ...
  }

SMF spam blocked by CleanTalk