Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with script
lanlord000 Offline
Junior Member

Posts: 3
Threads: 1
Joined: Aug 2011
Reputation: 0
#1
Need help with script

What is wrong with this script, when i start the map it gives me an error. The names a right and everyting else. Am noobish at scripting

////////////////////////////
// Run when entering map
void OnEnter()

{
AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("roomkey_1");
}

void OnLeave()

{
AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("roomkey_2");
}

void OnLeave()

{
(This post was last modified: 08-22-2011, 12:32 PM by lanlord000.)
08-21-2011, 01:41 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Need help with script

Why do you have a use item callback in your OnLeave function? Do you know what OnLeave works for?

08-21-2011, 01:50 AM
Website Find
lanlord000 Offline
Junior Member

Posts: 3
Threads: 1
Joined: Aug 2011
Reputation: 0
#3
RE: Need help with script

(08-21-2011, 01:50 AM)Tanshaydar Wrote: Why do you have a use item callback in your OnLeave function? Do you know what OnLeave works for?

No Not really, nobbish at scripting
08-21-2011, 02:23 AM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#4
RE: Need help with script

Why you have double OnLeave?

The Interrogation
Chapter 1

My tutorials
08-21-2011, 02:26 AM
Find
Khan Offline
Member

Posts: 61
Threads: 12
Joined: Aug 2011
Reputation: 0
#5
RE: Need help with script

You dont need two OnLeave's. everything that happens will be above the Onleave.

void OnStart()
{
AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor_2", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("roomkey_1");
}
void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("roomkey_2");
}

void OnLeave()
{

}

That should work.
(This post was last modified: 08-21-2011, 12:53 PM by Khan.)
08-21-2011, 04:33 AM
Find
lanlord000 Offline
Junior Member

Posts: 3
Threads: 1
Joined: Aug 2011
Reputation: 0
#6
RE: Need help with script

(08-21-2011, 04:33 AM)Khan Wrote: You dont need two OnLeave's. everything that happens will be above the Onleave.

Void OnStart()
{
AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor_2", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("roomkey_1");
}
void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("roomkey_2");
}

void OnLeave()
{

}

That should work.

first it gave me an error but then i changed the Void to void and it worked
(This post was last modified: 08-21-2011, 12:28 PM by lanlord000.)
08-21-2011, 12:25 PM
Find
Khan Offline
Member

Posts: 61
Threads: 12
Joined: Aug 2011
Reputation: 0
#7
RE: Need help with script

(08-21-2011, 12:25 PM)lanlord000 Wrote:
(08-21-2011, 04:33 AM)Khan Wrote: You dont need two OnLeave's. everything that happens will be above the Onleave.

Void OnStart()
{
AddUseItemCallback("", "roomkey_1", "mansion_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "roomkey_2", "mansion_3", "UsedKeyOnDoor_2", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("roomkey_1");
}
void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("roomkey_2");
}

void OnLeave()
{

}

That should work.

first it gave me an error but then i changed the Void to void and it worked

woops, accidently put a capital V.
(This post was last modified: 08-21-2011, 12:53 PM by Khan.)
08-21-2011, 12:53 PM
Find




Users browsing this thread: 1 Guest(s)