Frictional Games Forum (read-only)
Help,multiple scripts in one map! - 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: Help,multiple scripts in one map! (/thread-11992.html)

Pages: 1 2 3


RE: Help,multiple scripts in one map! - Datguy5 - 01-02-2012

(01-01-2012, 07:48 PM)stokesie95 Wrote: yes you would

ok
EDIT:I cant hear anything when the statue appears D:




RE: Help,multiple scripts in one map! - flamez3 - 01-02-2012

Post the script.


RE: Help,multiple scripts in one map! - Datguy5 - 01-02-2012

Heres the script
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "04_scream.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

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

}



RE: Help,multiple scripts in one map! - flamez3 - 01-03-2012

I know this sounds silly, but have you tired to quit the story and reload it?


RE: Help,multiple scripts in one map! - Datguy5 - 01-03-2012

(01-03-2012, 12:52 AM)flamez3 Wrote: I know this sounds silly, but have you tired to quit the story and reload it?
Hmm no actually Big Grin but ill give it a try now.
EDIT:Yay it worked!Thank you!




RE: Help,multiple scripts in one map! - Datguy5 - 01-03-2012

But now i have another problem D: I am trying to make another key that opens another door,but it doesnt work Sad Heres the hps file
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "Bigroomkey", "door2", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "scare_ghost.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bigroomkey", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("Bigroomkey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

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

}
The crash report says something about same parameters and stuff.



RE: Help,multiple scripts in one map! - MrBigzy - 01-03-2012

You can't have two functions with the same name and parameters; rename one of the key functions.


RE: Help,multiple scripts in one map! - Datguy5 - 01-03-2012

(01-03-2012, 06:22 PM)MrBigzy Wrote: You can't have two functions with the same name and parameters; rename one of the key functions.

What should i change?I just want that the door opens when key is used to it.




RE: Help,multiple scripts in one map! - MrBigzy - 01-03-2012

Just rename one of the KeyOnDoor functions to KeyOnDoor2 or something like that, for example:

Code:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "Bigroomkey", "door2", "KeyOnDoor2", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "scare_ghost.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bigroomkey", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("Bigroomkey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

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

}



RE: Help,multiple scripts in one map! - Datguy5 - 01-03-2012

(01-03-2012, 07:42 PM)MrBigzy Wrote: Just rename one of the KeyOnDoor functions to KeyOnDoor2 or something like that, for example:

Code:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "Bigroomkey", "door2", "KeyOnDoor2", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "scare_ghost.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bigroomkey", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("Bigroomkey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

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

}

Ohh i see.Thank you mister!


Well now the key goes to the door,but the door stays locked Sad