| 
		
	
		| ferryadams10   Senior Member
 
 Posts: 288
 Threads: 40
 Joined: Apr 2011
 Reputation: 
19
 | 
			| RE: Need help with scripting! 
 
				 (12-28-2011, 02:53 PM)SilentStriker Wrote:  Have you got it to work?  becuse i think i know what the problem is   
 If im not mistaken it should look like this:
  (12-27-2011, 07:56 PM)Zaapeer Wrote:  void OnStart() the bolded ones is the ones I moved
 {
 AddEntityCollideCallback("Player", "door_slamHousekeeper", "func_slam", true, 1);
 AddUseItemCallback("", "FirstRoomKey_1", "BedroomDoorFirst_1", "unlock_door", true);
 AddEntityCollideCallback("Player", "NoOil", "Collide_Area", true, 1);
 }
 
 void func_slam(string &in asParent, string &in asChild, int alState)
 {
 SetSwingDoorClosed("HousekeeperDoor", true, false);
 PlaySoundAtEntity("DoorSlamSound", "scare_slam_door.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
 GiveSanityDamage(5.0f, true);
 }
 
 void Collide_Area(string &in asParent, string &in asChild, int alState)
 {
 SetPlayerLampOil(0.0f);
 }
 
 void unlock_door(string &in FirstRoomKey_1, string &in BedroomDoorFirst_1)
 {
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 void OnEnter()
 {
 
 
 }
 
 void OnLeave()
 {
 
 }
  You need to have them in either void onstart, void onenter or void onleave 
 
 Correct me if i'm mistaken
  
Could you check my first reply in here?
 
I said the exact thing x)
			 
 Got a nice sofaPlease come and have a seat for a while
 
 
 |  |  
	| 12-28-2011, 03:04 PM |  |  
	
		| flamez3   Posting Freak
 
 Posts: 1,281
 Threads: 48
 Joined: Apr 2011
 Reputation: 
57
 | 
			| RE: Need help with scripting! 
 
				[quote='SilentStriker' pid='107396' dateline='1325080381'][quote='Zaapeer' pid='107259' dateline='1325012197']void unlock_door(string &in FirstRoomKey_1, string &in BedroomDoorFirst_1)
 {
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 It's supposed to be (string &in asItem, string &in asEntity) as well.
 
 
				
(This post was last modified: 12-28-2011, 03:05 PM by flamez3.)
 |  |  
	| 12-28-2011, 03:05 PM |  |  
	
		| Zaapeer   Junior Member
 
 Posts: 32
 Threads: 9
 Joined: Dec 2011
 Reputation: 
0
 | 
			| RE: Need help with scripting! 
 
				 (12-28-2011, 02:53 PM)SilentStriker Wrote:  Have you got it to work?  becuse i think i know what the problem is  
 If im not mistaken it should look like this:
  (12-27-2011, 07:56 PM)Zaapeer Wrote:  void OnStart()the bolded ones is the ones I moved
 {
 AddEntityCollideCallback("Player", "door_slamHousekeeper", "func_slam", true, 1);
 AddUseItemCallback("", "FirstRoomKey_1", "BedroomDoorFirst_1", "unlock_door", true);
 AddEntityCollideCallback("Player", "NoOil", "Collide_Area", true, 1);
 }
 
 void func_slam(string &in asParent, string &in asChild, int alState)
 {
 SetSwingDoorClosed("HousekeeperDoor", true, false);
 PlaySoundAtEntity("DoorSlamSound", "scare_slam_door.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
 GiveSanityDamage(5.0f, true);
 }
 
 void Collide_Area(string &in asParent, string &in asChild, int alState)
 {
 SetPlayerLampOil(0.0f);
 }
 
 void unlock_door(string &in FirstRoomKey_1, string &in BedroomDoorFirst_1)
 {
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 void OnEnter()
 {
 
 
 }
 
 void OnLeave()
 {
 
 }
  You need to have them in either void onstart, void onenter or void onleave 
 
 Correct me if i'm mistaken
  Thanks dude it worked! AWESOME
			 |  |  
	| 12-28-2011, 03:19 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Need help with scripting! 
 
				 (12-28-2011, 03:04 PM)ferryadams10 Wrote:   (12-28-2011, 02:53 PM)SilentStriker Wrote:  Have you got it to work?  becuse i think i know what the problem is   
 If im not mistaken it should look like this:
  (12-27-2011, 07:56 PM)Zaapeer Wrote:  void OnStart() the bolded ones is the ones I moved. You need to have them in either void onstart, void onenter or void onleave
 {
 AddEntityCollideCallback("Player", "door_slamHousekeeper", "func_slam", true, 1);
 AddUseItemCallback("", "FirstRoomKey_1", "BedroomDoorFirst_1", "unlock_door", true);
 AddEntityCollideCallback("Player", "NoOil", "Collide_Area", true, 1);
 }
 
 void func_slam(string &in asParent, string &in asChild, int alState)
 {
 SetSwingDoorClosed("HousekeeperDoor", true, false);
 PlaySoundAtEntity("DoorSlamSound", "scare_slam_door.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
 GiveSanityDamage(5.0f, true);
 }
 
 void Collide_Area(string &in asParent, string &in asChild, int alState)
 {
 SetPlayerLampOil(0.0f);
 }
 
 void unlock_door(string &in FirstRoomKey_1, string &in BedroomDoorFirst_1)
 {
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 void OnEnter()
 {
 
 
 }
 
 void OnLeave()
 {
 
 }
 
 
 Correct me if i'm mistaken
  
 Could you check my first reply in here?
 
 I said the exact thing x)
 Yes i saw it but he is new to scripting so you needed to write in another way    
  (12-28-2011, 03:19 PM)Zaapeer Wrote:   (12-28-2011, 02:53 PM)SilentStriker Wrote:  Have you got it to work? Thanks dude it worked! AWESOME becuse i think i know what the problem is  
 If im not mistaken it should look like this:
  (12-27-2011, 07:56 PM)Zaapeer Wrote:  void OnStart()the bolded ones is the ones I moved. You need to have them in either void onstart, void onenter or void onleave
 {
 AddEntityCollideCallback("Player", "door_slamHousekeeper", "func_slam", true, 1);
 AddUseItemCallback("", "FirstRoomKey_1", "BedroomDoorFirst_1", "unlock_door", true);
 AddEntityCollideCallback("Player", "NoOil", "Collide_Area", true, 1);
 }
 
 void func_slam(string &in asParent, string &in asChild, int alState)
 {
 SetSwingDoorClosed("HousekeeperDoor", true, false);
 PlaySoundAtEntity("DoorSlamSound", "scare_slam_door.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
 PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
 GiveSanityDamage(5.0f, true);
 }
 
 void Collide_Area(string &in asParent, string &in asChild, int alState)
 {
 SetPlayerLampOil(0.0f);
 }
 
 void unlock_door(string &in FirstRoomKey_1, string &in BedroomDoorFirst_1)
 {
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 void OnEnter()
 {
 
 
 }
 
 void OnLeave()
 {
 
 }
 
 
 Correct me if i'm mistaken
  No problem    
  (12-28-2011, 03:05 PM)flamez3 Wrote:   (12-28-2011, 02:53 PM)SilentStriker Wrote:   (12-27-2011, 07:56 PM)Zaapeer Wrote:  void unlock_door(string &in FirstRoomKey_1, string &in BedroomDoorFirst_1)Yes he needs to change that too{
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 It's supposed to be (string &in asItem, string &in asEntity) as well.
  
 so use this:
 
 void unlock_door(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked(BedroomDoorFirst_1, false, true);
 PlaySoundAtEntity("", "unlock_door", BedroomDoorFirst_1, 0, false);
 RemoveItem(FirstRoomKey_1);
 }
 
 
				
(This post was last modified: 12-28-2011, 03:27 PM by SilentStriker.)
 |  |  
	| 12-28-2011, 03:24 PM |  |  |