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
Scripts not working
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#1
Scripts not working

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.
(This post was last modified: 01-17-2012, 01:43 AM by Bozcovich.)
01-12-2012, 09:54 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#2
RE: Scripts not working

Do you have two "void OnStart"s?

ALSO: This is in the wrong section. Should be in the Development Support.
01-13-2012, 12:23 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#3
RE: Scripts not working

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.

01-13-2012, 01:29 AM
Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#4
RE: Scripts not working

Now the key just disappears, the door is still locked Sad And i used the exact code you gave me
(This post was last modified: 01-13-2012, 09:26 PM by Bozcovich.)
01-13-2012, 09:22 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#5
RE: Scripts not working

(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?

When Life No Longer Exists
Full-conversion mod
01-13-2012, 10:34 PM
Website Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#6
RE: Scripts not working

Its a level door, but i tried it with a swing aswell :S
01-13-2012, 10:53 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#7
RE: Scripts not working

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()
{

}



When Life No Longer Exists
Full-conversion mod
01-13-2012, 10:58 PM
Website Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#8
RE: Scripts not working

Same problem :/
01-13-2012, 11:03 PM
Find
oscar1007 Offline
Member

Posts: 64
Threads: 24
Joined: Oct 2011
Reputation: 0
#9
RE: Scripts not working

(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!

Money can't buy you happiness. But I rather cry in my ferrari.

PROJECT:
http://www.moddb.com/mods/oscar1007
(This post was last modified: 01-13-2012, 11:14 PM by oscar1007.)
01-13-2012, 11:13 PM
Find
Bozcovich Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jan 2012
Reputation: 0
#10
RE: Scripts not working

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()
{

}
01-13-2012, 11:26 PM
Find




Users browsing this thread: 2 Guest(s)