Frictional Games Forum (read-only)

Full Version: I need some help.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello! New guy here, I have just set up my Room, and I want to make it so when I touch an object, it disappears, you get a little sanity damage and it's all good.

I think I've done the first part right... no idea how to put in the other stuff.

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player" , "Stephano1" , "StephanoGone" , true , 1);
}

{
SetEntityActive("Stephano1", false);
}


Any other things I need to add... the script function list is so long, not easy to find the things I need.

And yes I watch PewDiePie, therefore: Stephano.
Since you are not alone in doing this, what's your reasoning behind putting each individual line within brackets?

Quote:Any other things I need to add... the script function list is so long, not easy to find the things I need.

Your browser should contain a page search function.
void OnStart()
{
AddEntityCollideCallback("Player" , "Stephano1" , "StephanoGone" , true , 1);
}

void StephanoGone(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(AmountOfDamage, UseEffect?IfYesUse: true IfNot: false);
SetEntityActive("Stephano1", false);
}

void OnEnter()
{
}

void OnStart()
{
}
(05-09-2012, 06:46 PM)Prelauncher Wrote: [ -> ]void OnStart()
{
AddEntityCollideCallback("Player" , "Stephano1" , "StephanoGone" , true , 1);
}

void StephanoGone(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(AmountOfDamage, UseEffect?IfYesUse: true IfNot: false);
SetEntityActive("Stephano1", false);
}

void OnEnter()
{
}

void OnStart()
{
}
Didn't work for me somehow... Maybe I've placed the script file Incorrectly... I've placed it where my map is, which I think it should be.
(05-09-2012, 06:36 PM)Sanshi Wrote: [ -> ]Hello! New guy here, I have just set up my Room, and I want to make it so when I touch an object, it disappears, you get a little sanity damage and it's all good.

I think I've done the first part right... no idea how to put in the other stuff.

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player" , "Stephano1" , "StephanoGone" , true , 1);
}

{
SetEntityActive("Stephano1", false);
}


Any other things I need to add... the script function list is so long, not easy to find the things I need.

And yes I watch PewDiePie, therefore: Stephano.
So, that 'SetEntityActive' needs to be executed as part of the callback. You've set the callback, so when the player collides with the object it calls the function 'StephanoGone'. You want to add some sanity damage too... The callback function should be this,

void StephanoGone(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("Stephano1", false);
GiveSanityDamage(float afAmount, bool abUseEffect); (replace float afAmount with amount of damage to deal, and bool abUseEffect as whether to use the sanity damage effect)
}

Bear in mind, I've never used the sanity damage function but I would imagine that works... It's all taken from the engine scripts page on the wiki mate, you just have to look for what you want on there

Also, this should be posted in the Dev support forum Smile
(05-09-2012, 06:58 PM)Adrianis Wrote: [ -> ]
(05-09-2012, 06:36 PM)Sanshi Wrote: [ -> ]Hello! New guy here, I have just set up my Room, and I want to make it so when I touch an object, it disappears, you get a little sanity damage and it's all good.

I think I've done the first part right... no idea how to put in the other stuff.

Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player" , "Stephano1" , "StephanoGone" , true , 1);
}

{
SetEntityActive("Stephano1", false);
}


Any other things I need to add... the script function list is so long, not easy to find the things I need.

And yes I watch PewDiePie, therefore: Stephano.
So, that 'SetEntityActive' needs to be executed as part of the callback. You've set the callback, so when the player collides with the object it calls the function 'StephanoGone'. You want to add some sanity damage too... The callback function should be this,

void StephanoGone(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("Stephano1", false);
GiveSanityDamage(float afAmount, bool abUseEffect); (replace float afAmount with amount of damage to deal, and bool abUseEffect as whether to use the sanity damage effect)
}

Bear in mind, I've never used the sanity damage function but I would imagine that works... It's all taken from the engine scripts page on the wiki mate, you just have to look for what you want on there

Also, this should be posted in the Dev support forum Smile
I just found out something, the Script works, but not when I pick him up... only when I "touch" him... like pick him up and drop him on my face... then he disappears. How can I do it so it happens when I pick him up?
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

Use that to set the callback instead of the collide one
(05-09-2012, 06:54 PM)Sanshi Wrote: [ -> ]Didn't work for me somehow... Maybe I've placed the script file Incorrectly... I've placed it where my map is, which I think it should be.
Did you actually read and understand the script, or did you just copy and paste it, thinking we'll script everything for you?
No need to get Cranky, Old Man. I'd script it for him Smile
(05-09-2012, 07:07 PM)Adrianis Wrote: [ -> ]No need to get Cranky, Old Man. I'd script it for him Smile
Yes, you'd script it for him now, and then he'll come back tomorrow, wanting the next thing done in another post. If you want to script for him, consider teaming up with him, as a scripter for his mod.
Pages: 1 2