Frictional Games Forum (read-only)
Add all simple scripts here! - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Add all simple scripts here! (/thread-5702.html)

Pages: 1 2 3


RE: Add all simple scripts here! - HumiliatioN - 12-13-2010

Okay problem: I dont have any errors in this script but why this doesnt work?

Full Script:

void OnStart()
{
AddEntityCollideCallback("Player" , "Origin" , "scareactive" , true , 1);
}

void scareactivate(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_1" , true);
}

////////////////////////////
// Run when entering map

void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "door_2", "KeyOnDoor2", true);
}

////////////////////////////
// Run when leaving map

void OnLeave()
{
}

////////////////////////////
// Actual functions

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}

I have not activated Monster entity and all names alright but why monster doesnt appears in the marked area?


RE: Add all simple scripts here! - Akumasama - 12-13-2010

AddEntityCollideCallback("Player" , "Origin" , "scareactive" , true , 1);
void scareactivate(string &in asParent , string &in asChild , int alState)

Take a very good look at the function name Wink


RE: Add all simple scripts here! - HumiliatioN - 12-13-2010

(12-13-2010, 05:34 PM)Akumasama Wrote: AddEntityCollideCallback("Player" , "Origin" , "scareactive" , true , 1);
void scareactivate(string &in asParent , string &in asChild , int alState)

Take a very good look at the function name Wink

Where i dont see :S


RE: Add all simple scripts here! - Akumasama - 12-13-2010

scareactive
scareactivate

See it now? Tongue


RE: Add all simple scripts here! - HumiliatioN - 12-13-2010

(12-13-2010, 06:51 PM)Akumasama Wrote: scareactive
scareactivate

See it now? Tongue

Oh xD

Okay but it doesnt work anyways :I


RE: Add all simple scripts here! - HumiliatioN - 12-14-2010

(12-13-2010, 10:55 PM)HumiliatioN Wrote:
(12-13-2010, 06:51 PM)Akumasama Wrote: scareactive
scareactivate

See it now? Tongue

Oh xD

Okay but it doesnt work anyways :I

Help me with this! Huh


RE: Add all simple scripts here! - Akumasama - 12-14-2010

Code:
void OnStart()
{
AddEntityCollideCallback("Player" , "Origin" , "scareactive" , true , 1);
}

////////////////////////////
// Run when entering map

void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "door_2", "KeyOnDoor2", true);
}

////////////////////////////
// Run when leaving map

void OnLeave()
{
}

////////////////////////////
// Actual functions

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}


void scareactive(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_1" , true);
AddEnemyPatrolNode("enemyname", "nodename", waiting time (for example: 0.0f), "animation to play");
}

You have to add path nodes when spawning a monster, or it will despawn right away.
This is because after a monster has walked it's last path, it will disappear, hence, having no path, it will disappear right away.

Again, make sure everything is organized.
Put your functions that don't belong in any of the "On...." functions, at the end of your script.


RE: Add all simple scripts here! - HumiliatioN - 12-14-2010

(12-14-2010, 11:18 AM)Akumasama Wrote:
Code:
void OnStart()
{
AddEntityCollideCallback("Player" , "Origin" , "scareactive" , true , 1);
}

////////////////////////////
// Run when entering map

void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "door_2", "KeyOnDoor2", true);
}

////////////////////////////
// Run when leaving map

void OnLeave()
{
}

////////////////////////////
// Actual functions

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}


void scareactive(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_1" , true);
AddEnemyPatrolNode("enemyname", "nodename", waiting time (for example: 0.0f), "animation to play");
}

You have to add path nodes when spawning a monster, or it will despawn right away.
This is because after a monster has walked it's last path, it will disappear, hence, having no path, it will disappear right away.

Again, make sure everything is organized.
Put your functions that don't belong in any of the "On...." functions, at the end of your script.

Thanks! Now i got it hallucinating zombie its working! Smile


RE: Add all simple scripts here! - HumiliatioN - 12-14-2010

(12-14-2010, 04:00 PM)HumiliatioN Wrote:
(12-14-2010, 11:18 AM)Akumasama Wrote:
Code:
void OnStart()
{
AddEntityCollideCallback("Player" , "Origin" , "scareactive" , true , 1);
}

////////////////////////////
// Run when entering map

void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_2", "door_2", "KeyOnDoor2", true);
}

////////////////////////////
// Run when leaving map

void OnLeave()
{
}

////////////////////////////
// Actual functions

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_2", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, true);
}


void scareactive(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("monster_1" , true);
AddEnemyPatrolNode("enemyname", "nodename", waiting time (for example: 0.0f), "animation to play");
}

You have to add path nodes when spawning a monster, or it will despawn right away.
This is because after a monster has walked it's last path, it will disappear, hence, having no path, it will disappear right away.

Again, make sure everything is organized.
Put your functions that don't belong in any of the "On...." functions, at the end of your script.

Thanks! Now i got it hallucinating zombie its working! Smile

Okay i have more questions: How i can make readable note? (I mean i can read my note what i write in there)


RE: Add all simple scripts here! - Akumasama - 12-14-2010

http://wiki.frictionalgames.com/hpl2/tutorials/script/howtomakenotes
There you go.
Ask for more help if you can't figure it out Smile