Hartmann
Member
Posts: 52
Threads: 18
Joined: Jun 2012
Reputation:
0
|
crowbar no effect when destroy door
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()
{
}
(This post was last modified: 06-21-2012, 08:39 PM by Hartmann.)
|
|
06-21-2012, 08:34 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: crowbar no effect when destroy door
try to add extensions.
for particles: .ps
for sound: .snt
|
|
06-21-2012, 08:38 PM |
|
The Shanus
Member
Posts: 134
Threads: 15
Joined: Jun 2012
Reputation:
3
|
RE: crowbar no effect when destroy door
(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 I think what I'm trying to say is.. I'm confirming FastHunteR.
|
|
06-21-2012, 09:14 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: crowbar no effect when destroy door
I wasn't sure it it's really needed, so I wanted to say try to do that, since it may not
|
|
06-21-2012, 09:15 PM |
|
The Shanus
Member
Posts: 134
Threads: 15
Joined: Jun 2012
Reputation:
3
|
RE: crowbar no effect when destroy door
(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 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".
|
|
06-21-2012, 09:28 PM |
|
DragonRuins
Junior Member
Posts: 19
Threads: 4
Joined: Mar 2012
Reputation:
1
|
RE: crowbar no effect when destroy door
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.
|
|
06-24-2012, 02:11 AM |
|
|