Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved Script not working?
Author Message
cheztheguy Offline
Junior Member

Posts: 12
Joined: Jun 2011
Reputation: 0
Post: #1
Script not working?
Hello everyone...
it seems that I tried to put a script area but when the player collides into it, the script doesn't show up.

Here is my script

Spoiler below!
void OnStart()
{
SetEnemyDisableTriggers("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", false);
SetMoveObjectState("Gruntwalkdoor", 1.0f);
AddEntityCollideCallback("walkgrunt", "Player", "WalkGruntDoor", false, 0);
}

void WalkGruntDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
SetEnemyDisableTriggers("servant_grunt_2", true);
StartPlayerLookAt("servant_grunt_2", 7.0f, 50.0f, "");
StopPlayerLookAt();
GiveSanityDamage(30.0f, true);
AddEntityCollideCallback("servant_grunt_2", "DoorGruntGone", "GruntGone", false, 0);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_5", 0.0f, "");
}

void GruntGone(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", false);
SetMoveObjectStateExt("Gruntwalkdoor", 0, 7.0f, 50.0f, 0.0f, true);
}


Here are some screenshots of the editor:
Spoiler below!

[Image: walkgruntscript.png]

[Image: walkgruntscript2ug.png]

[Image: walkgruntscript3.png]



What am I doing wrong?
(This post was last modified: 05-28-2012 06:06 AM by cheztheguy.)
05-28-2012 05:52 AM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 275
Joined: Apr 2012
Reputation: 15
Post: #2
RE: Script not working?
Switch "Player" and "walkgrunt". Player should always be asParent

And I'm sorry, but SanityDamage minus 30? Make that ten or something, 30 is 1/3 of your sanity, which should not happen from a monster spawn. >.>

Check me out at my youtube channel: http://www.youtube.com/user/Putmalk?feature=mhee

I post videos of my Amnesia creations.
(This post was last modified: 05-28-2012 05:59 AM by Putmalk.)
05-28-2012 05:59 AM
Find all posts by this user Quote this message in a reply
cheztheguy Offline
Junior Member

Posts: 12
Joined: Jun 2011
Reputation: 0
Post: #3
Re: Script not working?
Thank you, switching between the two worked.

And haha, sorry, I changed the 30 to 10.
(This post was last modified: 05-28-2012 06:05 AM by cheztheguy.)
05-28-2012 06:05 AM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 275
Joined: Apr 2012
Reputation: 15
Post: #4
RE: Script not working?
Allow me to specify one thing.

asParent shouldn't always be Player, it should always be the entity which enters the area. asChild is always the secondary entity.

Therefore, the player enters the area, so Player should be asParent and area should be asChild. This can also apply to chairs hitting walls, etc. It's best if asChild was a stationary object, as asChild cannot initiate the collision callback, but asParent as to.

Check me out at my youtube channel: http://www.youtube.com/user/Putmalk?feature=mhee

I post videos of my Amnesia creations.
05-28-2012 06:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)