LoneWolf
Senior Member
Posts: 308
Threads: 43
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
Thanks my map works but sadly the enemy doesnt follow the command, i think i may have done the scripting wrong, ive tried it out many ways but it always says error when i load up. Heres how it looks, everything works apart from the enemy following nodes -
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
AddUseItemCallback("", "StudyKey", "castle_arched01_3", "UsedKeyOnDoor", true);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(3.0f, true);
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_arched01_3", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_arched01_3", 0, false);
RemoveItem("StudyKey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Note i also tried to move the node script to the top just below onstart and just above the add entity script. It wouldnt load up.
Thanks for all the help so far guys.
|
|
10-05-2010, 05:31 PM |
|
Equil
Member
Posts: 94
Threads: 8
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
What error is it giving you when you load up the game? Also the nodes should be below void OnStart().
|
|
10-06-2010, 10:28 AM |
|
LoneWolf
Senior Member
Posts: 308
Threads: 43
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
When putting them below onstart do i use } { (tokens i think there called) ?
Also the error i get is - unexpected identifier for the nodes but with the } { (tokens) it says unexpected tokens. So i dont know what to do.
|
|
10-06-2010, 05:06 PM |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
(10-06-2010, 05:06 PM)LoneWolf Wrote: When putting them below onstart do i use } { (tokens i think there called) ?
Also the error i get is - unexpected identifier for the nodes but with the } { (tokens) it says unexpected tokens. So i dont know what to do.
Ok - Try saving (EMPHASIS on saving) a copy of the parts of the script related to the nodes and the NPC, then remove them, and place them in another document.
Run the map in Amnesia and make sure it works. If not, they arent the problem.
If so, add the script back in piece by piece until you work out which exact part is the issue.
In my experience, the "Show Enemy Player Position" function can be a bit buggy, so start with that.
If you work out which piece of the script isnt working, we should be able to go from there
The XML Verifier may help
|
|
10-06-2010, 05:27 PM |
|
LoneWolf
Senior Member
Posts: 308
Threads: 43
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
Ive just recently added in the nodes and all my scriptign worked previously, so its definetly my nodes, i just need to know where to place them to get them to work. Otherwise my map doesnt load, i deleted the nodes nto long ago and everything worked.
Also the validator doesnt seem to work for my .hps files, basically doesnt show it as valiable, btu it works for my lang and .cfg file.
|
|
10-06-2010, 05:34 PM |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
Open Map Viewer, then view the map, and make it render/display Path Nodes, and ensure that they are actually joined together.
Failing that, try renaming the NPC in the level editor, then changing the Node part of the script to suit that. Also, rename the nodes.
Or, maybe:
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(3.0f, true);
SetSwingDoorClosed("castle_arched01_2", true, true);
ShowEnemyPlayerPosition("servant_grunt_1");
SetEntityActive("servant_grunt_1", true);
{
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 1.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 1.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 1.0f, "");
}
}
* with SetEntityActive("servant_grunt_1", false); in OnStart
-
EDIT: Retry with the new ammendums
The following is a piece of script from the Amnesia Story, as a point of reference:
void CollideAreaCP03(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("servant_grunt_9", "PathNodeArea_119", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_9", "PathNodeArea_133", 0.0f, "");
SetEntityActive("servant_grunt_9", true);
PlaySoundAtEntity("door_open", "15_open_door", "cellar_wood01_2", 0.0f, false);
}
|
|
10-06-2010, 05:46 PM |
|
LoneWolf
Senior Member
Posts: 308
Threads: 43
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
How do i know if the nodes are linked? and how do i link them?
Edit, the enemy reacts to sound now but still doesnt follow the nodes after he breaks the door down he stands still untill he sees me or hears me....
|
|
10-06-2010, 06:12 PM |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
(10-06-2010, 06:12 PM)LoneWolf Wrote: How do i know if the nodes are linked? and how do i link them?
Edit, the enemy reacts to sound now but still doesnt follow the nodes after he breaks the door down he stands still untill he sees me or hears me....
In the map viewer, when you render the nodes they should be joined by a grey line if they are linked - If not, theyre too far apart and you need to remove and replace them, possibly adding more
This is still progress though
|
|
10-07-2010, 05:33 AM |
|
LoneWolf
Senior Member
Posts: 308
Threads: 43
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
Thank you so much that was the issue all along, onstead of having 4 i now have 19 and the monster follows it perfectly Maybe there should be additional information when using this as i assume others will not know why there path nodes are not working.
|
|
10-07-2010, 05:38 PM |
|
Chilton
Member
Posts: 138
Threads: 9
Joined: Sep 2010
Reputation:
0
|
RE: Activating sanity and makign a level door operate.
(10-07-2010, 05:38 PM)LoneWolf Wrote: Thank you so much that was the issue all along, onstead of having 4 i now have 19 and the monster follows it perfectly Maybe there should be additional information when using this as i assume others will not know why there path nodes are not working.
Im glad i could help - Have a pleasant time with your new knowledge
|
|
10-07-2010, 06:01 PM |
|
|