Sanshi
Junior Member
Posts: 14
Threads: 5
Joined: May 2012
Reputation:
0
|
I need some help.
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.
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.
|
|
05-09-2012, 06:36 PM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: I need some help.
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.
(This post was last modified: 05-09-2012, 06:45 PM by Cranky Old Man.)
|
|
05-09-2012, 06:43 PM |
|
Prelauncher
Senior Member
Posts: 451
Threads: 11
Joined: May 2011
Reputation:
13
|
RE: I need some help.
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()
{
}
Socialism (noun): A great way to run out of other people's money.
|
|
05-09-2012, 06:46 PM |
|
Sanshi
Junior Member
Posts: 14
Threads: 5
Joined: May 2012
Reputation:
0
|
RE: I need some help.
(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:54 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: I need some help.
(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.
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
|
|
05-09-2012, 06:58 PM |
|
Sanshi
Junior Member
Posts: 14
Threads: 5
Joined: May 2012
Reputation:
0
|
RE: I need some help.
(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.
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 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?
|
|
05-09-2012, 07:00 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: I need some help.
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
Use that to set the callback instead of the collide one
|
|
05-09-2012, 07:03 PM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: I need some help.
(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?
|
|
05-09-2012, 07:04 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: I need some help.
No need to get Cranky, Old Man. I'd script it for him
|
|
05-09-2012, 07:07 PM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: I need some help.
(05-09-2012, 07:07 PM)Adrianis Wrote: No need to get Cranky, Old Man. I'd script it for him 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.
|
|
05-09-2012, 07:14 PM |
|
|