Bozcovich   
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 2 
	Joined: Jan 2012
	
 Reputation: 
0  
		 
	 
	
		
			
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   
	
		
	 
 
	
		 
		Statyk   
 
 
		
			Schrödinger's Mod 
			
			
			
 
			
	Posts: 4,390 
	Threads: 72 
	Joined: Sep 2011
	
 Reputation: 
241  
		 
	 
	
		
			
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   
	
		
	 
 
	
		 
		flamez3   
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 1,281 
	Threads: 48 
	Joined: Apr 2011
	
 Reputation: 
57  
		 
	 
	
		
			
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   
	
		
	 
 
	
		 
		Bozcovich   
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 2 
	Joined: Jan 2012
	
 Reputation: 
0  
		 
	 
	
		
			
RE: Scripts not working 
  
			 
			
				Now the key just disappears, the door is still locked 
 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   
	
		
	 
 
	
		 
		Unearthlybrutal   
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 775 
	Threads: 12 
	Joined: May 2011
	
 Reputation: 
26  
		 
	 
	
		
			
RE: Scripts not working 
  
			 
			
				 (01-13-2012, 09:22 PM) Bozcovich Wrote:   Now the key just disappears, the door is still locked   And i used the exact code you gave meIs it swing door or level door? 
			
 
			
			
 
			
		  
	
 
 
	01-13-2012, 10:34 PM   
	
		
	 
 
	
		 
		Bozcovich   
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 2 
	Joined: Jan 2012
	
 Reputation: 
0  
		 
	 
	
		
			
RE: Scripts not working 
  
			 
			
				Its a level door, but i tried it with a swing aswell :S
			
			
			
			
		  
	
 
 
	01-13-2012, 10:53 PM   
	
		
	 
 
	
		 
		Unearthlybrutal   
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 775 
	Threads: 12 
	Joined: May 2011
	
 Reputation: 
26  
		 
	 
	
		
			
RE: Scripts not working 
  
			 
			
				 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() 
{ 
 
}  
 
 
 
 
			 
			
			
 
			
		  
	
 
 
	01-13-2012, 10:58 PM   
	
		
	 
 
	
		 
		Bozcovich   
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 2 
	Joined: Jan 2012
	
 Reputation: 
0  
		 
	 
	
		
			
RE: Scripts not working 
  
			 
			
				Same problem :/
			
			
			
			
		  
	
 
 
	01-13-2012, 11:03 PM   
	
		
	 
 
	
		 
		oscar1007   
 
 
		
			Member 
			
			
			
 
			
	Posts: 64 
	Threads: 24 
	Joined: Oct 2011
	
 Reputation: 
0  
		 
	 
	
		
			
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!
			
 
			
			
 
			
				
(This post was last modified: 01-13-2012, 11:14 PM by oscar1007 .) 
 
				
			 
		  
	
 
 
	01-13-2012, 11:13 PM   
	
		
	 
 
	
		 
		Bozcovich   
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 11 
	Threads: 2 
	Joined: Jan 2012
	
 Reputation: 
0  
		 
	 
	
		
			
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