Frictional Games Forum (read-only)
What's wrong..? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: What's wrong..? (/thread-7812.html)

Pages: 1 2


What's wrong..? - DannieWest - 05-04-2011

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


RE: What's wrong..? - Russ Money - 05-04-2011

void AddEntityCollideCallback("Player", "ScriptArea_1", "AddPropImpulse", true, 0);

Remove the ; at the end.


RE: What's wrong..? - DannieWest - 05-04-2011

(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


RE: What's wrong..? - Russ Money - 05-04-2011

AddPropImpulse(Hatchet_1, 0, 10, 0, "world");

Also needs to be "Hatchet_1"


RE: What's wrong..? - DannieWest - 05-04-2011

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


RE: What's wrong..? - Acies - 05-04-2011

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)


RE: What's wrong..? - DannieWest - 05-04-2011

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


RE: What's wrong..? - Roenlond - 05-04-2011

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


RE: What's wrong..? - DannieWest - 05-04-2011

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


RE: What's wrong..? - MrBigzy - 05-04-2011

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.