(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);