Frictional Games Forum (read-only)

Full Version: AddEntityCollideCallback FAIL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Every single time I try to script the "AddEntityCollideCallback" thingy, NOTHING HAPPENS. So, I'm finally asking for help. I've put the area in the level editor, I scripted just like in the wiki tutorials, and I'm sure the names are correct. I don't know why i can't make this ship work! Won't you please, please help me?

This is the part of the .hps script that matters:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "bottlescare", "BottleFunc1", true, 1);
}

void BottleFunc1()
{
AddPropForce("wine01_1", -8.738, 0.945, -8.775, "world");
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "general_thunder8", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}

And, as I said, the area is there. With the same name. So is the bottle. And the door. And all.
I need somebody, help!
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "bottlescare", "BottleFunc1", true, 1);
}

void BottleFunc1(string &in asParent, string &in asChild, int alState)
{
AddPropForce("wine01_1", -8.738, 0.945, -8.775, "world");
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "general_thunder8", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}


you forgot (string &in asParent, string &in asChild, int alState)

np dude ^^
(10-29-2011, 10:35 PM)Victor Wrote: [ -> ]Every single time I try to script the "AddEntityCollideCallback" thingy, NOTHING HAPPENS. So, I'm finally asking for help. I've put the area in the level editor, I scripted just like in the wiki tutorials, and I'm sure the names are correct. I don't know why i can't make this ship work! Won't you please, please help me?

This is the part of the .hps script that matters:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "bottlescare", "BottleFunc1", true, 1);
}

void BottleFunc1()
{
AddPropForce("wine01_1", -8.738, 0.945, -8.775, "world");
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "general_thunder8", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}

And, as I said, the area is there. With the same name. So is the bottle. And the door. And all.
I need somebody, help!
You have decimals on the "AddPropForce" event, you would probably need to put an f on the end of each float.

e.g: AddPropForce("wine01_1", -8.738f, 0.945f, -8.775f, "world");

(10-29-2011, 11:31 PM)devin413 Wrote: [ -> ]////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "bottlescare", "BottleFunc1", true, 1);
}

void BottleFunc1(string &in asParent, string &in asChild, int alState)
{
AddPropForce("wine01_1", -8.738, 0.945, -8.775, "world");
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "general_thunder8", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}


you forgot (string &in asParent, string &in asChild, int alState)

np dude ^^
Wasn't working WITH this, so I tried to take it off, but... this isn't the problem.

(10-30-2011, 12:09 AM)Victor Wrote: [ -> ]
(10-29-2011, 11:31 PM)devin413 Wrote: [ -> ]////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "bottlescare", "BottleFunc1", true, 1);
}

void BottleFunc1(string &in asParent, string &in asChild, int alState)
{
AddPropForce("wine01_1", -8.738, 0.945, -8.775, "world");
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "general_thunder8", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}


you forgot (string &in asParent, string &in asChild, int alState)

np dude ^^
Wasn't working WITH this, so I tried to take it off, but... this isn't the problem.
You need "(string &in asParent, string &in asChild, int alState)"...don't take it off.
(10-30-2011, 12:32 AM)flamez3 Wrote: [ -> ]
(10-30-2011, 12:09 AM)Victor Wrote: [ -> ]
(10-29-2011, 11:31 PM)devin413 Wrote: [ -> ]////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "bottlescare", "BottleFunc1", true, 1);
}

void BottleFunc1(string &in asParent, string &in asChild, int alState)
{
AddPropForce("wine01_1", -8.738, 0.945, -8.775, "world");
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "general_thunder8", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(7.0f, true);
}


you forgot (string &in asParent, string &in asChild, int alState)

np dude ^^
Wasn't working WITH this, so I tried to take it off, but... this isn't the problem.
You need "(string &in asParent, string &in asChild, int alState)"...don't take it off.
Doesn't work anyway! I know because I already put it back!


lol i test it on a test map and it works

area name = bottlescare ?

AddPropImpulse("wine01_1", 5, 5, 5, "World");

propimpulse is better i think
Yea, I'd doublecheck to make sure your script area is called bottlescare. It's case sensitive as well.
Yes, it is bottlescare. I'm sure!
I don't think it is "propimpulse", it is not like this in the tutorial.
In the tutorial it's "PropImpulse" allright.
(10-30-2011, 12:06 AM)flamez3 Wrote: [ -> ]You have decimals on the "AddPropForce" event, you would probably need to put an f on the end of each float.

e.g: AddPropForce("wine01_1", -8.738f, 0.945f, -8.775f, "world");
Whilst it isn't necessary, you are correct in stating and doing this, as it is good practice to add the "f" after the decimal numbers to state that they are "floats" rather than "doubles". I say this merely because otherwise, you may get warning messages mixed in any error messages when compiling your script. These appear in both the log files and the error message box if errors occur (otherwise they are just ignored), and if sufficient in number, waste time trying to scan through them to see the actual relevant info.
Pages: 1 2