Frictional Games Forum (read-only)
crowbar no effect when destroy door - 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: crowbar no effect when destroy door (/thread-16381.html)



crowbar no effect when destroy door - Hartmann - 06-21-2012

i made a script for a crowbar destroying a door. the door opens but no sound or breaking effecks will show please help!. and the door is still there when the crowbar is used. here is my whole hps


void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "crowbar_1", "castle_no_grav_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
}

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)

{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}

void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_no_grav_1", false, true);
AddPropImpulse("castle_no_grav_1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("castle_no_grav_1", true);
SetSwingDoorClosed("castle_no_grav_1", false, false);
SetMoveObjectState("castle_no_grav_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}

void OnEnter()
{
}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}


RE: crowbar no effect when destroy door - Cruzore - 06-21-2012

try to add extensions.
for particles: .ps
for sound: .snt


RE: crowbar no effect when destroy door - The Shanus - 06-21-2012

(06-21-2012, 08:38 PM)FastHunteR Wrote: try to add extensions.
for particles: .ps
for sound: .snt
Not sure you should say try - You should do it. Trying implies you might fail the task at hand, which let's be honest, wouldn't be a good story to tell your grandchildren Big Grin I think what I'm trying to say is.. I'm confirming FastHunteR.


RE: crowbar no effect when destroy door - Cruzore - 06-21-2012

I wasn't sure it it's really needed, so I wanted to say try to do that, since it may not Wink


RE: crowbar no effect when destroy door - The Shanus - 06-21-2012

(06-21-2012, 09:15 PM)FastHunteR Wrote: I wasn't sure it it's really needed, so I wanted to say try to do that, since it may not Wink
Yeah, I guessed that - but it does say on the wiki - I think - that for the first argument you need "name" and second "with extension".


RE: crowbar no effect when destroy door - DragonRuins - 06-24-2012

Take a look at your TimerSwitchShovel Function.
void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


PlaySoundAtEntity also requires an entity to be played at (this could also be a script area, or a normal entity). So what you need to do is this:


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "PUTENTITY NAME HERE", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


So, for example, whenever I use crowbars I have that sound played at the crowbar being used. So the code that I have for mine is:


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("", "puzzle_place_jar.snt", "crowbar_joint_1", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


Also, here is your code for the CollideAreaBreakDoor:
void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_no_grav_1", false, true);
AddPropImpulse("castle_no_grav_1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("castle_no_grav_1", true);
SetSwingDoorClosed("castle_no_grav_1", false, false);
SetMoveObjectState("castle_no_grav_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}

Now, You do actually have an entity defined for the sounds and PS effects. Have you created a script area with the name AreaBreakEffect and put it somewhere like the doorhandle? If not, you should try that and see if it works.