Frictional Games Forum (read-only)

Full Version: Scripts not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey, ive recently started making a custom story (my first). I cant get the scripts to start working, i have a script to open a door with a key, but it doesnt work, and i have a script that gives the player a lantern in the begginning and that doesnt work either. Help please?


Here is the scripts:

Door:
void OnStart()

{
AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true);
}

void hax(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);

}




void OnEnter()
{

}


void OnLeave()
{

}


Lantern:

//===========================================

void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}


void OnEnter()
{
}


void OnLeave()
{
}
And i cant see the maps when i am in the folder if that is a problem. I have named the .hps file the same as the map.
Do you have two "void OnStart"s?

ALSO: This is in the wrong section. Should be in the Development Support.
Use this:


Quote:void OnStart()

{
AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true);
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}

void hax(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door" , 0, false);
RemoveItem("SUPER HAX KEY THAT SUCKS");

}




void OnEnter()
{

}


void OnLeave()
{

}
Whenever you are naming something in a field that has the word "string" in it means that you need to put the exact name of the thing you are describing as well as "" around the start and end of the text. I fixed it up for you.
Now the key just disappears, the door is still locked Sad And i used the exact code you gave me
(01-13-2012, 09:22 PM)Bozcovich Wrote: [ -> ]Now the key just disappears, the door is still locked Sad And i used the exact code you gave me
Is it swing door or level door?
Its a level door, but i tried it with a swing aswell :S
Smile Try this:

Spoiler below!

void OnStart()

{
AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true);
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}

void hax(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("das door", false);
PlaySoundAtEntity("", "unlock_door", "door" , 0, false);
RemoveItem("SUPER HAX KEY THAT SUCKS");

}




void OnEnter()
{

}


void OnLeave()
{

}


Same problem :/
(01-12-2012, 09:54 PM)Bozcovich Wrote: [ -> ]Hey, ive recently started making a custom story (my first). I cant get the scripts to start working, i have a script to open a door with a key, but it doesnt work, and i have a script that gives the player a lantern in the begginning and that doesnt work either. Help please?


Here is the scripts:

Door:
void OnStart()

{
AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true);
}

void hax(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);

}




void OnEnter()
{

}


void OnLeave()
{

}


Lantern:

//===========================================

void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}


void OnEnter()
{
}


void OnLeave()
{
}
And i cant see the maps when i am in the folder if that is a problem. I have named the .hps file the same as the map.

Instead of having this:
SetSwingDoorLocked(door, false, true);

Try this:
SetSwingDoorLocked("das door", false);

Or if its a level door:
SetLevelDoorLocked("das door", false);


peace out. hope it works!
That didnt work either, but i just tried this and it worked:


void OnStart()

{
AddUseItemCallback("", "SUPER HAX KEY THAT SUCKS", "das door", "hax", true);
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}

void hax(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("das door", false);
PlaySoundAtEntity("", "unlock_door", "door" , 0, false);
RemoveItem("SUPER HAX KEY THAT SUCKS");

}




void OnEnter()
{

}


void OnLeave()
{

}
Pages: 1 2