Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
Script is just... broken? 
			 
			
				I tried getting these two things in it to work, but it just seems broken. And by the way, I was attempting to replace a "needle" for a "key". I worked with both of these scripts on my other custom story and it work perfectly. Also for some reason, it won't set the lamp oil to 0...   
The entities in my game are: CastleDoor, CastleDoor2, and Needle.
 
Code:
 
void Onstart() 
{ 
	AddUseItemCallback("" , "Needle" , "CastleDoor2" , "UsedNeedleOnDoor" , false); 
	AddEntityCollideCallback("Player" , "ScriptArea_1" , "Collide01" , true , 1); 
	SetPlayerLampOil(0); 
} 
void Collide01(string &in asParent , string &in asChild , int alState) 
{ 
	SetSwingDoorClosed("CastleDoor" , true , true); 
	GiveSanityDamage(10 , true); 
} 
void UsedNeedleOnDoor(string &in asItem , string &in asEntity) 
{ 
	PlaySoundAtEntity("UnlockSound" , "unlock_door.snt" , asEntity , 0.0f , false); 
	SetSwingDoorLocked(asEntity , false , true); 
	SetLevelDoorLocked(asEntity , false); 
} 
void OnEnter() 
{ 
} 
void OnLeave() 
{ 
}
 
Code:
 
<LANGUAGE> 
	<RESOURCES> 
	</RESOURCES> 
	<CATEGORY Name="CustomStoryMain"> 
		<Entry Name="Description">You awaken in a castle, not knowing of where you are. Some dark presence is following you, yet you cannot stop it.[br][br]You are alone...</Entry> 
	</CATEGORY> 
	<CATEGORY Name="Inventory"> 
	<Entry Name="ItemName_Needle">Sewing Needle</Entry> 
	<Entry Name="ItemDesc_Needle">A simple needle that could be used to pick a lock.</Entry> 
	</CATEGORY> 
</LANGUAGE>
			  
			
			
 
			
		 |  
	 
 | 
 
	| 10-15-2010, 02:02 AM  | 
	
		
	 | 
 
 
	
		
		DamnNoHtml 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 469 
	Threads: 34 
	Joined: Sep 2010
	
 Reputation: 
16
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				void OnStart () 
 
Not void Onstart () 
 
Also, sounds like a wonderfully unoriginal story from that description -_-
			 
			
			
 
Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3.... 
			
		 |  
	 
 | 
 
	| 10-15-2010, 06:24 AM  | 
	
		
	 | 
 
 
	
		
		Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				I know, I'm gonna change it later. I just wanted to quickly put something in....   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 10-15-2010, 11:12 AM  | 
	
		
	 | 
 
 
	
		
		SLi78 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 23 
	Threads: 6 
	Joined: Sep 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
			
			
			
		 |  
	 
 | 
 
	| 10-15-2010, 05:11 PM  | 
	
		
	 | 
 
 
	
		
		Chilton 
 
 
		
			Member 
			
			
			
 
			
	Posts: 138 
	Threads: 9 
	Joined: Sep 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				 (10-15-2010, 05:11 PM)SLi78 Wrote:  Have you tried 
 
? It does not work that way at all... 
F segmas represent time, not quantity i believe
 
Itd be nice if we knew if the issue was resolved though...
			  
			
			
			
		 |  
	 
 | 
 
	| 10-15-2010, 05:52 PM  | 
	
		
	 | 
 
 
	
		
		Entih 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 47 
	Threads: 4 
	Joined: Sep 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				No, a number like '0.0f' represents that it is a floating point value, IE uses a decimal.  It is the proper notation in C++ when working with float values, and by extension this script, though this script is far less... strict... on the f's usage it seems.  I still use it for all float values though. 
 
The lamp oil function does take a float, from 0 to 100 percent, so using 0.0f may actually make it work, though 0 should have worked just as well. 
 
EDIT: Yeah, just tested it, the script is not much of a stickler.  The lamp oil function works with just standard old 0 just the same as 0.0f.
			 
			
			
			
		 |  
	 
 | 
 
	| 10-15-2010, 06:15 PM  | 
	
		
	 | 
 
 
	
		
		Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				It's okay guys, it worked when I fixed the script.  
I also got another problem... I looked in the script functions and couldn't find the right one that made something happen when you, in this case, read a note that you pick up. So I just tried as a last resort to use another scripting callback. 
 
void OnStart() 
{ 
	PreloadSound("00_laugh.snt"); 
	AddEntityCollideCallback("Player" , "note_scroll_1" , "Collapse" , true , 1); 
	AddUseItemCallback("" , "Needle" , "CastleDoor2" , "UsedNeedleOnDoor" , false); 
	AddEntityCollideCallback("Player" , "ScriptArea_1" , "Collide01" , true , 1); 
	SetPlayerLampOil(0); 
} 
void Collide01(string &in asParent , string &in asChild , int alState) 
{ 
	SetSwingDoorClosed("CastleDoor" , true , true); 
	GiveSanityDamage(10 , true); 
} 
void UsedNeedleOnDoor(string &in asItem , string &in asEntity) 
{ 
	PlaySoundAtEntity("UnlockSound" , "unlock_door.snt" , asEntity , 0.0f , false); 
	SetSwingDoorLocked(asEntity , false , true); 
	SetLevelDoorLocked(asEntity , false); 
} 
void Collapse(string &in asParent , string&in asCild , int alState) 
{ 
	SetEntityActive("wooden_board01_1" , true); 
	SetEntityActive("rock_debris01_1" , true); 
	SetEntityActive("rock_debris03_1" , true); 
	PlaySoundAtEntity("LaughSound" , "00_laugh.snt" , "Player" , 0 , true); 
} 
void OnEnter() 
{ 
} 
void OnLeave() 
{ 
}
			
			
			
 
			
				
(This post was last modified: 10-15-2010, 11:46 PM by Kyle.)
 
				
			 
		 |  
	 
 | 
 
	| 10-15-2010, 11:44 PM  | 
	
		
	 | 
 
 
	
		
		Entih 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 47 
	Threads: 4 
	Joined: Sep 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				If you want something to trigger when you pick up the note, a standard interact callback should work fine.  At least in theory such would work fine, haven't tested.
			 
			
			
			
		 |  
	 
 | 
 
	| 10-16-2010, 02:37 AM  | 
	
		
	 | 
 
 
	
		
		Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				 (10-16-2010, 02:37 AM)Entih Wrote:  If you want something to trigger when you pick up the note, a standard interact callback should work fine.  At least in theory such would work fine, haven't tested. 
Nope, it wouldn't work. It would require a function to cause the other events... unless if you got any other bright ideas...   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 10-16-2010, 02:48 AM  | 
	
		
	 | 
 
 
	
		
		Entih 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 47 
	Threads: 4 
	Joined: Sep 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Script is just... broken? 
			 
			
				I found a semi-alternative, based on how they did it in the game in the Archives.  Use the item 'diary_paper_01'.  It has a diary pickup callback, apparently (info on the callback function parameters pop up if you hover the mouse over it). 
 
Sadly, it also appears to be that the diary paper uses a bit of a different methodology for the text and name entries, being "Diary_<TEXTENTRYNAME>_Name<INDEXNUMBER>" and "Diary_..._Text...", with index meaning which numbered 'entry' it was, starting at 1.  Have not used the diary versus note especially, myself, I cannot say just how any of this works.
			 
			
			
			
		 |  
	 
 | 
 
	| 10-16-2010, 03:08 AM  | 
	
		
	 | 
 
 
	 
 |