Scripts not working - 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: Scripts not working (/thread-12567.html) Pages:
1
2
|
Scripts not working - Bozcovich - 01-12-2012 Hey, ive recently started making a custom story (my first). I cant get the scripts to start working, i have a script to open a door with a key, but it doesnt work, and i have a script that gives the player a lantern in the begginning and that doesnt work either. Help please? Here is the scripts: Door: void OnStart() { AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true); } void hax(string &in item, string &in door) { SetSwingDoorLocked(door, false, true); PlaySoundAtEntity("", "unlock_door", door, 0, false); RemoveItem(item); } void OnEnter() { } void OnLeave() { } Lantern: //=========================================== void OnStart() { if(ScriptDebugOn()) { GiveItemFromFile("lantern", "lantern.ent"); SetPlayerLampOil(100.0f); for(int i = 0;i < 10;i++) { GiveItemFromFile("tinderbox", "tinderbox.ent"); } } } void OnEnter() { } void OnLeave() { } And i cant see the maps when i am in the folder if that is a problem. I have named the .hps file the same as the map. RE: Scripts not working - Statyk - 01-13-2012 Do you have two "void OnStart"s? ALSO: This is in the wrong section. Should be in the Development Support. RE: Scripts not working - flamez3 - 01-13-2012 Use this: Quote:void OnStart()Whenever you are naming something in a field that has the word "string" in it means that you need to put the exact name of the thing you are describing as well as "" around the start and end of the text. I fixed it up for you. RE: Scripts not working - Bozcovich - 01-13-2012 Now the key just disappears, the door is still locked And i used the exact code you gave me RE: Scripts not working - Unearthlybrutal - 01-13-2012 (01-13-2012, 09:22 PM)Bozcovich Wrote: Now the key just disappears, the door is still locked And i used the exact code you gave meIs it swing door or level door? RE: Scripts not working - Bozcovich - 01-13-2012 Its a level door, but i tried it with a swing aswell :S RE: Scripts not working - Unearthlybrutal - 01-13-2012 Try this: Spoiler below!
RE: Scripts not working - Bozcovich - 01-13-2012 Same problem :/ RE: Scripts not working - oscar1007 - 01-13-2012 (01-12-2012, 09:54 PM)Bozcovich Wrote: Hey, ive recently started making a custom story (my first). I cant get the scripts to start working, i have a script to open a door with a key, but it doesnt work, and i have a script that gives the player a lantern in the begginning and that doesnt work either. Help please? Instead of having this: SetSwingDoorLocked(door, false, true); Try this: SetSwingDoorLocked("das door", false); Or if its a level door: SetLevelDoorLocked("das door", false); peace out. hope it works! RE: Scripts not working - Bozcovich - 01-13-2012 That didnt work either, but i just tried this and it worked: void OnStart() { AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true); if(ScriptDebugOn()) { GiveItemFromFile("lantern", "lantern.ent"); SetPlayerLampOil(100.0f); for(int i = 0;i < 10;i++) { GiveItemFromFile("tinderbox", "tinderbox.ent"); } } } void hax(string &in asItem, string &in asEntity) { SetLevelDoorLocked("das door", false); PlaySoundAtEntity("", "unlock_door", "door" , 0, false); RemoveItem("SUPER HAX KEY THAT SUCKS"); } void OnEnter() { } void OnLeave() { } |