Frictional Games Forum (read-only)
[SCRIPT] Machine puzzle and other things - 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: [SCRIPT] Machine puzzle and other things (/thread-19060.html)

Pages: 1 2 3


Machine puzzle and other things - CorinthianMerchant - 11-02-2012

How do I...
  1. Make a player teleport to another map after interacting with an examine area?
  2. Make 5 different bulkheads open after placing an entity on a script area?
  3. Make an elevator lever teleport the player to a new map after two entities are placed on two different script areas?
  4. A machine puzzle that makes a lever interactable after the player pulls another lever after a lever puzzle setting lever number 1,3,4 up and 2,5,6 down and place three coal pieces inside a script area (and making a ever interactable afterwards?)



RE: Machine puzzle and other things - CorinthianMerchant - 11-03-2012

Bump!


RE: Machine puzzle and other things - FlawlessHappiness - 11-03-2012

Changing to another map would be:
ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
Immediatly loads another map.
asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded

You would have to play with variables to solve the other stuff


RE: Machine puzzle and other things - The chaser - 11-03-2012

For 3:

void OnStart();
{
AddEntityCollideCallback("Entity_1", "Script_1", "Blah", true, 1);
AddEntityCollideCallback("Entity_2", "Script_2", "Blah_1", true, 1);
}

void Blah (string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Gangnam", 1);
func_check();
}

void Blah_1 (string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Gangnam", 1);
func_check();
}

void func_check();
{
if (GetLocalVarInt("Gangnam") == 2)
{
SetEntityConnectionStateChangeCallback("Levar_elevator", "Map");
}
}

void Map (string &in asEntity, int alState)
{
if (alState == 1)
{
ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
}
}


RE: Machine puzzle and other things - CorinthianMerchant - 11-03-2012

(11-03-2012, 02:26 PM)beecake Wrote: Changing to another map would be:
ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
Immediatly loads another map.
asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded

You would have to play with variables to solve the other stuff
It doesn't work, I've tried SetEntityPlayerInteractCallback and SetEntityCallbackFunc.


RE: Machine puzzle and other things - FlawlessHappiness - 11-03-2012

I don't know if it's possible to call a function by examining


RE: Machine puzzle and other things - The chaser - 11-04-2012

Does my script work?


RE: Machine puzzle and other things - CorinthianMerchant - 11-04-2012

(11-04-2012, 12:17 AM)The chaser Wrote: Does my script work?
No, it crashes.
I get the following error in the hpl.log:
------- SCRIPT OUTPUT BEGIN --------------------------
main (2, 1) : ERR : Unexpected token '{'
main (20, 1) : ERR : Unexpected token '{'
------- SCRIPT OUTPUT END ----------------------------
FATAL ERROR: Could not load script file 'TheManMachine/maps/14_MechanicalLaboratory.hps'!
main (2, 1) : ERR : Unexpected token '{'
main (20, 1) : ERR : Unexpected token '{'


RE: Machine puzzle and other things - The chaser - 11-04-2012

Silly me Sad

void OnStart()

{

AddEntityCollideCallback("Entity_1", "Script_1", "Blah", true, 1);

AddEntityCollideCallback("Entity_2", "Script_2", "Blah_1", true, 1);

}



void Blah (string &in asParent, string &in asChild, int alState)

{

AddLocalVarInt("Gangnam", 1);

func_check();

}



void Blah_1 (string &in asParent, string &in asChild, int alState)

{

AddLocalVarInt("Gangnam", 1);

func_check();

}



void func_check();

{

if (GetLocalVarInt("Gangnam") == 2)

{

SetEntityConnectionStateChangeCallback("Levar_elevator", "Map");

}

}



void Map (string &in asEntity, int alState)

{

if (alState == 1)

{

ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

}

}


This is the correct script Wink


RE: Machine puzzle and other things - CorinthianMerchant - 11-04-2012

I still get:
------- SCRIPT OUTPUT BEGIN --------------------------
main (20, 1) : ERR : Unexpected token '{'
------- SCRIPT OUTPUT END ----------------------------
FATAL ERROR: Could not load script file 'TheManMachine/maps/14_MechanicalLaboratory.hps'!
main (20, 1) : ERR : Unexpected token '{'