Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Machine puzzle and other things
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
#1
Machine puzzle and other things

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?)

Still hasn't gotten over the loss of wubwub...
11-02-2012, 09:55 PM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
#2
RE: Machine puzzle and other things

Bump!

Still hasn't gotten over the loss of wubwub...
11-03-2012, 01:31 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Machine puzzle and other things

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

Trying is the first step to success.
(This post was last modified: 11-03-2012, 02:26 PM by FlawlessHappiness.)
11-03-2012, 02:26 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#4
RE: Machine puzzle and other things

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);
}
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-03-2012, 07:06 PM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
#5
RE: Machine puzzle and other things

(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.

Still hasn't gotten over the loss of wubwub...
11-03-2012, 07:19 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Machine puzzle and other things

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

Trying is the first step to success.
11-03-2012, 08:18 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: Machine puzzle and other things

Does my script work?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-04-2012, 12:17 AM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
#8
RE: Machine puzzle and other things

(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 '{'

Still hasn't gotten over the loss of wubwub...
11-04-2012, 05:25 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#9
RE: Machine puzzle and other things

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

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-04-2012, 05:47 PM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
#10
RE: Machine puzzle and other things

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 '{'

Still hasn't gotten over the loss of wubwub...
11-04-2012, 06:05 PM
Find




Users browsing this thread: 2 Guest(s)