Frictional Games Forum (read-only)

Full Version: What's wrong..?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This is my script, what's wrong with it?

void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);
{
AddPropImpulse(Hatchet_1, 0, 10, 0, "world");
}

I want the hatchet to fly open when the player enters ScriptArea_1, but I get an error saying "Unexpected token "{". The first part works..
void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);

Remove the ; at the end.
(05-04-2011, 01:33 PM)Russ Money Wrote: [ -> ]void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);

Remove the ; at the end.

Did that, and now it said "Expected data type"... Huh
AddPropImpulse(Hatchet_1, 0, 10, 0, "world");

Also needs to be "Hatchet_1"
(05-04-2011, 01:46 PM)Russ Money Wrote: [ -> ]AddPropImpulse(Hatchet_1, 0, 10, 0, "world");

Also needs to be "Hatchet_1"

No change, same error >.<
void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);
{
AddPropImpulse(Hatchet_1, 0, 10, 0, "world");
}

this part is wrong. You should put the:
void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "HatchSwing", true, 0);
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}

There are often two parts to something happening:
1. Set up the script (This part should be done OnEnter or OnStart.)
2. Define what happens when it executes (This part should be done after Onstart or OnEnter)
Quote:There are often two parts to something happening:
1. Set up the script (This part should be done OnEnter or OnStart.)
2. Define what happens when it executes (This part should be done after Onstart or OnEnter)
So basicly, all stuff that is going to happen in the map could be put in between the first two barracks, or w/e they're called, and then u put out definitions to them below?

Sorry, still not working. Got an error saying Unexpected end of file. ..? This is the script now:
"void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", HatchSwing", true, 0);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}"
(05-04-2011, 02:31 PM)DannieWest Wrote: [ -> ]
Quote:There are often two parts to something happening:
1. Set up the script (This part should be done OnEnter or OnStart.)
2. Define what happens when it executes (This part should be done after Onstart or OnEnter)
So basicly, all stuff that is going to happen in the map could be put in between the first two barracks, or w/e they're called, and then u put out definitions to them below?

Sorry, still not working. Got an error saying Unexpected end of file. ..? This is the script now:
"void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", HatchSwing", true, 0);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}"

Spoiler below!

"void OnStart()
{
AddUseItemCallback("", "Honey", "mansion_1", "UsedHoneyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "HatchSwing", true, 0);
}

void UsedHoneyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
RemoveItem("Honey");
}

void HatchSwing(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Hatchet_1", 0, 10, 0, "world");
}"


Missed the bold quote on hatchswing. "AddEntityCollideCallback("Player", "ScriptArea_1", "HatchSwing", true, 0);"
LOL!
Well, thanks alot! Now the map is working, only prob is the hatch dun move anything... do I have to low values? Tried changing to 100 and then 1000, but nothing happens :o
Yea, usually I have values around 5000 for small rocks D:

If it's a hatch affected by gravity, you'll need to use a timer and give it a bunch of pushes in a row.
Pages: 1 2