Frictional Games Forum (read-only)
Script wont work :S - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Script wont work :S (/thread-19715.html)



Script wont work :S - CptLogicDev - 12-29-2012

Hey got some problem with my Script for making a vase move away from a box down to the floor :S

here is the hps

Code:
void OnStart()
{
[u][i][b]AddEntityCollideCallback("Player", "ScriptArea_4", "paranormal1", true, 1);[/b][/i][/u]
AddEntityCollideCallback("Player", "scriptarea1", "LookAt", true, 1);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player", "InsanityArea_1", "Lookatdamage", false, 1);
AddEntityCollideCallback("Player", "Lookat2", "Lookat2Func", true, 1);
AddEntityCollideCallback("Monster", "MonsterDie", "MonsterDie", true, 1);
AddEntityCollideCallback("Player", "Inactivescriptarea", "Scream", true, 1);
PlayMusic("01_amb_darkness", true, 5, 2, 0, true);
SetEntityPlayerInteractCallback("Lab_key", "ActiveArea", true);
SetEnemyDisabled("graveyard_corpse_1", true);
SetEntityPlayerInteractCallback("EXAMPLE_DOOR", "frontdoor", false);
}
[u][b][i]void paranormal1(string &in asParent, string &in asChild, int alState)
{
AddPropForce("vase", 5, 0, 0, "world");
AddBodyForce("vase", 5, 0, 0, "world");
PlaySoundAtEntity("", "react_scare", "Player", 10, true);
}[/i][/b][/u]
void func_slam(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Doorslam", 1, 1, "");
SetSwingDoorClosed("Doorslam", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);  
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
StopPlayerLookAt();
}


void Lookatdamage(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(30, true);
}
void frontdoor(string &in asEntity)
{
SetMessage("Message", "LockedDoor", 0);
}


void MonsterDie(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", false);
}
void DoorLockedPlayer(string &in entity)

{
    if(GetSwingDoorLocked("EXAMPLE_DOOR") == true)
    {

        SetMessage("Messages", "LockedDoor", 2);

    }
}

void Scream(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
AddEnemyPatrolNode("Monster", "PathNodeArea_1", 2, "");
AddTimer("", 10, "Timertrigger2");
}
void Timertrigger2(string &in asTimer)
{
SetMessage("Message", "Whatwasthat", 5);
}

void ActiveArea(string &in asEntity)
{
SetEntityActive("Inactivescriptarea", true);
SetEntityActive("script_slam", true);
}
void LookAt(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("LookAt", 1, 2, "");
SetPlayerActive(false);
SetMessage("Message", "whathappend", 5);
AddTimer("", 5, "Timertrigger1");
}

void Timertrigger1(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();
}

void Lookat2Func(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("ScriptArea_1", 1, 2, "");
SetPlayerActive(false);
SetMessage("Message", "whatis", 5);
AddTimer("", 5, "Timertrigger3");
}
void Timertrigger3(string &in asTimer)
{
StartPlayerLookAt("ScriptArea_2", 1, 2, "");
AddTimer("", 5, "Timertrigger4");
}

void Timertrigger4(string &in asTimer)
{
StartPlayerLookAt("ScriptArea_3", 1, 2, "");
AddTimer("", 5, "Timertrigger5");
}
void Timertrigger5(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}




void OnLeave()
{

}



RE: Script wont work :S - TheGreatCthulhu - 12-29-2012

See all those lines with forum formatting tags - those things in []? Like this one:
[u ][i ][b ]AddEntityCollideCallback("Player", "ScriptArea_4", "paranormal1", true, 1);[/b ][/i ][/u ]

Well, those [u ][i ][b ] and [/b ][/i ][/u ] are a problem, since that's not HPL script, but just some forum tags the poster used to underline, italicize, and make bold that line of code for some reason. It should just be:
AddEntityCollideCallback("Player", "ScriptArea_4", "paranormal1", true, 1);

Clear those, or go back to where you copied that from, and just copy the plain text (unless there was some forum error, and the [] tags are visible anyway).


RE: Script wont work :S - Rapture - 12-29-2012

I guess it looks fine to me, does the "ScriptArea_4" match the Area in the map?
Does "vase" match the object's name in question that you wish to move.


RE: Script wont work :S - CptLogicDev - 12-29-2012

(12-29-2012, 04:04 AM)Rapture Wrote: I guess it looks fine to me, does the "ScriptArea_4" match the Area in the map?
Does "vase" match the object's name in question that you wish to move.

yes it has :S got no catch to :S

this is driving me crazy...


RE: Script wont work :S - NaxEla - 12-29-2012

Your forces are much too low to notice anything.

AddPropForce("vase", 5, 0, 0, "world");
AddBodyForce("vase", 5, 0, 0, "world");

Change those vales to something really large (like 5000) and see if it works. If it does work, then reduce the values so that it works how you want it to.


RE: Script wont work :S - CptLogicDev - 12-29-2012

(12-29-2012, 05:46 AM)NaxEla Wrote: Your forces are much too low to notice anything.

AddPropForce("vase", 5, 0, 0, "world");
AddBodyForce("vase", 5, 0, 0, "world");

Change those vales to something really large (like 5000) and see if it works. If it does work, then reduce the values so that it works how you want it to.

ah ty mate


RE: Script wont work :S - NaxEla - 12-29-2012

(12-29-2012, 09:12 PM)CptLogicDev Wrote:
(12-29-2012, 05:46 AM)NaxEla Wrote: Your forces are much too low to notice anything.

AddPropForce("vase", 5, 0, 0, "world");
AddBodyForce("vase", 5, 0, 0, "world");

Change those vales to something really large (like 5000) and see if it works. If it does work, then reduce the values so that it works how you want it to.

ah ty mate

Anytime, man Big Grin