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
Script not working?
cheztheguy Offline
Junior Member

Posts: 12
Threads: 7
Joined: Jun 2011
Reputation: 0
#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
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#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. >.>

(This post was last modified: 05-28-2012, 05:59 AM by Putmalk.)
05-28-2012, 05:59 AM
Find
cheztheguy Offline
Junior Member

Posts: 12
Threads: 7
Joined: Jun 2011
Reputation: 0
#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
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#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.

05-28-2012, 06:56 AM
Find




Users browsing this thread: 1 Guest(s)