Frictional Games Forum (read-only)
Script Problems - 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 Problems (/thread-20613.html)

Pages: 1 2 3 4 5 6 7 8 9


RE: Script Problems - Adrianis - 03-13-2013

(03-13-2013, 05:26 PM)Coolfromdah00d Wrote:
(03-13-2013, 05:14 PM)Adrianis Wrote: EDIT: Wait, you've got 2 functions called UsedKeyOnDoor. Name one of those different, because as it is that won't work

I've tried to name it something else but then it cant find the function (or cant read it) any idea what I can name it to?

Code:
void OnStart ()
{
AddUseItemCallback("", "StrangeDoorKey", "door03", "UsedKeyOnDoor2", false);
SetEntityCallbackFunc("GuestRoomKey", "jump");
AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", false);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false);
StartScreenShake(0.5f, 2, 0, 0.25);
GiveSanityDamage(5.0f, true);
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)

{
SetSwingDoorLocked("door03", false, true);
PlaySoundAtEntity("", "Unlock_door", "door03", 0, false);
RemoveItem("StrangeDoorKey");
}



RE: Script Problems - Coolfromdah00d - 03-13-2013

(03-13-2013, 05:38 PM)Adrianis Wrote:
(03-13-2013, 05:26 PM)Coolfromdah00d Wrote:
(03-13-2013, 05:14 PM)Adrianis Wrote: EDIT: Wait, you've got 2 functions called UsedKeyOnDoor. Name one of those different, because as it is that won't work

I've tried to name it something else but then it cant find the function (or cant read it) any idea what I can name it to?

Code:
void OnStart ()
{
AddUseItemCallback("", "StrangeDoorKey", "door03", "UsedKeyOnDoor2", false);
SetEntityCallbackFunc("GuestRoomKey", "jump");
AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", false);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false);
StartScreenShake(0.5f, 2, 0, 0.25);
GiveSanityDamage(5.0f, true);
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)

{
SetSwingDoorLocked("door03", false, true);
PlaySoundAtEntity("", "Unlock_door", "door03", 0, false);
RemoveItem("StrangeDoorKey");
}

a function with the same name and parameter already exists.


RE: Script Problems - Adrianis - 03-13-2013

That doesn't make any sense... thats the message you should have been getting before...
Did you definately overwrite all of the previous script with this one, and saved the script before loading the map?

Try this...

Code:
void OnStart ()
{
AddUseItemCallback("", "StrangeDoorKey", "door03", "UsedKeyOnDoor", false);
SetEntityCallbackFunc("GuestRoomKey", "jump");
AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", false);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "12_girl_scream.snt", "corpse01", 0, false);
StartScreenShake(0.5f, 2, 0, 0.25);
GiveSanityDamage(5.0f, true);
}



RE: Script Problems - PutraenusAlivius - 03-14-2013

PHP Code:
void OnStart()
{
AddUseItemCallback("""StrangeDoorKey""door03""UsedKeyOnDoor2"false);
SetEntityCallbackFunc("GuestRoomKey""jump");
AddUseItemCallback("""GuestRoomKey""door01""UsedKeyOnDoor"false);
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked(asEntityfalsetrue);
PlaySoundAtEntity("""unlock_door.snt"asEntity0false);
RemoveItem(asItem);
}

void jump(string &in asEntitystring &in type)
{
SetEntityActive("corpse01"true);
PlaySoundAtEntity("""12_girl_scream.snt""corpse01"0false);
StartScreenShake(0.5f200.25);
GiveSanityDamage(5.0ftrue);
}

void UsedKeyOnDoor2(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked(asEntityfalsetrue);
PlaySoundAtEntity("""unlock_door.snt"asEntity0false);
RemoveItem(asItem);

I also added a few things from Adrianis' script.


RE: Script Problems - Adrianis - 03-14-2013

(03-14-2013, 06:47 AM)JustAnotherPlayer Wrote: *code*

I also added a few things from Adrianis' script.

Check the previous script dude - you can fit it all into 1 function using the parameters rather than hard coded names, and having the 2 functions didn't work, he said


RE: Script Problems - Coolfromdah00d - 03-14-2013

(03-14-2013, 10:34 AM)Adrianis Wrote:
(03-14-2013, 06:47 AM)JustAnotherPlayer Wrote: *code*

I also added a few things from Adrianis' script.

Check the previous script dude - you can fit it all into 1 function using the parameters rather than hard coded names, and having the 2 functions didn't work, he said

Guess the message that shows up when I try to use the key on the door...


RE: Script Problems - Adrianis - 03-15-2013

I'd really rather you told me Smile

The whole error message if that's ok, cause it might help


RE: Script Problems - PutraenusAlivius - 03-15-2013

Eight pages. Longest script error thread ever.


RE: Script Problems - No Author - 03-15-2013

(03-14-2013, 09:39 PM)Coolfromdah00d Wrote: Guess the message that shows up when I try to use the key on the door...

Cannot use item ?


RE: Script Problems - Coolfromdah00d - 03-15-2013

(03-15-2013, 05:40 AM)No Author Wrote:
(03-14-2013, 09:39 PM)Coolfromdah00d Wrote: Guess the message that shows up when I try to use the key on the door...

Cannot use item ?

yep