Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need some script help!
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#11
RE: Need some script help!

(02-24-2012, 11:42 PM)ammislol Wrote:
(02-24-2012, 11:29 PM)Obliviator27 Wrote: To lock the Camera, put
SetPlayerActive(false); in the StartLookSequence function, and then
I messed up on the timers. Where it says
AddTimer("LookTimee4", 12, "NextLook");
Replace it with
AddTimer("LookTimer4", 12, "NextLook");

And finally, put
SetPlayerActive(true);
where the SetEntityActive script is.
So where excact should i change? my script looks like this atm -


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", false, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 12, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
SetPlayerActive(false);
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}
if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetPlayerActive(true);
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}



Sorry for being such a noob :< Great help tho! thanks alot.
^ Fix'd.


(This post was last modified: 02-24-2012, 11:46 PM by Obliviator27.)
02-24-2012, 11:45 PM
Find
ammislol Offline
Junior Member

Posts: 24
Threads: 6
Joined: Feb 2012
Reputation: 0
#12
RE: Need some script help!

(02-24-2012, 11:45 PM)Obliviator27 Wrote:
(02-24-2012, 11:42 PM)ammislol Wrote:
(02-24-2012, 11:29 PM)Obliviator27 Wrote: To lock the Camera, put
SetPlayerActive(false); in the StartLookSequence function, and then
I messed up on the timers. Where it says
AddTimer("LookTimee4", 12, "NextLook");
Replace it with
AddTimer("LookTimer4", 12, "NextLook");

And finally, put
SetPlayerActive(true);
where the SetEntityActive script is.
So where excact should i change? my script looks like this atm -


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", false, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 12, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
SetPlayerActive(false);
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}
if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetPlayerActive(true);
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}



Sorry for being such a noob :< Great help tho! thanks alot.
^ Fix'd.



Works great! now only one more thing LOL :<

The camera moves to area1,2 and 3, but not 4. It just stops after the 3rd, then the monster spawns and breaks the door, but if i stay around the ScriptArea_5. It keeps repeating so it looks at the areas while getting killed by the monster, is there anyway to make it so only look at it once, not everytime i enter the area, if you understand? and how to add a sound when i enter the ScriptArea_5? Sorry for all questions, hope you dont mind.
(This post was last modified: 02-25-2012, 12:14 AM by ammislol.)
02-24-2012, 11:56 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#13
RE: Need some script help!

EDIT: Was too slow :>

(This post was last modified: 02-26-2012, 10:29 AM by flamez3.)
02-26-2012, 10:29 AM
Find
ammislol Offline
Junior Member

Posts: 24
Threads: 6
Joined: Feb 2012
Reputation: 0
#14
RE: Need some script help!

(02-26-2012, 10:29 AM)flamez3 Wrote: EDIT: Was too slow :>



Indeed :/
02-26-2012, 11:43 AM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#15
RE: Need some script help!

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 16, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}

if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}

Bolded areas are what I altered.

02-26-2012, 04:38 PM
Find
ammislol Offline
Junior Member

Posts: 24
Threads: 6
Joined: Feb 2012
Reputation: 0
#16
RE: Need some script help!

(02-26-2012, 04:38 PM)Obliviator27 Wrote: void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);
}
void StartLookSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookTimer1", 4, "NextLook");
AddTimer("LookTimer2", 8, "NextLook");
AddTimer("LookTimer3", 12, "NextLook");
AddTimer("LookTimer4", 16, "NextLook");
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
void NextLook(string &in asTimer)
{
if(asTimer == "LookTimer1")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
if(asTimer == "LookTimer2")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2, 2, "");
}
if(asTimer == "LookTimer3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_4", 2, 2, "");
}

if(asTimer == "LookTimer4")
{
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}

Bolded areas are what I altered.
Yeah works now, but if i turn around and try to run away from the monster I enter the area again - and the player starts to look at area_1,2,3,4 again. Is there anyway to make it so the player only look ONCE and not everytime he enters area_5?
02-26-2012, 05:22 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#17
RE: Need some script help!

By changing the statement to true, it should only happen once.

02-26-2012, 05:31 PM
Find
ammislol Offline
Junior Member

Posts: 24
Threads: 6
Joined: Feb 2012
Reputation: 0
#18
RE: Need some script help!

(02-26-2012, 05:31 PM)Obliviator27 Wrote: By changing the statement to true, it should only happen once.
I've got AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);

still the same Confused
02-26-2012, 05:39 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#19
RE: Need some script help!

(02-26-2012, 05:39 PM)ammislol Wrote:
(02-26-2012, 05:31 PM)Obliviator27 Wrote: By changing the statement to true, it should only happen once.
I've got AddEntityCollideCallback("Player", "ScriptArea_5", "StartLookSequence", true, 1);

still the same Confused
Remove any map_cache files, that may be the root of the problem.



02-26-2012, 05:39 PM
Find




Users browsing this thread: 2 Guest(s)