Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need some help.
Sanshi Offline
Junior Member

Posts: 14
Threads: 5
Joined: May 2012
Reputation: 0
#1
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.

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.
05-09-2012, 06:36 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
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.

Noob scripting tutorial: From Noob to Pro

(This post was last modified: 05-09-2012, 06:45 PM by Cranky Old Man.)
05-09-2012, 06:43 PM
Find
Prelauncher Offline
Senior Member

Posts: 451
Threads: 11
Joined: May 2011
Reputation: 13
#3
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
Find
Sanshi Offline
Junior Member

Posts: 14
Threads: 5
Joined: May 2012
Reputation: 0
#4
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#5
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.

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
Find
Sanshi Offline
Junior Member

Posts: 14
Threads: 5
Joined: May 2012
Reputation: 0
#6
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.

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?
05-09-2012, 07:00 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#7
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
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#8
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?

Noob scripting tutorial: From Noob to Pro

05-09-2012, 07:04 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#9
RE: I need some help.

No need to get Cranky, Old Man. I'd script it for him Smile
05-09-2012, 07:07 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#10
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 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.

Noob scripting tutorial: From Noob to Pro

05-09-2012, 07:14 PM
Find




Users browsing this thread: 1 Guest(s)