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
Level Editor Help How to get Grunt to open cabinet doors
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#1
Smile  How to get Grunt to open cabinet doors

I am TERRIBLE at writing script. I scrapped my idea of having the Grunt hide in a cabinet (Mainly because I am terrible at writing script.) and decided to just have the Grunt come up to the cabinet open it then vanish. Can you just give me the script and where to put it? Please this will help me out A LOT.

Grunt Name: Grunty1

Cabinet Name: Cabby1

Where in here do I put the script?


////////////////////////////
// Run first time starting map
void OnStart()
{

}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

You guys are the best so I know you can answer this Smile

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-22-2012, 05:11 PM
Find
drunkmonk Offline
Member

Posts: 109
Threads: 7
Joined: Jun 2012
Reputation: 4
#2
RE: How to get Grunt to open cabinet doors

(06-22-2012, 05:11 PM)Jagsrs28 Wrote: I am TERRIBLE at writing script. I scrapped my idea of having the Grunt hide in a cabinet (Mainly because I am terrible at writing script.) and decided to just have the Grunt come up to the cabinet open it then vanish. Can you just give me the script and where to put it? Please this will help me out A LOT.

Grunt Name: Grunty1

Cabinet Name: Cabby1

Where in here do I put the script?


////////////////////////////
// Run first time starting map
void OnStart()
{

}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

You guys are the best so I know you can answer this Smile
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Grunt1", "monster_opendoor_area", monster_opendoor", true, 1);
}
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


it should look something like this, you will also have to add path nodes for the monster and you may need to play around with the AddImpulse settings.

This website will tell you everything you need to know, it is alot of information but you will get the hang of it
http://wiki.frictionalgames.com/hpl2/amn..._functions
(This post was last modified: 06-22-2012, 05:32 PM by drunkmonk.)
06-22-2012, 05:25 PM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#3
RE: How to get Grunt to open cabinet doors

(06-22-2012, 05:25 PM)drunkmonk Wrote:
(06-22-2012, 05:11 PM)Jagsrs28 Wrote: I am TERRIBLE at writing script. I scrapped my idea of having the Grunt hide in a cabinet (Mainly because I am terrible at writing script.) and decided to just have the Grunt come up to the cabinet open it then vanish. Can you just give me the script and where to put it? Please this will help me out A LOT.

Grunt Name: Grunty1

Cabinet Name: Cabby1

Where in here do I put the script?


////////////////////////////
// Run first time starting map
void OnStart()
{

}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

You guys are the best so I know you can answer this Smile
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Grunt1", "monster_opendoor_area", monster_opendoor", true, 1);
}
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


it should look something like this, you will also have to add path nodes for the monster and you may need to play around with the AddImpulse settings.

This website will tell you everything you need to know, it is alot of information but you will get the hang of it
http://wiki.frictionalgames.com/hpl2/amn..._functions
How do I set path nodes? I know absolutely nothing about writing script for Amnesia. How would I "Play around" with the AddImpulse settings?

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-22-2012, 05:40 PM
Find
drunkmonk Offline
Member

Posts: 109
Threads: 7
Joined: Jun 2012
Reputation: 4
#4
RE: How to get Grunt to open cabinet doors

