Frictional Games Forum (read-only)

Full Version: Piano Script - Errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

void OnStart()
{
AddEntityCollideCallback("Player", "roomevent", "room1", true, 1);
AddEntityCollideCallback("Player", "pianoevent", "pianoscare", true, 1);
}

void room1(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle1", false, false);
SetLampLit("candle2", false, false);
SetLampLit("candle3", false, false);
SetSwingDoorClosed("doorslam2", true, true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
}

void pianoscare(string &in asParent, string &in asChild, int alState)
{
SetLeverStuckState("piano", 0, true);
AddPropImpulse("piano", 0, 0, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", false);
CreateParticleSystem("", "pa_dust_impact.pa", "impact", false);
}



void OnLeave()
{

}

Hey This is a script i made which will make the piano slam. But it isn't working it says cannot load script and has a fair few script errors all to do with the strings? Any help would be useful thank you Smile
(02-04-2012, 04:06 PM)Loveridge Wrote: [ -> ]void OnStart()
{
AddEntityCollideCallback("Player", "roomevent", "room1", true, 1);
AddEntityCollideCallback("Player", "pianoevent", "pianoscare", true, 1);
}

void room1(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle1", false, false);
SetLampLit("candle2", false, false);
SetLampLit("candle3", false, false);
SetSwingDoorClosed("doorslam2", true, true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
}

void pianoscare(string &in asParent, string &in asChild, int alState)
{
SetLeverStuckState("piano", 0, true);
AddPropImpulse("piano", 0, 0, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", false);
CreateParticleSystem("", "pa_dust_impact.pa", "impact", false);
}



void OnLeave()
{

}

Hey This is a script i made which will make the piano slam. But it isn't working it says cannot load script and has a fair few script errors all to do with the strings? Any help would be useful thank you Smile
Particle system file is ps_dust_impact.ps
Its saying no matching signatures to
AddPropImpulse(string@&, const uint, const uin, string @&)'

but it says that for about 3 things Sad
This should work:

void OnStart()

{
AddEntityCollideCallback("Player", "roomevent", "room1", true, 1);
AddEntityCollideCallback("Player", "pianoevent", "pianoscare", true, 1);
}

void room1(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle1", false, false);
SetLampLit("candle2", false, false);
SetLampLit("candle3", false, false);
SetSwingDoorClosed("doorslam2", true, true);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
}

void pianoscare(string &in asParent, string &in asChild, int alState)
{
SetLeverStuckState("piano", -1, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", false);
CreateParticleSystem("", "ps_dust_impact.ps", "impact", false);
}


void OnLeave()

{

}
No Sad Still string problems Sad
1) Delete map cache file. Close Amnesia before doing this.
2) Check the name of the area -- capitalization, spelling errors, etc
3) Add debug messages to make sure the collision is actually happening.
I fixed it thank you all for your Help Smile