| 
		
	
		| naseem142   Member
 
 Posts: 153
 Threads: 19
 Joined: Oct 2012
 Reputation: 
0
 | 
			| Error in code lines 
 
				Why am i getting this error?
 /////////////////////////////////////////////////////////////////////////////
 
 FATAL ERROR: could not load script file
 'custom_stories/Naseem/custom_stories/Naseem/Maps/Main.hps'!
 main (85, 1) : ERR : Unexpected token '{'
 
 /////////////////////////////////////////////////////////////////////////////
 
 Code:
 
 
 void OnStart()
 
 {
 
 AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
 
 SetEntityCallbackFunc("key_1", "OnPickup");
 
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 
 {
 
 SetSwingDoorLocked("locked_door1", false, true);
 
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 
 RemoveItem("key_1");
 
 }
 
 void OnPickup(string &in asEntity, string &in type)
 {
 SetEntityActive("servant_grunt_1", true);
 ShowEnemyPlayerPosition("servant_grunt_1");
 }
 
 void DoorLockedPlayer(string &in entity)
 
 
 {
 if(GetSwingDoorLocked("gruntdoorss") == true)
 {
 
 SetMessage("Messages", "gruntdoor", 0);
 
 }
 }
 
 //////////////////////////////////////////////////////////////////
 
 void OnEnter()
 
 
 {
 
 AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
 
 SetEntityCallbackFunc("trap", "OnPickup1");
 
 }
 
 void Trapitup(string &in asItem, string &in asEntity)
 
 {
 
 SetSwingDoorLocked("locked_door1", false, true);
 
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 
 RemoveItem("trap");
 
 }
 
 void OnPickup1(string &in asEntity, string &in type)
 {
 SetEntityActive("1", true);
 ShowEnemyPlayerPosition("1");
 SetEntityActive("2", true);
 ShowEnemyPlayerPosition("2");
 SetEntityActive("3", true);
 ShowEnemyPlayerPosition("3");
 SetEntityActive("4", true);
 ShowEnemyPlayerPosition("4");
 SetEntityActive("5", true);
 ShowEnemyPlayerPosition("5");
 
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////////
 
 
 {
 AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
 }
 
 
 void Explode(string &in asParent, string &in asChild, int alState)
 {
 SetPropHealth("vase_1", 0);
 SetPropHealth("vase_2", 0);
 }
 
				
(This post was last modified: 10-09-2012, 02:49 PM by naseem142.)
 |  |  
	| 10-09-2012, 02:47 PM |  |  
	
		| Ongka   Member
 
 Posts: 225
 Threads: 3
 Joined: Nov 2010
 Reputation: 
20
 | 
			| RE: Error in code lines 
 
				Wrong: 
Working one:Spoiler below! 
 
void OnStart()
 {
 AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("locked_door1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 RemoveItem("key_1");
 }
 
 void OnPickup(string &in asEntity, string &in type)
 {
 SetEntityActive("servant_grunt_1", true);
 ShowEnemyPlayerPosition("servant_grunt_1");
 }
 
 
 void DoorLockedPlayer(string &in entity)
 
 
 
 
 
 {
 
 if(GetSwingDoorLocked("gruntdoorss") == true)
 
 {
 
 
 
 SetMessage("Messages", "gruntdoor", 0);
 
 
 
 }
 
 }
 
 
 
 //////////////////////////////////////////////////////////////////
 
 
 
 void OnEnter()
 
 
 
 
 
 {
 
 
 
 AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
 
 
 
 SetEntityCallbackFunc("trap", "OnPickup1");
 
 
 
 }
 
 
 
 void Trapitup(string &in asItem, string &in asEntity)
 
 
 
 {
 
 
 
 SetSwingDoorLocked("locked_door1", false, true);
 
 
 
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 
 
 
 RemoveItem("trap");
 
 
 
 }
 
 
 
 void OnPickup1(string &in asEntity, string &in type)
 
 {
 
 SetEntityActive("1", true);
 
 ShowEnemyPlayerPosition("1");
 
 SetEntityActive("2", true);
 
 ShowEnemyPlayerPosition("2");
 
 SetEntityActive("3", true);
 
 ShowEnemyPlayerPosition("3");
 
 SetEntityActive("4", true);
 
 ShowEnemyPlayerPosition("4");
 
 SetEntityActive("5", true);
 
 ShowEnemyPlayerPosition("5");
 
 
 
 }
 
 
 
 
 
 ////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 {
 
 AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
 
 }
 
 
 
 
 
 void Explode(string &in asParent, string &in asChild, int alState)
 
 {
 
 SetPropHealth("vase_1", 0);
 
 SetPropHealth("vase_2", 0);
 
 }
 
 
 
 
Spoiler below! 
 
/////////////////////////////////////////////////////////////////////////////
 void OnStart()
 {
 AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
 AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("locked_door1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 RemoveItem("key_1");
 }
 
 void OnPickup(string &in asEntity, string &in type)
 {
 SetEntityActive("servant_grunt_1", true);
 ShowEnemyPlayerPosition("servant_grunt_1");
 }
 
 void DoorLockedPlayer(string &in entity)
 {
 if(GetSwingDoorLocked("gruntdoorss") == true)
 {
 SetMessage("Messages", "gruntdoor", 0);
 }
 }
 
 //////////////////////////////////////////////////////////////////
 
 void OnEnter()
 {
 AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
 SetEntityCallbackFunc("trap", "OnPickup1");
 }
 
 void Trapitup(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("locked_door1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 RemoveItem("trap");
 }
 
 void OnPickup1(string &in asEntity, string &in type)
 {
 SetEntityActive("1", true);
 ShowEnemyPlayerPosition("1");
 SetEntityActive("2", true);
 ShowEnemyPlayerPosition("2");
 SetEntityActive("3", true);
 ShowEnemyPlayerPosition("3");
 SetEntityActive("4", true);
 ShowEnemyPlayerPosition("4");
 SetEntityActive("5", true);
 ShowEnemyPlayerPosition("5");
 
 }
 
 void Explode(string &in asParent, string &in asChild, int alState)
 {
 SetPropHealth("vase_1", 0);
 SetPropHealth("vase_2", 0);
 }
 
 
 
Your collidecallback was placed wrong (marked in orange)
			
 ![[Image: 18694.png]](http://button.moddb.com/popularity/medium/mods/18694.png) 
				
(This post was last modified: 10-09-2012, 02:58 PM by Ongka.)
 |  |  
	| 10-09-2012, 02:55 PM |  |  
	
		| naseem142   Member
 
 Posts: 153
 Threads: 19
 Joined: Oct 2012
 Reputation: 
0
 | 
			| RE: Error in code lines 
 
				 (10-09-2012, 02:55 PM)Ongka Wrote:  Wrong:
 
Spoiler below! 
 
void OnStart()
 {
 AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("locked_door1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 RemoveItem("key_1");
 }
 
 void OnPickup(string &in asEntity, string &in type)
 {
 SetEntityActive("servant_grunt_1", true);
 ShowEnemyPlayerPosition("servant_grunt_1");
 }
 
 
 void DoorLockedPlayer(string &in entity)
 
 
 
 
 
 {
 
 if(GetSwingDoorLocked("gruntdoorss") == true)
 
 {
 
 
 
 SetMessage("Messages", "gruntdoor", 0);
 
 
 
 }
 
 }
 
 
 
 //////////////////////////////////////////////////////////////////
 
 
 
 void OnEnter()
 
 
 
 
 
 {
 
 
 
 AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
 
 
 
 SetEntityCallbackFunc("trap", "OnPickup1");
 
 
 
 }
 
 
 
 void Trapitup(string &in asItem, string &in asEntity)
 
 
 
 {
 
 
 
 SetSwingDoorLocked("locked_door1", false, true);
 
 
 
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 
 
 
 RemoveItem("trap");
 
 
 
 }
 
 
 
 void OnPickup1(string &in asEntity, string &in type)
 
 {
 
 SetEntityActive("1", true);
 
 ShowEnemyPlayerPosition("1");
 
 SetEntityActive("2", true);
 
 ShowEnemyPlayerPosition("2");
 
 SetEntityActive("3", true);
 
 ShowEnemyPlayerPosition("3");
 
 SetEntityActive("4", true);
 
 ShowEnemyPlayerPosition("4");
 
 SetEntityActive("5", true);
 
 ShowEnemyPlayerPosition("5");
 
 
 
 }
 
 
 
 
 
 ////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 {
 
 AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
 
 }
 
 
 
 
 
 void Explode(string &in asParent, string &in asChild, int alState)
 
 {
 
 SetPropHealth("vase_1", 0);
 
 SetPropHealth("vase_2", 0);
 
 }
 
 
 
 Working one:
 
 
Your collidecallback was placed wrong (marked in orange)Spoiler below! 
 
/////////////////////////////////////////////////////////////////////////////
 void OnStart()
 {
 AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
 AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
 SetEntityCallbackFunc("key_1", "OnPickup");
 }
 
 void UsedKeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("locked_door1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 RemoveItem("key_1");
 }
 
 void OnPickup(string &in asEntity, string &in type)
 {
 SetEntityActive("servant_grunt_1", true);
 ShowEnemyPlayerPosition("servant_grunt_1");
 }
 
 void DoorLockedPlayer(string &in entity)
 {
 if(GetSwingDoorLocked("gruntdoorss") == true)
 {
 SetMessage("Messages", "gruntdoor", 0);
 }
 }
 
 //////////////////////////////////////////////////////////////////
 
 void OnEnter()
 {
 AddUseItemCallback("", "trap", "locked_door1", "Trapitup", true);
 SetEntityCallbackFunc("trap", "OnPickup1");
 }
 
 void Trapitup(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("locked_door1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
 RemoveItem("trap");
 }
 
 void OnPickup1(string &in asEntity, string &in type)
 {
 SetEntityActive("1", true);
 ShowEnemyPlayerPosition("1");
 SetEntityActive("2", true);
 ShowEnemyPlayerPosition("2");
 SetEntityActive("3", true);
 ShowEnemyPlayerPosition("3");
 SetEntityActive("4", true);
 ShowEnemyPlayerPosition("4");
 SetEntityActive("5", true);
 ShowEnemyPlayerPosition("5");
 
 }
 
 void Explode(string &in asParent, string &in asChild, int alState)
 {
 SetPropHealth("vase_1", 0);
 SetPropHealth("vase_2", 0);
 }
 
 
 ooh , thank you so much X)
			 |  |  
	| 10-09-2012, 02:58 PM |  |  |