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
The chaser Offline
Posting Freak

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

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



}



}

Sorry, now it should be fine.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

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

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

It's still crashing...
Spoiler below!
void OnStart()
{
AddUseItemCallback("SteamRod", "MachineScript_1", "Elevator", true);
AddUseItemCallback("FlowRod", "MachineScript_2", "Elevator_1", true);
}

void Elevator (string &in asParent, string &in asChild, int alState)
{
SetEntityActive("SteamRod_static", true);
PreloadSound("rod_in.snt");
AddLocalVarInt("ElevatorWork", 1);
func_check();
}

void Elevator_1 (string &in asParent, string &in asChild, int alState)
{
SetEntityActive("FlowRod_static", true);
PreloadSound("rod_in.snt");
AddLocalVarInt("ElevatorWork", 1);
func_check();
}

void func_check()
{
if (GetLocalVarInt("ElevatorWork") == 2)
{
PreloadSound("13_flow_done.snt");
SetEntityConnectionStateChangeCallback("elevator_lever_1", "Map");
}
}

void Map (string &in asEntity, int alState)
{
if (alState == 1)
{
ChangeMap("00_Buda.map", "PlayerStartArea_1", "14_elevator_activate.snt", "elevator_move_normal.snt");
}
}

My hpl.log...
Spoiler below!

------- SCRIPT OUTPUT BEGIN --------------------------
main (1, 1) : INFO : Compiling void OnStart()
main (3, 2) : ERR : No matching signatures to 'AddUseItemCallback(string@&, string@&, string@&, const bool)'
main (3, 2) : INFO : Candidates are:
main (3, 2) : INFO : void AddUseItemCallback(string&in, string&in, string&in, string&in, bool)
main (4, 2) : ERR : No matching signatures to 'AddUseItemCallback(string@&, string@&, string@&, const bool)'
main (4, 2) : INFO : Candidates are:
main (4, 2) : INFO : void AddUseItemCallback(string&in, string&in, string&in, string&in, bool)
------- SCRIPT OUTPUT END ----------------------------
FATAL ERROR: Could not load script file 'TheManMachine/maps/14_MechanicalLaboratory.hps'!
main (3, 2) : ERR : No matching signatures to 'AddUseItemCallback(string@&, string@&, string@&, const bool)'
main (4, 2) : ERR : No matching signatures to 'AddUseItemCallback(string@&, string@&, string@&, const bool)'


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

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

Wait a sec:

How do you want it, activated by a collision (AddEntityCollideCallback) or using an item?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-04-2012, 07:40 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#14
RE: Machine puzzle and other things

There are 4 string arguments in a UseItemCallback, not 3 (Name, Item, Entity, Function). The "No Matching Signatures" error means you have the wrong amount or type of arguments in your function/callback.

I rate it 3 memes.
11-04-2012, 07:59 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#15
RE: Machine puzzle and other things

try this
Spoiler below!
void OnStart()
{
AddUseItemCallback("Usedsteam", "SteamRod", "MachineScript_1", "Elevator", true);
AddUseItemCallback("Usedflow" ,"FlowRod", "MachineScript_2", "Elevator_1", true);
}

void Elevator (string &in asParent, string &in asChild, int alState)
{
SetEntityActive("SteamRod_static", true);
PreloadSound("rod_in.snt");
AddLocalVarInt("ElevatorWork", 1);
func_check();
}

void Elevator_1 (string &in asParent, string &in asChild, int alState)
{
SetEntityActive("FlowRod_static", true);
PreloadSound("rod_in.snt");
AddLocalVarInt("ElevatorWork", 1);
func_check();
}

void func_check()
{
if (GetLocalVarInt("ElevatorWork") == 2)
{
PreloadSound("13_flow_done.snt");
SetEntityConnectionStateChangeCallback("elevator_lever_1", "Map");
}
}

void Map (string &in asEntity, int alState)
{
if (alState == 1)
{
ChangeMap("00_Buda.map", "PlayerStartArea_1", "14_elevator_activate.snt", "elevator_move_normal.snt");
}
}

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
11-04-2012, 08:15 PM
Find
CorinthianMerchant Offline
Posting Freak

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

(11-04-2012, 08:18 PM)Robosprog Wrote:
(11-03-2012, 07:19 PM)CorinthianMerchant Wrote:
(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.
void OnStart()
{
SetEntityPlayerInteractCallback("area", "changemap", false);

}

void changemap(string &in asEntity)

{
SetMessage ("Messages", "messageone", 3.00);

ChangeMap("NextMap", "PlayerStartArea_1", "sanity_flick.snt", "sanity_flick.snt");

}




That should work and would do the same as an examinearea, obviously adjust to whatever yours are. I don't know if that's what you did but..
Sadly enough, no luck. My hpl.log says the following:
------- SCRIPT OUTPUT BEGIN --------------------------
main (26, 9) : ERR : Expected identifier
------- SCRIPT OUTPUT END ----------------------------
FATAL ERROR: Could not load script file 'TheManMachine/maps/00_Buda.hps'!
main (26, 9) : ERR : Expected identifier

Still hasn't gotten over the loss of wubwub...
11-06-2012, 09:03 PM
Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#17
RE: Machine puzzle and other things

can you put your whole script here?

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 11-07-2012, 05:19 PM by Steve.)
11-07-2012, 05:19 PM
Find
CorinthianMerchant Offline
Posting Freak

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

void OnStart()
{
SetEntityPlayerInteractCallback("TeleportArea", "changemap", false);
}

void changemap(string &in asEntity)

{
SetMessage ("Messages", "messageone", 3.00);
ChangeMap("Forest.map", "PlayerStartArea_1", "sanity_flick.snt", "sanity_flick.snt");
}
  void OnEnter()
{ }void OnLeave()
{ }

Still hasn't gotten over the loss of wubwub...
11-08-2012, 05:45 PM
Find
CorinthianMerchant Offline
Posting Freak

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

Bump.

Still hasn't gotten over the loss of wubwub...
11-11-2012, 02:03 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#20
RE: Machine puzzle and other things

(11-11-2012, 02:03 PM)CorinthianMerchant Wrote: Bump.

The code you provided has no (syntax) errors in it, nor does it contain at least 26 lines of code.

Tutorials: From Noob to Pro
11-11-2012, 02:10 PM
Website Find




Users browsing this thread: 3 Guest(s)