Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 Script error
Author Message
Hellday Offline
Junior Member

Posts: 5
Joined: Jul 2011
Reputation: 0
Post: #1
2 Script error
Hello, first sorry for my bad english, i'm French.
I've a problem with my script, one is for a locked door and key, the other spawn a monster. They work perfectly but when I put them both in my .hps i've a fatal error.

void OnStart()
{

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

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);

RemoveItem(asItem);
}


void OnStart()
{

AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);

Thanks for reply.
07-01-2011 11:46 AM
Find all posts by this user Quote this message in a reply
TFEF Offline
Member

Posts: 144
Joined: Feb 2011
Reputation: 1
Post: #2
RE: 2 Script error
Try removing the second OnStart function and putting the AddItemUseCallback into the brackets.
07-01-2011 11:57 AM
Find all posts by this user Quote this message in a reply
Hellday Offline
Junior Member

Posts: 5
Joined: Jul 2011
Reputation: 0
Post: #3
RE: 2 Script error
Like this :

void OnStart()
{

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

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);
RemoveItem(asItem);
}
?
Thanks their is no crash but my ket doesn't works Sad
07-01-2011 12:04 PM
Find all posts by this user Quote this message in a reply
TFEF Offline
Member

Posts: 144
Joined: Feb 2011
Reputation: 1
Post: #4
RE: 2 Script error
You should replace the asEntity in SetSwingDoorLocked with the name of the door I think. I might be wrong, it's really early here and I've been awake all night. Or just remove that altogether and set the door locked in the Level Editor.

Put the AddUseItemCallback on it's own, outside of the function.
07-01-2011 12:49 PM
Find all posts by this user Quote this message in a reply
HumiliatioN Offline
Posting Freak

Posts: 984
Joined: Dec 2010
Reputation: 10
Post: #5
RE: 2 Script error
(07-01-2011 12:04 PM)Hellday Wrote:  Like this :

void OnStart()
{

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

}

void Spawn_Monster(string &in entity)
{

SetEntityActive("servant_grunt_1", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);
RemoveItem(asItem);
}
?
Thanks their is no crash but my ket doesn't works Sad


Try this: OnStart inside the brackets like this:

void OnStart()
{
AddUseItemCallback("useexit", "key_1", "coffre", "UseKey",true);
SetEntityPlayerInteractCallback("lantern_1", "Spawn_Monster", true);
}


void OnEnter()
{
}


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

void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("name of the door?", false, true);
RemoveItem(asItem);
PlaySoundAtEntity("", "unlock_door.snt", "name of the door?", 0.0f, true);
}

That should do it.

Investigator - WIP
07-01-2011 03:57 PM
Find all posts by this user Quote this message in a reply
Hellday Offline
Junior Member

Posts: 5
Joined: Jul 2011
Reputation: 0
Post: #6
RE: 2 Script error
Thanks you so much !! It works !
So now I want to play 2 .ogg at the same time, what should I do ?
07-01-2011 05:35 PM
Find all posts by this user Quote this message in a reply
HumiliatioN Offline
Posting Freak

Posts: 984
Joined: Dec 2010
Reputation: 10
Post: #7
RE: 2 Script error
(07-01-2011 05:35 PM)Hellday Wrote:  Thanks you so much !! It works !
So now I want to play 2 .ogg at the same time, what should I do ?

Sorry i cant help you continuosly but search this link for functions and you can found there that "Play music scripts easily" Smile

http://wiki.frictionalgames.com/hpl2/amn..._functions

Investigator - WIP
07-01-2011 10:38 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)