Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i forgot how to script :c
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#11
RE: i forgot how to script :c

(12-17-2012, 12:13 PM)nightsxp Wrote: what;s wrong??


AddEntityCollideCallback("Player","Area ","lantern");




void gothrough(string &in asParent, string &in asChild, int alState)
{
if(HasItem("lantern") == true)
{

SetEntityActive("block", false);


}


}


i actually want: if player has lantern he can go throuh ''Area''
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!):
void AddEntityCollideCallback(
    string& asParentName,       // your "Player" parameter
    string& asChildName,        // your "Area" parameter
    string& asFunction,          // callback function - your "lantern" parameter <---- watch it!
    bool abDeleteOnCollide,     // pass either true or false here
    int alStates                     // check the docs to see what to pass here (either -1, 0, or 1)
    );

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);
(This post was last modified: 12-17-2012, 01:18 PM by TheGreatCthulhu.)
12-17-2012, 01:13 PM
Find


Messages In This Thread
i forgot how to script :c - by nightsxp - 12-14-2012, 07:51 AM
RE: i forgot how to script :c - by nightsxp - 12-14-2012, 08:23 AM
RE: i forgot how to script :c - by nightsxp - 12-14-2012, 09:53 AM
RE: i forgot how to script :c - by nightsxp - 12-17-2012, 10:28 AM
RE: i forgot how to script :c - by nightsxp - 12-17-2012, 12:13 PM
RE: i forgot how to script :c - by TheGreatCthulhu - 12-17-2012, 01:13 PM
RE: i forgot how to script :c - by nightsxp - 12-17-2012, 01:31 PM
RE: i forgot how to script :c - by nightsxp - 12-17-2012, 01:11 PM
RE: i forgot how to script :c - by nightsxp - 12-19-2012, 06:53 AM
RE: i forgot how to script :c - by nightsxp - 12-19-2012, 08:56 AM
RE: i forgot how to script :c - by Your Computer - 12-19-2012, 11:28 AM
RE: i forgot how to script :c - by nightsxp - 12-20-2012, 07:57 AM
RE: i forgot how to script :c - by nightsxp - 12-20-2012, 08:10 AM
RE: i forgot how to script :c - by Your Computer - 12-20-2012, 08:20 AM
RE: i forgot how to script :c - by nightsxp - 12-20-2012, 08:42 AM
RE: i forgot how to script :c - by nightsxp - 12-23-2012, 03:29 PM
RE: i forgot how to script :c - by nightsxp - 01-03-2013, 08:02 AM
RE: i forgot how to script :c - by Statyk - 01-03-2013, 08:06 AM
RE: i forgot how to script :c - by nightsxp - 01-03-2013, 08:27 AM



Users browsing this thread: 2 Guest(s)