Bonehead
Member
Posts: 50
Threads: 12
Joined: Apr 2013
Reputation:
1
|
RE: Entity Activate/Deactivate?
Here's my entire script.
void OnStart()
{
SetEntityPlayerInteractCallback("key_tower_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("chemical_container_full_1", "OnPickup");
}
void OnEnter()
{
}
void OnLeave()
{
}
void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", 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);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
}
|
|
05-19-2013, 05:56 PM |
|
Kullin
Member
Posts: 218
Threads: 23
Joined: May 2013
Reputation:
3
|
RE: Entity Activate/Deactivate?
void OnStart()
{
SetEntityPlayerInteractCallback("key_tower_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("chemical_container_full_1", "OnPickup");
}
void OnEnter()
{
}
void OnLeave()
{
}
void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", 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);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("","impact_wood_heavy_low3.snt","armour_nice_complete_7", 0.1, true);
PlaySoundAtEntity("","impact_wood_heavy_low3.snt","armour_nice_complete_8", 0.1, true);
}
That should work with the sounds to.
|
|
05-19-2013, 06:56 PM |
|
Bonehead
Member
Posts: 50
Threads: 12
Joined: Apr 2013
Reputation:
1
|
RE: Entity Activate/Deactivate?
I'll give it a shot.
Didn't crash. no sound played though.
(This post was last modified: 05-19-2013, 07:40 PM by Bonehead.)
|
|
05-19-2013, 07:36 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Entity Activate/Deactivate?
void OnStart()
{
SetEntityPlayerInteractCallback("key_tower_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("chemical_container_full_1", "OnPickup");
}
void OnEnter()
{
}
void OnLeave()
{
}
void ActivateMonster(string &in asEntity) //You have the wrong callback syntax.
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0.001f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0.001f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0.001f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0.001f, "");
//I replaced 0 with 0.001f so that the monster won't stop at each PathNode.
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("","impact_wood_heavy_low.snt","armour_nice_complete_7", 0.1f, true);
PlaySoundAtEntity("","impact_wood_heavy_low.snt","armour_nice_complete_8", 0.1f, true);
}
Fixed.
Word of advice: When using sounds, at least check if they match or not.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-20-2013, 02:50 AM |
|
|