Frictional Games Forum (read-only)
AddEntityCollideCallback FAIL - 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: AddEntityCollideCallback FAIL (/thread-11054.html)

Pages: 1 2


AddEntityCollideCallback FAIL - Victor - 10-29-2011

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!



RE: AddEntityCollideCallback FAIL - devin413 - 10-29-2011

////////////////////////////
// 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 ^^


RE: AddEntityCollideCallback FAIL - flamez3 - 10-30-2011

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




RE: AddEntityCollideCallback FAIL - Victor - 10-30-2011

(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.




RE: AddEntityCollideCallback FAIL - flamez3 - 10-30-2011

(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.


RE: AddEntityCollideCallback FAIL - Victor - 10-30-2011

(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!





RE: AddEntityCollideCallback FAIL - devin413 - 10-30-2011

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


RE: AddEntityCollideCallback FAIL - MrBigzy - 10-30-2011

Yea, I'd doublecheck to make sure your script area is called bottlescare. It's case sensitive as well.



RE: AddEntityCollideCallback FAIL - Victor - 10-30-2011

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.


RE: AddEntityCollideCallback FAIL - Apjjm - 10-30-2011

(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.