Frictional Games Forum (read-only)

Full Version: Machine puzzle and other things
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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?)
Bump!
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
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);
}
}
(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.
I don't know if it's possible to call a function by examining
Does my script work?
(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 '{'
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
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 '{'
Pages: 1 2 3