Frictional Games Forum (read-only)
Script order? - 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: Script order? (/thread-20690.html)

Pages: 1 2


Script order? - mrsomeepicrandomguy - 03-10-2013

Hello, i have a question. If a have a message before a door unlock in my script, why cant i use the key before i see the message? is it just me being retard? :p


RE: Script order? - OriginalUsername - 03-10-2013

Could you post the script please?


RE: Script order? - mrsomeepicrandomguy - 03-10-2013

(03-10-2013, 10:33 AM)Smoke Wrote: Could you post the script please?

void OnStart()
{
void Message1(string &in asChild, string &in asParent, int alState)
}
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
}
{
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}



void OnLeave()
{

}


RE: Script order? - No Author - 03-10-2013

(03-10-2013, 10:43 AM)mrsomeepicrandomguy Wrote:
(03-10-2013, 10:33 AM)Smoke Wrote: Could you post the script please?

void OnStart()
{
void Message1(string &in asChild, string &in asParent, int alState)
}
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
}
{
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}



void OnLeave()
{

}

The script is a mess. Are you sure this is your full script ?


RE: Script order? - mrsomeepicrandomguy - 03-10-2013

(03-10-2013, 10:47 AM)No Author Wrote:
(03-10-2013, 10:43 AM)mrsomeepicrandomguy Wrote:
(03-10-2013, 10:33 AM)Smoke Wrote: Could you post the script please?

void OnStart()
{
void Message1(string &in asChild, string &in asParent, int alState)
}
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
}
{
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}



void OnLeave()
{

}

The script is a mess. Are you sure this is your full script ?
Yes, Its kinda messy but it does what it should, just that i have to walk into the message area befor i can unlock the door.


RE: Script order? - No Author - 03-10-2013

Have you tested it ?


RE: Script order? - mrsomeepicrandomguy - 03-10-2013

(03-10-2013, 11:10 AM)No Author Wrote: Have you tested it ?
Yes, everything works, but you have to do it in order, and I don't want that.


RE: Script order? - No Author - 03-10-2013

I'm very confused right now.
Cuz, the script you post has a void Message on the void OnStart, there's a double "}" on the void OnStart, AND the game doesn't give an error because of that.


RE: Script order? - mrsomeepicrandomguy - 03-10-2013

(03-10-2013, 11:27 AM)No Author Wrote: I'm very confused right now.
Cuz, the script you post has a void Message on the void OnStart, there's a double "}" on the void OnStart, AND the game doesn't give an error because of that.
Thats weird.. know when i looked at it you right. Don't really know what my game is doing..


RE: Script order? - Lizard - 03-10-2013

Try do it like this.

void OnStart()
{
AddEntityCollideCallback("player" , "Scriptarea_1" , "FunctionName" , true , 1);
AddUseItemCallback("", "key_2", "EXAMPLE_DOOR", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}

void FunctionName(string &in asParent , string &in asChild , int alState)
{
PlaySoundAtEntity("", "unlock_door", "Scriptarea_1", 0, false);
}

void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup4", 6); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);
}

void OnLeave()
{

}