Frictional Games Forum (read-only)

Full Version: Script fail
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
My code wont work :S

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "HitDoor", "Creepy", true, 0);
}
void Creepy(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("", "ps_hit_wood", "HitArea", false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "HitArea_1", false);
PlayGuiSound("hit_wood1.ogg", 7.0f);
PlayGuiSound("hit_wood1.ogg", 7.0f);
PlaySoundAtEntity("", "21_scream9", "Creep", 0, false);
StartPlayerLookAt("cellar_wood01_slow_1", 10.0f, 10.0f, "");
AddTimer("Timer", 1.0f, "NoLook");
}
void NoLook(string &in asTimer)
{
StopPlayerLookAt();
}
Help a scripter out? =)

-Dizturbed
Code:
AddEntityCollideCallback("Player", "HitDoor", "Creepy", true, 0);

change the 0 to 1.
Nope.. Did not work : /
Define "did not work."
It wont do anything, no errors, nothing, it just plays on like I haven't scripted at all.
Is HitDoor an Area of type Script?
It's an Area
(08-01-2011, 09:30 PM)Dizturbed Wrote: [ -> ]It's an Area

... of type Script?
Check the name of the Area and make sure it matches up with your script or just copy the entire thing and paste it into the script to be 100% sure.
Try the following to debug your code. You want to look at the debug messages to see what is happening to the code. E.g if all 3 are showing up, then the error is in the function calls in the callback. If 2 are showing up somwhere in the callback an exception is being produced. If only 1 shows up then your collision callback isn't being triggered. If none show up, the hps file is not being loaded.
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "HitDoor", "Creepy", true, 0);
AddDebugMessage("OnStart Finished",false);
}
void Creepy(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Callback Triggered",false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "HitArea", false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "HitArea_1", false);
PlayGuiSound("hit_wood1.ogg", 7.0f);
PlayGuiSound("hit_wood1.ogg", 7.0f);
PlaySoundAtEntity("", "21_scream9", "Creep", 0, false);
StartPlayerLookAt("cellar_wood01_slow_1", 10.0f, 10.0f, "");
AddTimer("Timer", 1.0f, "NoLook");
AddDebugMessage("Callback Finished",false);
}
void NoLook(string &in asTimer)
{
StopPlayerLookAt();
}

Remember, everything is case sensitive Wink.
Pages: 1 2