Ok first in the level editor you have to go to areas, and when you click on the drop down menu for area types you should see pathnode near the bottem. Place these where you want your grunt to walk leading up to the cabinet, (you don't have to have a path node inside the cabinet)then in the void OnStart() you can add a timer like this AddTimer("", 1.0, MonsterPath); for example. Then make a void MonsterPath(string &in asTimer) above the void monster_opendoor(string &in asParent, string &in asChild, int alState) you don't have to put it here but this is just for example. In the void MonsterPath(string &in asTimer) add this
AddEnemyPatrolNode("Grunt1", "PathNodeArea1", "");
keep adding these for the other path nodes you have placed and make sure the number at the end matchs the path node you want your monster to go to next.
You will also need a script area to put infront of the cabinet (you can find this area in the same drop down menu you were in earlier) and name monster_opendoor_area (just as in the script) and what I mean by playing around with the AddImpulse settings is depending which way your cabinet is faceing you may have to change the numbers around based on the direction. The first number represents the X axis, the second number is the Y axis, and the third number is the Z axis.
06-22-2012, 05:57 PM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#5
RE: How to get Grunt to open cabinet doors

So is this right?

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Grunty1", "monster_opendoor_area", monster_opendoor", true, 1);
}
void MonsterPath(AddEnemyPatrolNode("Grunty1", "PathNodeArea1", "");
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

Then keep adding nodes?

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-22-2012, 06:08 PM
Find
drunkmonk Offline
Member

Posts: 109
Threads: 7
Joined: Jun 2012
Reputation: 4
#6
RE: How to get Grunt to open cabinet doors

(06-22-2012, 06:08 PM)Jagsrs28 Wrote: So is this right?

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Grunty1", "monster_opendoor_area", monster_opendoor", true, 1);
}
void MonsterPath(AddEnemyPatrolNode("Grunty1", "PathNodeArea1", "");
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("servant_grunt_1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

Then keep adding nodes?
Almost but not quite,

////////////////////////////
// Run first time starting map
void OnStart()
{
AddTimer("", 1.0, "MonsterPath");
AddEntityCollideCallback("Grunty1", "monster_opendoor_area", monster_opendoor", true, 1);
}

void MonsterPath(string &in asTimer)
{
AddEnemyPatrolNode("Grunt1", "PathNodeArea1", 0,"");
then add all your other path nodes in here (the zero is the time in seconds until the grunt moves on to the next node)
}
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("Grunt1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}
06-22-2012, 06:16 PM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#7
RE: How to get Grunt to open cabinet doors

Okay, I think I got it now, And I would also just like to say Thank You. You've been a huge help!
I just wanted to make sure everything will work now and I added them correctly.


////////////////////////////
// Run first time starting map
void OnStart()
{
AddTimer("", 1.0, "MonsterPath");
AddEntityCollideCallback("Grunty1", "monster_opendoor_area", monster_opendoor", true, 1);
}

void MonsterPath(string &in asTimer)
{
AddEnemyPatrolNode("Grunt1", "PathNodeArea1", 0,"PathNodeArea2", 0,"PathNodeArea3", 0,"PathNodeArea4", 0,"PathNodeArea5", 0);
}
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("Grunt1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-22-2012, 06:25 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#8
RE: How to get Grunt to open cabinet doors

AddEnemyPatrolNode("Grunt1", "PathNodeArea1", 0,"PathNodeArea2", 0,"PathNodeArea3", 0,"PathNodeArea4", 0,"PathNodeArea5", 0);
wrong.
you have to add each patrolnode seperately. so you need 5 of those.
06-22-2012, 06:27 PM
Find
drunkmonk Offline
Member

Posts: 109
Threads: 7
Joined: Jun 2012
Reputation: 4
#9
RE: How to get Grunt to open cabinet doors

(06-22-2012, 06:25 PM)Jagsrs28 Wrote: Okay, I think I got it now, And I would also just like to say Thank You. You've been a huge help!
I just wanted to make sure everything will work now and I added them correctly.


////////////////////////////
// Run first time starting map
void OnStart()
{
AddTimer("", 1.0, "MonsterPath");
AddEntityCollideCallback("Grunty1", "monster_opendoor_area", monster_opendoor", true, 1);
}

void MonsterPath(string &in asTimer)
{
AddEnemyPatrolNode("Grunt1", "PathNodeArea1", 0,"PathNodeArea2", 0,"PathNodeArea3", 0,"PathNodeArea4", 0,"PathNodeArea5", 0);
}
void monster_opendoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("Cabby1", -10.0 , 0, 0, "World");
AddTimer("", 1.0, monsterdisable);
}
void monsterdisable(string &in asTimer)
{
SetEntityActive("Grunt1", false);
}
////////////////////////////
// Run when leaving map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
Your getting it but it's still not quite right, add the path nodes like this
AddEnemyPatrolNode("Grunt1", "PathNodeArea1", 0, "");
AddEnemyPatrolNode("Grunt1", "PathNodeArea2", 0, "");
AddEnemyPatrolNode("Grunt1", "PathNodeArea3", 0, "");
AddEnemyPatrolNode("Grunt1", "PathNodeArea4", 0, "");
AddEnemyPatrolNode("Grunt1", "PathNodeArea5", 0, "");

the quotations at the end just before the ); is the animation you want the grunt to play when reaching the path node, these are optional you don't have to have an animation in there but you MUST have the quotations
06-22-2012, 06:30 PM
Find
Jagsrs28 Offline
Member

Posts: 101
Threads: 25
Joined: Jun 2012
Reputation: 0
#10
RE: How to get Grunt to open cabinet doors

Okay well now. How do I get it to where, all I do is pick up this little key and then the Grunt runs his path over to the cabinet?

Special Custom Story for 2 special people!

[Image: LWFcAl]


06-22-2012, 06:40 PM
Find




Users browsing this thread: 1 Guest(s)