Scripting, need urgent help! - 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: Scripting, need urgent help! (/thread-9259.html) |
RE: Scripting, need urgent help! - Kyle - 07-27-2011 There is no SetEntityCallbackFunc. SetEntityCollideCallback? I don't know what you're doing, but if it is a SetEntityCollideCallback, it would look like this: SetEntityCollideCallback("Player", "notethree", "Func", true, 1); :/ RE: Scripting, need urgent help! - JetlinerX - 07-27-2011 Hm, now I get errors on 13,25 and 15,1. Full code, I am trying to get sounds to play, and the player to be forced to look up. } SetEntityCollideCallback("Player", "notethree", "Func", true, 1); void Func(string &in asEntity, string &in type) if(type == "OnPickup") { PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false); PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false); StartPlayerLookAt(string& Player,3,3,""); AddTimer("atticscare", 1, "Func2"); } RE: Scripting, need urgent help! - xiphirx - 07-27-2011 Uhm... where's your syntax? SetEntityCollideCallback should be in a function, not out on its own. After you declare a function header you need to open brackets ( {} ) and encapsulate your commands within it... RE: Scripting, need urgent help! - JetlinerX - 07-27-2011 Sorry... what? I am totally new to scripting and I didnt understand any of that xD RE: Scripting, need urgent help! - Kyle - 07-27-2011 (07-27-2011, 03:50 AM)xiphirx Wrote: Uhm... where's your syntax? Excuse you smart ass, of course it should be in a function. He's going to have to replace SetEntityCallbackFunc("notethree", "Func"); with SetEntityCollideCallback("Player", "notethree", "Func", true, 1); so it should already be in a function. -_- RE: Scripting, need urgent help! - JetlinerX - 07-27-2011 Ehhhhh... *brain explodes* RE: Scripting, need urgent help! - xiphirx - 07-27-2011 (07-27-2011, 03:54 AM)Kyle Wrote:(07-27-2011, 03:50 AM)xiphirx Wrote: Uhm... where's your syntax? *sigh* JetlinerX: You don't have any form to your code... Code: } Is what you posted. Code: SetEntityCollideCallback("Player", "notethree", "Func", true, 1); Should be inside of one of the predefined functions (something like OnEnter) not out on its own (global scope, which basically means its not contained within brackets) So... Code: void OnEnter() Like that. Now, moving on... Code: void Func(string &in asEntity, string &in type) You're missing the brackets for the function here: Code: void Func(string &in asEntity, string &in type) (as a side note, you always want to indent your code, it makes it easier to read) also, you have an error in your "StartPlayerLookAt" function call... Code: StartPlayerLookAt(string& Player,3,3,""); you don't need to include the type of value when you pass it as a parameter, this is why you do it in the function's declaration or prototype. Code: StartPlayerLookAt("Player", 3.0f, 3.0f, ""); Overall, I would REALLY suggest just getting the basics down of C++, syntax wise as it seems to be your only problem... RE: Scripting, need urgent help! - JetlinerX - 07-27-2011 Wow... you know, I appreciate the help, but maybe a little less attitude would be nice. However, I am still getting an error that says: Unexpected End of File. My CURRENT code: void OnEnter () { AddUseItemCallback("", "keyone", "door1", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door1", false, true); PlaySoundAtEntity("", "unlock_door.snt", "door1", 0, false); RemoveItem("keyone"); { SetEntityCollideCallback("Player", "notethree", "Func", true, 1); } { if(type == "OnPickup") { PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0, false); PlaySoundAtEntity("", "react_pant5.snt", "Player", 0, false); StartPlayerLookAt("Player", 3.0f, 3.0f, ""); AddTimer("atticscare", 1, "Func2"); } } void OnLeave () { } RE: Scripting, need urgent help! - xiphirx - 07-27-2011 (07-27-2011, 06:40 AM)JetlinerX Wrote: Wow... you know, I appreciate the help, but maybe a little less attitude would be nice. However, I am still getting an error that says: Unexpected End of File. My CURRENT code: What attitude? Also, you have stray brackets... not sure what they're for..? Code: void OnEnter () Code: if(type == "OnPickup") You need to associate this with a function, it cant be in the global scope by itself. RE: Scripting, need urgent help! - JetlinerX - 07-27-2011 Okay, what exactly is a function (with example of one used in this situation please) Sorry. EDIT: Unexpected token on 15,5. But when token (if). |