Frictional Games Forum (read-only)
Will this statue script work? - 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: Will this statue script work? (/thread-21613.html)



Will this statue script work? - Wank - 05-25-2013

I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive.

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

All the enemy 2 stuff is the statue


RE: Will this statue script work? - ExpectedIdentifier - 05-25-2013

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive.

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

All the enemy 2 stuff is the statue

This is not a scripting problem, it is the the entity itself. The entity is type static meaning that no matter what you do you won't be able to set it active/inactive. The only way you can do this is to create a new version of the statue using the ModelEditor. If you want to do this I can tell you how :-) Are you familiar with the ModelEditor?


RE: Will this statue script work? - Wank - 05-25-2013

(05-25-2013, 06:32 PM)sonataarctica Wrote:
(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive.

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

All the enemy 2 stuff is the statue

This is not a scripting problem, it is the the entity itself. The entity is type static meaning that no matter what you do you won't be able to set it active/inactive. The only way you can do this is to create a new version of the statue using the ModelEditor. If you want to do this I can tell you how :-) Are you familiar with the ModelEditor?

No, i'm not. All I have really used is the LevelEditor.

(05-25-2013, 06:34 PM)Wank Wrote:
(05-25-2013, 06:32 PM)sonataarctica Wrote:
(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive.

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

All the enemy 2 stuff is the statue

This is not a scripting problem, it is the the entity itself. The entity is type static meaning that no matter what you do you won't be able to set it active/inactive. The only way you can do this is to create a new version of the statue using the ModelEditor. If you want to do this I can tell you how :-) Are you familiar with the ModelEditor?

No, i'm not. All I have really used is the LevelEditor.

And I would love to be taught!


RE: Will this statue script work? - ExpectedIdentifier - 05-25-2013

(05-25-2013, 06:34 PM)Wank Wrote:
(05-25-2013, 06:32 PM)sonataarctica Wrote:
(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive.

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

All the enemy 2 stuff is the statue

This is not a scripting problem, it is the the entity itself. The entity is type static meaning that no matter what you do you won't be able to set it active/inactive. The only way you can do this is to create a new version of the statue using the ModelEditor. If you want to do this I can tell you how :-) Are you familiar with the ModelEditor?

No, i'm not. All I have really used is the LevelEditor.

It's pretty simple really Big Grin Incase you want to try -

-Open the Model Editor
-Open the statue entity that you want to change
-Click Settings on the top menu
-Change the Type to Object (it's StaticProp currently)
-That's it! Save it as a new entity in your own custom story folder. This statue will be able to be activated and deactivated.


RE: Will this statue script work? - Wank - 05-25-2013

(05-25-2013, 06:38 PM)sonataarctica Wrote:
(05-25-2013, 06:34 PM)Wank Wrote:
(05-25-2013, 06:32 PM)sonataarctica Wrote:
(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive.

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}

All the enemy 2 stuff is the statue

This is not a scripting problem, it is the the entity itself. The entity is type static meaning that no matter what you do you won't be able to set it active/inactive. The only way you can do this is to create a new version of the statue using the ModelEditor. If you want to do this I can tell you how :-) Are you familiar with the ModelEditor?

No, i'm not. All I have really used is the LevelEditor.

It's pretty simple really Big Grin Incase you want to try -

-Open the Model Editor
-Open the statue entity that you want to change
-Click Settings on the top menu
-Change the Type to Object (it's StaticProp currently)
-That's it! Save it as a new entity in your own custom story folder. This statue will be able to be activated and deactivated.

YES! Thank you, I appreciate it!


RE: Will this statue script work? - ExpectedIdentifier - 05-25-2013

(05-25-2013, 06:45 PM)Wank Wrote:
(05-25-2013, 06:38 PM)sonataarctica Wrote:
(05-25-2013, 06:34 PM)Wank Wrote:
(05-25-2013, 06:32 PM)sonataarctica Wrote:
(05-25-2013, 06:12 PM)Wank Wrote: I want to make a statue appear, so I used the active entity script. I get no errors, but it doesn't work. I had already set it as inactive, but you can see it. The Enemy2 things are the statue. Is there another script for this?

void OnStart()
{
AddEntityCollideCallback("Player", "scr_spawnEnemy1", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "spawnEnemy2", "EventCollide", true, 1);
AddUseItemCallback("", "key_study_one", "mansion_3", "UseKeyOnDoor", true);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy1", true);
AddEnemyPatrolNode("Enemy1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Enemy1", "PathNodeArea_6", 0, "");
}

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem(asItem);
}
void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy2", true);
}


All the enemy 2 stuff is the statue

This is not a scripting problem, it is the the entity itself. The entity is type static meaning that no matter what you do you won't be able to set it active/inactive. The only way you can do this is to create a new version of the statue using the ModelEditor. If you want to do this I can tell you how :-) Are you familiar with the ModelEditor?

No, i'm not. All I have really used is the LevelEditor.

It's pretty simple really Big Grin Incase you want to try -

-Open the Model Editor
-Open the statue entity that you want to change
-Click Settings on the top menu
-Change the Type to Object (it's StaticProp currently)
-That's it! Save it as a new entity in your own custom story folder. This statue will be able to be activated and deactivated.

YES! Thank you, I appreciate it!

Got it working? Big Grin Good job! And no problem.