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
2 Script error
Hellday Offline
Junior Member

Posts: 7
Threads: 2
Joined: Jul 2011
Reputation: 0
#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
TFEF Offline
Member

Posts: 143
Threads: 0
Joined: Feb 2011
Reputation: 1
#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
Hellday Offline
Junior Member

Posts: 7
Threads: 2
Joined: Jul 2011
Reputation: 0
#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
TFEF Offline
Member

Posts: 143
Threads: 0
Joined: Feb 2011
Reputation: 1
#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
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#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.


“Life is a game, play it”
07-01-2011, 03:57 PM
Find
Hellday Offline
Junior Member

Posts: 7
Threads: 2
Joined: Jul 2011
Reputation: 0
#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
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#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

“Life is a game, play it”
07-01-2011, 10:38 PM
Find




Users browsing this thread: 1 Guest(s)