Frictional Games Forum (read-only)
Elevator Rooms - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Elevator Rooms (/thread-15984.html)



Elevator Rooms - Nuclearbones - 06-09-2012

Well I finally decided to go through a simpler route. Instead of using an elevator that actually moves but instead just have it be a room. When you pull down the lever it will send you to the next map. For some reason the map is so dysfunctional and hates me so much that no matter what I do, it doesn't work. No errors appear so that I can fix it and get it on with. I just think it's something in the script. Can anybody help me with this?

Here's my script right here:

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{  
    AddUseItemCallback("", "Gatekey_1", "elevator_door_2", "KeyOnDoor", true);
    
    AddEntityCollideCallback("entity_elevator_lever_1", "ElevatorLevel_01", "ChangeMap", true, 1)
    
    ChangeMap("lvl03_aMAZEing.map", "PlayerStartArea_1", "14_elevator_activate.snt", "elevator_stop.snt")

}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("elevator_door_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "elevator_door_1", 0.0f, false);
    RemoveItem("Gatekey_1");
    AddDebugMessage("KeyOnDoor", false);
}




////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Well there it is.


RE: Elevator Rooms - Your Computer - 06-09-2012

If you don't get any errors with that, then you're either working on the wrong script or you named your HPS file incorrectly.

As for what you want to achieve: You have to define the ChangeMap collision callback before it'll be called. However, using script areas to detect whether or not a lever has been pulled means you have come to misunderstand how to script for levers. The proper function is SetEntityConnectionStateChangeCallback. Once you have finally defined the callback, you can then move the original ChangeMap function which you have in OnStart to where it belongs: in the state change callback.


RE: Elevator Rooms - Nuclearbones - 06-09-2012

(06-09-2012, 04:13 AM)Your Computer Wrote: If you don't get any errors with that, then you're either working on the wrong script or you named your HPS file incorrectly.

As for what you want to achieve: You have to define the ChangeMap collision callback before it'll be called. However, using script areas to detect whether or not a lever has been pulled means you have come to misunderstand how to script for levers. The proper function is SetEntityConnectionStateChangeCallback. Once you have finally defined the callback, you can then move the original ChangeMap function which you have in OnStart to where it belongs: in the state change callThanks
Thanks. Now I just have to get rid of the "Expected data type" error in the changemap function.
Code:
////////////////////////////
// Run first time starting map
void OnStart()
{  
    AddUseItemCallback("", "Gatekey_1", "elevator_door_2", "KeyOnDoor", true);
    
    SetEntityConnectionStateChangeCallback("Elevator", "Changemap");

}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("elevator_door_1", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "elevator_door_1", 0.0f, false);
    RemoveItem("Gatekey_1");
    AddDebugMessage("KeyOnDoor", false);
}

void ChangeMap("lvl03_aMAZEing.map", "PlayerStartArea_1", "14_elevator_activate.snt", "elevator_stop.snt")
{

}



////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Think you might be able to help with that too?