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) |
RE: Script Problems - Adrianis - 03-12-2013 (03-10-2013, 12:52 PM)JustAnotherPlayer Wrote: When i was seeing the script functions on the Script Functions thread, what does internal name mean? Off-topic first - unfortunately as far as I can tell, the usage of 'internal name' changes. Sometimes it's the name for the callback/connection you have made, for example in AddUseItemCallback, internal name refers to the name of the callback you have made, so that you can use RemoveCallback with that name to remove it. But then there are several examples, such as SetEntityPlayerInteractCallback, where internal name refers to the name of the entity. It's a little inconsistent. PHP Code: void OnStart() Just a note, PlaySoundAtEntity function, the sound name requires the .snt extension PlaySoundAtEntity("", "Unlock_door.snt", "door01", 0, false); Also, UnlockDoor func uses uppercase Unlock_door for the sound name, wheras UnlockStrangeDoor uses lowercase unlock_door, one of those is wrong. On the actual problem of the 'cannot use item this way' message, try giving the AddUseItemCallback an internal name (the first parameter), something like "callback1" & "callback2" just to test if that's the issue, and double check the names of the keys in the inventory & the doors RE: Script Problems - No Author - 03-12-2013 This thread is the longest script error thread. RE: Script Problems - Adrianis - 03-12-2013 I had one go 8 pages before iirc, that one basically came down to me begging the guy not to give up on it xD Hopefully this won't end the same way! RE: Script Problems - Coolfromdah00d - 03-13-2013 (03-12-2013, 01:45 PM)Adrianis Wrote: I had one go 8 pages before iirc, that one basically came down to me begging the guy not to give up on it xD I'll test the new scriptings you've fixed. if it desent work I don't knw what to do (03-13-2013, 07:32 AM)Coolfromdah00d Wrote:(03-12-2013, 01:45 PM)Adrianis Wrote: I had one go 8 pages before iirc, that one basically came down to me begging the guy not to give up on it xD First I got the "no matching signatures to AddUseItemCallback1" error so i tried to change the void function instead but I got the cannot use this item thi way error anyway. I dont understand, it works with the first door but not with the second one. RE: Script Problems - PutraenusAlivius - 03-13-2013 Try removing the PHP Code: SetEntityCallbackFunc RE: Script Problems - Adrianis - 03-13-2013 (03-13-2013, 07:32 AM)Coolfromdah00d Wrote: I'll test the new scriptings you've fixed. if it desent work I don't knw what to do Sorry if you misunderstood, but I didn't fix anything, the code I posted was yours un-edited Can you post your most recent script up? RE: Script Problems - PutraenusAlivius - 03-13-2013 PHP Code: void OnStart() PHP Code: void SetEntityCallbackFunc(string& asName, string& asCallback); PHP Code: string & asName PHP Code: string& asCallback RE: Script Problems - Coolfromdah00d - 03-13-2013 (03-13-2013, 03:34 PM)JustAnotherPlayer Wrote:Here's the most recent scriptings I've made void OnStart () { AddUseItemCallback("", "StrangeDoorKey", "door03", "UsedKeyOnDoor", 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 UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door03", false, true); PlaySoundAtEntity("", "Unlock_door", "door03", 0, false); RemoveItem("StrangeDoorKey"); } RE: Script Problems - Adrianis - 03-13-2013 EDIT: Wait, you've got 2 functions called UsedKeyOnDoor. Name one of those different, because as it is that won't work RE: Script Problems - Coolfromdah00d - 03-13-2013 (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? |