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 Help Error trying to run map
Macetrow Offline
Junior Member

Posts: 38
Threads: 3
Joined: Apr 2012
Reputation: 1
#1
Error trying to run map

Hey, trying to make my own map for the first time and i've run into some error once i started to make it a bit more complicated.
1: I want my key (key_1) to activate a monster
2: I want that key to unlock a door (door_1)
3: I want to set a patrolnode for that monster once i activate it
(Optinal)4: if anyone could also assist me with how to changemap once i've opened the last door that would be great.
I'm deeply grateful for any assistance since i'm a noob and all!

I'm getting an error message which says:
[Image: scripterror.png]

This is my script so far:

////////////////////////
//Run when starting map
void OnStart()
{
SetEntityPlayerInteractCallBack("key_1", "ActivateMonster", true);
}
////////////////////////
//Run when entering map
void OnEnter()
{ AddUseItemCallback("","key_1","door_1","UsedKeyOnDoor". true);

}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
void ActivateMonster(string &in item)
{
SetEntityActive("monster_1", true);
AddEnemyPatrolNode("monster_1", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("monster_1", "PathNodeArea_2", 0, "idle");
}
////////////////////////
//Run when leaving map
void OnLeave()
{

}
04-11-2012, 02:25 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#2
RE: Error trying to run map

The capital 'B' is misplaced.
SetEntityPlayerInteractCallback

As you see, the 'b' is non-capital.
04-11-2012, 03:00 PM
Find
Macetrow Offline
Junior Member

Posts: 38
Threads: 3
Joined: Apr 2012
Reputation: 1
#3
RE: Error trying to run map

Thanks for the reply, that fixed the first part of the error message.
I'm still getting "main (10,59): ERR : Expected identifier" thou.

Any idea what that could be?
(This post was last modified: 04-11-2012, 03:08 PM by Macetrow.)
04-11-2012, 03:07 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#4
RE: Error trying to run map

AddUseItemCallback("","key_1","door_1","UsedKeyOnDoor". true);


There's a '.' where there should be a comma.


AddUseItemCallback("","key_1","door_1","UsedKeyOnDoor", true);
04-11-2012, 03:10 PM
Find
Macetrow Offline
Junior Member

Posts: 38
Threads: 3
Joined: Apr 2012
Reputation: 1
#5
RE: Error trying to run map

Thank you so much, that fixed it!

But my key doesn't activate the monster also it doesn't open my locked door, do you know why?
04-11-2012, 03:17 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#6
RE: Error trying to run map

Firstly, the addition of the patrol nodes should be on OnStart/OnEnter.

void OnStart()
{    
    AddEnemyPatrolNode("monster_1", "PathNodeArea_1", 0, "idle");
    AddEnemyPatrolNode("monster_1", "PathNodeArea_2", 0, "idle");
}

And I think the player cannot interact a pickable item so 'ActivateMonster' is not called!

A valid usage would be:

void OnStart()
{        
    SetEntityCallbackFunc("key_1", "ActivateMonster");
}

void ActivateMonster(string &in asEntity, string &in type)
{        
    if(type == "OnPickup")        
    {            
        SetEntityActive("monster_1", true);        
    }
}
(This post was last modified: 04-11-2012, 03:33 PM by ClayPigeon.)
04-11-2012, 03:31 PM
Find
Macetrow Offline
Junior Member

Posts: 38
Threads: 3
Joined: Apr 2012
Reputation: 1
#7
RE: Error trying to run map

Hmm i did change it to this, not sure if this is what you meant, but it's not working. Also for some reason the key or the door does not have a name.
Any idea what i managed to screw up? I'm such a noob lol

////////////////////////
//Run when starting map
void OnStart()
{
SetEntityCallbackFunc("key_1", "ActivateMonster");
}

void ActivateMonster(string &in asEntity, string &in type)
{
if(type == "OnPickup")
{
SetEntityActive("monster_1", true);
}
}
////////////////////////
//Run when entering map
void OnEnter()
{
AddUseItemCallback("","key_1","door_1","UsedKeyOnDoor", true);
AddEnemyPatrolNode("monster_1", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("monster_1", "PathNodeArea_2", 0, "idle");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}

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

}
(This post was last modified: 04-11-2012, 04:00 PM by Macetrow.)
04-11-2012, 03:48 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#8
RE: Error trying to run map

Are you sure all of the names are correct?
And to change the inventory name you need to set the SubItemName in the level editor to some thing, like TEST for example and then add this in your extra_english.lang:


<CATEGORY Name="Inventory">

<Entry Name="ItemName_TEST">The name of the key.</Entry>
<Entry Name="ItemDesc_TEST">The description of the key.</Entry>


</CATEGORY>
04-11-2012, 04:07 PM
Find
Macetrow Offline
Junior Member

Posts: 38
Threads: 3
Joined: Apr 2012
Reputation: 1
#9
RE: Error trying to run map

Ahh, i see. Give me a min and i'll try it.
Hmm i did change it to this, also removed the "_1" in the key, monster and door incase that was screwing it up somehow. Yet i still can't see the name of the key/door and the monster doesn't activate when i touch the key.

PS: The story's description is gone.
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">
You start Martin's journey into what seems to be a never ending nightmare!
</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_key">Hallway Key.</Entry>
<Entry Name="ItemDesc_key">This is the key to the door at the end of the hall.</Entry>
</CATGEROY>
</LANGUAGE>
(This post was last modified: 04-11-2012, 04:29 PM by Macetrow.)
04-11-2012, 04:11 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#10
RE: Error trying to run map

I am really not getting why the key doesn't activate the monster Confused
As for the names, read "THE ITEM" part of the tutorial:

http://wiki.frictionalgames.com/hpl2/tut...r#the_item

04-11-2012, 04:42 PM
Find




Users browsing this thread: 1 Guest(s)