| 
		
	
		| 7heDubz   Posting Freak
 
 Posts: 1,329
 Threads: 40
 Joined: Feb 2013
 Reputation: 
41
 | 
			| There has got to be an easier way to do this... 
 
				The script works fine, There just has to be an easier way to do this I just don't know how. 
My scripting knowledge is mediocre at best while I know most of the words offhand I can't exactly implement them.
 
Anyone?
 void OnStart(){}void OnLeave(){}
 void OnEnter(){
 SetEntityPlayerInteractCallback("book", "pages", true);
 AddUseItemCallback("", "key", "door", "unlock", true);
 SetSwingDoorLocked("door", true, false);
 PlayMusic("TemptingSecrets.ogg", true, .7f, .5f, 2, true);
 SetEntityActive("book_open_1", false);
 }
 void unlock(string &in asItem, string &in asEntity){
 SetSwingDoorLocked("door", false, true);
 PlayGuiSound("unlock_door.snt", 1.0f);
 PreloadParticleSystem("Paper_Blow_Fall.ps");
 }
 void pages(string &in asEntity){
 CreateParticleSystemAtEntity("particle", "Paper_Blow_Fall.ps", "particle_spawner", false);
 AddPlayerBodyForce(-20000, 0, 0, false);
 AddTimer("timer_1", 1.0f, "act_ent1");
 AddTimer("timer_10", .5f, "sound1");
 }
 void sound1(string &in asTimer){
 SetEntityActive("fakebook", true);
 AddPropForce("fakebook", -150, -30,  0, "world");
 PlayGuiSound("book_paper_fall.ogg", 1.0f);
 }
 void act_ent1(string &in asTimer){
 SetEntityActive("note_1", true);
 StartPlayerLookAt("note_1", 10, 10, "");
 AddTimer("timer_2", 1.0f, "act_ent2");
 }
 void act_ent2(string &in asTimer){
 SetEntityActive("note_2", true);
 StartPlayerLookAt("note_3", 5, 5, "");
 AddTimer("timer_3", 1.0f, "act_ent3");
 AddQuest("pickup", "pickup");
 }
 void act_ent3(string &in asTimer){
 SetEntityActive("note_3", true);
 AddTimer("timer_4", 1.0f, "act_ent4");
 }
 void act_ent4(string &in asTimer){
 SetEntityActive("note_4", true);
 StartPlayerLookAt("note_5", 5, 5, "");
 AddTimer("timer_5", 1.0f, "act_ent5");
 }
 void act_ent5(string &in asTimer){
 SetEntityActive("note_5", true);
 StartPlayerLookAt("note_6", 9, 9, "");
 AddTimer("timer_6", 1.0f, "act_ent6");
 }
 void act_ent6(string &in asTimer){
 SetEntityActive("note_6", true);
 AddTimer("timer_7", 1.0f, "act_ent7");
 }
 void act_ent7(string &in asTimer){
 SetEntityActive("note_7", true);
 StartPlayerLookAt("note_8", 7, 7, "");
 AddTimer("timer_8", 1.0f, "act_ent8");
 }
 void act_ent8(string &in asTimer){
 SetEntityActive("note_8", true);
 StartPlayerLookAt("note_1", 15, 15, "");
 StopPlayerLookAt();
 }
So what happens is the player clicks on a book and all the pages fall out, One page after the other so the player gets some manner of idea as which to pic up first.
			
 |  |  
	| 03-01-2014, 09:22 PM |  |  
	
		| Neelke   Senior Member
 
 Posts: 668
 Threads: 82
 Joined: Apr 2013
 Reputation: 
26
 | 
			| RE: There has got to be an easier way to do this... 
 
				Well, the timers can be changed to this. void pages(string &in asEntity){CreateParticleSystemAtEntity("particle", "Paper_Blow_Fall.ps", "particle_spawner", false);
 AddPlayerBodyForce(-20000, 0, 0, false);
 AddTimer("timer_1", 1.0f, "timer");
 AddTimer("timer_10", .5f, "timer");
 }
 
 void timer(string &in asTimer)
 {
 if(asTimer == "timer_1"){
 SetEntityActive("note_1", true);
 StartPlayerLookAt("note_1", 10, 10, "");
 AddTimer("timer_2", 1.0f, "act_ent2");
 }
 else if(asTimer == "timer_10"){
 SetEntityActive("fakebook", true);
 AddPropForce("fakebook", -150, -30,  0, "world");
 PlayGuiSound("book_paper_fall.ogg", 1.0f);
 }
 }
Or this:
 void pages(string &in asEntity){CreateParticleSystemAtEntity("particle", "Paper_Blow_Fall.ps", "particle_spawner", false);
 AddPlayerBodyForce(-20000, 0, 0, false);
 AddTimer("timer", 1.0f, "timer");
 AddTimer("timer_10", .5f, "sound1");
 }
 
 void sound1(string &in asTimer)
 {
 SetEntityActive("fakebook", true);
 AddPropForce("fakebook", -150, -30,  0, "world");
 PlayGuiSound("book_paper_fall.ogg", 1.0f);
 }
 
 void timer(string &in asTimer)
 {
 string sEvent = asTimer;
 float fEventSpeed = 1.0f;
 bool bPauseAtStep = false;
 AddLocalVarInt(asTimer, 1);
 
 switch(GetLocalVarInt(sEvent))
 {
 case 1:
 SetEntityActive("note_1", true);
 StartPlayerLookAt("note_1", 10, 10, "");
 fEventSpeed = 1.0f;  //The time before starting the next case
 break;
 case 2:
 SetEntityActive("note_2", true);
 StartPlayerLookAt("note_3", 5, 5, "");
 AddQuest("pickup", "pickup");
 fEventSpeed = 1.0f;
 break;
 case 3:
 //Just continue your timers here
 break;
 
 //Called when no more cases are found
 default:
 bPauseAtStep = true;
 break;
 }
 
 if(!bPauseAtStep)
 AddTimer(sEvent, fEventSpeed, sEvent);
 }
Well, there are two here. Hopefully at least one of them well serve useful.
			 |  |  
	| 03-01-2014, 10:08 PM |  |  |