Frictional Games Forum (read-only)
Amnsesi script. need help - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Amnsesi script. need help (/thread-17408.html)



Amnsesi script. need help - tokugawa1 - 08-01-2012

Well im creating a new map but im having trouble with the scripts so here is my .hps file:

void OnStart()
{
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.0f, false);
RemoveItem("key_1");
}

{

SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true);

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_brute_1", true);

}

void OnEnter()
{
}

And the error message says:



FATAL ERROR: Could not load script file 'custom_stories/The Deception/custom_stories/The Deception/maps/The Deception.hps'!

main (13,1) : ERR : Unexpected token '{'



Hope you guys can help me out [Image: sad.gif]


RE: Amnsesi script. need help - Lizard - 08-01-2012

try to place:

SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true); in void OnStart


RE: Amnsesi script. need help - tokugawa1 - 08-01-2012

(08-01-2012, 07:36 PM)ZereboO Wrote: try to place:

SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true); in void OnStart
like this?

void OnStart()
{
SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true);

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


RE: Amnsesi script. need help - Steve - 08-01-2012

(08-01-2012, 08:01 PM)tokugawa1 Wrote:
(08-01-2012, 07:36 PM)ZereboO Wrote: like this?

void OnStart()
{
SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true);

AddUseItemCallback("", "key_1", "door_1","UsedKeyOnDoor", true);
}
yes like that so to make it complete:
void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0.0f, false);
RemoveItem("key_1");
}

void Spawn_Monster(string &in entity)
{
SetEntityActive("servant_brute_1", true);
}

void OnEnter()
{

}


RE: Amnsesi script. need help - tokugawa1 - 08-01-2012

(08-01-2012, 08:12 PM)Steve Wrote:
(08-01-2012, 08:01 PM)tokugawa1 Wrote:
(08-01-2012, 07:36 PM)ZereboO Wrote: like this?

void OnStart()
{
SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true);

AddUseItemCallback("", "key_1", "door_1","UsedKeyOnDoor", true);
}
yes like that so to make it complete:
void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("monster_tinderbox", "Spawn_Monster", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0.0f, false);
RemoveItem("key_1");
}

void Spawn_Monster(string &in entity)
{
SetEntityActive("servant_brute_1", true);
}

void OnEnter()
{

}
ok the CS works but when i try to use the key on the door it says "Cannot use this item this way!"


RE: Amnsesi script. need help - Lizard - 08-01-2012

make sure the entity names in the level editor and your .hps file is the same


RE: Amnsesi script. need help - tokugawa1 - 08-01-2012

(08-01-2012, 08:32 PM)ZereboO Wrote: make sure the entity names in the level editor and your .hps file is the same
yeah they are the same
i Also have another map and the keys work perfectly. so idk whats wrong with this one


RE: Amnsesi script. need help - Seragath - 08-02-2012

(08-01-2012, 08:36 PM)tokugawa1 Wrote: yeah they are the same
i Also have another map and the keys work perfectly. so idk whats wrong with this one


If you've used the exact same script previously and it worked then. You've must have gotten a name or function wrong.


RE: Amnsesi script. need help - tokugawa1 - 08-02-2012

(08-02-2012, 02:44 PM)Seragath Wrote:
(08-01-2012, 08:36 PM)tokugawa1 Wrote: yeah they are the same
i Also have another map and the keys work perfectly. so idk whats wrong with this one


If you've used the exact same script previously and it worked then. You've must have gotten a name or function wrong.
well this map has 1 key and a monster that spawns after picking up a tinderbox, the other map has 3 keys so they arent the same but they both have keys
nvm fixed it