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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Levers!
Alento Offline
Member

Posts: 64
Threads: 11
Joined: Jan 2012
Reputation: 0
#9
RE: Levers!

(02-14-2012, 01:13 PM)Your Computer Wrote: For starters, the callback syntax doesn't include bool abEffects. Secondly, try not to make a new callbacks for the same puzzle. You can handle it all in one function. Thirdly, if you want things to happen only under certain conditions, don't place things outside of conditional statements. You had SetLeverStuckState and SetWheelStuckState outside of if statements. Fourth, when defining a string parameter, the ampersand should have either in, out, or inout directly following it. In most cases, &in is what should be used.

Finally,
PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever1""Stuck");
    
SetEntityConnectionStateChangeCallback("lever2""Stuck");
    
SetEntityConnectionStateChangeCallback("crank1""Stuck");
}

void Stuck(string &in asNameint alState)
{
    if (
asName == "crank1")
    {
        if(
alState == 1){
            
SetWheelStuckState("crank1"1true);
            
PlaySoundAtEntity("""explosion_rock_large.snt""soundrock"0false);
        }
    }
    
    else if (
asName == "lever1")
    {
        if(
alState == 1){
            
SetLeverStuckState("lever1"1true);
            
SetLeverStuckState("lever2"0true);
        }
    }
    
    else if (
asName == "lever2")
    {
        if(
alState == 1){
            
SetLeverStuckState("lever2"1true);
            
SetWheelStuckState("crank1"0true);
        }
    }


For player body force, search here: http://wiki.frictionalgames.com/hpl2/amn...ons#player
hm.. I didn't understood all you said but, anyway, the sound is playing when the crank is on state 1 now, that's a progress! Thank you! Now, the problem is, that, even if I haven't touched the levers, I can spin the crank :/

The thing is, that, Lever 2 shouldn't be able to move if I haven't drag the lever1, and same for the crank, it shouldn't be able to move if I haven't drag the lever2. Ideas for that? Smile

---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
02-14-2012, 09:25 PM
Find


Messages In This Thread
Levers! - by Alento - 02-13-2012, 11:50 PM
RE: Levers! - by Your Computer - 02-14-2012, 12:00 AM
RE: Levers! - by Alento - 02-14-2012, 12:04 AM
RE: Levers! - by Your Computer - 02-14-2012, 12:16 AM
RE: Levers! - by Alento - 02-14-2012, 12:25 AM
RE: Levers! - by Your Computer - 02-14-2012, 12:28 AM
RE: Levers! - by Alento - 02-14-2012, 11:30 AM
RE: Levers! - by Your Computer - 02-14-2012, 01:13 PM
RE: Levers! - by Alento - 02-14-2012, 09:25 PM
RE: Levers! - by Your Computer - 02-14-2012, 09:33 PM
RE: Levers! - by Alento - 02-14-2012, 09:42 PM
RE: Levers! - by Your Computer - 02-14-2012, 09:44 PM
RE: Levers! - by Alento - 02-14-2012, 09:53 PM



Users browsing this thread: 1 Guest(s)