i forgot how to script :c - 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: i forgot how to script :c (/thread-19547.html) |
RE: i forgot how to script :c - TheGreatCthulhu - 12-17-2012 (12-17-2012, 12:13 PM)nightsxp Wrote: what;s wrong??This is wrong: AddEntityCollideCallback("Player","Area ","lantern"); That function takes 5 parameters, not 3; look at the declaration (this is the declaration, not how you call it!): Code: void AddEntityCollideCallback( Next, if you want the gothrough() function to be called by the game when the player and the area collide, then you have to specify it's name "gothrough" instead of "lantern" above - otherwise the engine will look for a callback function called "lantern", and it will never call this function. Also, when you have troubles, always describe the errors in more detail - what did you expect to happen vs what actually happens, what are the error messages, if any, etc... P.S. BTW, if you need a bit more guidance, the proper way to call AddEntityCollideCallback() is (asuming you want gothrough as your callback): AddEntityCollideCallback("Player", "Area ", "gothrough", true, 1); RE: i forgot how to script :c - nightsxp - 12-17-2012 (12-17-2012, 01:13 PM)TheGreatCthulhu Wrote:Thanks yo you all :I i will try to understand.(12-17-2012, 12:13 PM)nightsxp Wrote: what;s wrong??This is wrong: AddEntityCollideCallback("Player","Area ","lantern"); RE: i forgot how to script :c - nightsxp - 12-19-2012 hi again x33 how can i teleport player from Area1 to Area2?and after 6 seconds he will return to Area1? RE: i forgot how to script :c - FlawlessHappiness - 12-19-2012 You use this line TeleportPlayer("Area2"); The other one is just a timer. You know how to use them right? RE: i forgot how to script :c - nightsxp - 12-19-2012 (12-19-2012, 08:12 AM)beecake Wrote: You use this lineMaybe x3 Thanks a lot. RE: i forgot how to script :c - FlawlessHappiness - 12-19-2012 Let's say you call a timer called TeleportTimer You call these 2 lines: AddTimer("Area2", 0, "TeleportTimer"); AddTimer("Area1", 6, "TeleportTimer"); void TeleportTimer(string &in asTimer) { if(asTimer == "Area1") { TeleportPlayer("Area1"); } if(asTimer == "Area2") { TeleportPlayer("Area2"); } } RE: i forgot how to script :c - Your Computer - 12-19-2012 TeleportPlayer already takes in only one string, so it's much simpler to do PHP Code: AddTimer("PlayerStartAreaName", 6, "TeleportPlayer"); RE: i forgot how to script :c - FlawlessHappiness - 12-19-2012 (12-19-2012, 11:28 AM)Your Computer Wrote: TeleportPlayer already takes in only one string, so it's much simpler to doYea, but might be harder to understand RE: i forgot how to script :c - TheGreatCthulhu - 12-19-2012 How is that harder to understand? It's the same thing, except the call is now made directly. That's like saying that it's easier to write if you tape the pen at the end of a long stick, and use the stick instead Also, even with your indirect approach, the if statements are not required in this scenario - you can just pass the parameter along. RE: i forgot how to script :c - FlawlessHappiness - 12-19-2012 Ok sorry |