Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help me :(
Author Message
pdkgaming Offline
Junior Member

Posts: 16
Joined: Jun 2012
Reputation: 0
Post: #1
Please help me :(
Hi all,

I'm making my first custom story now and im kinda stuck at scripting... I thought I knew pretty much already but I still seem to get stuck Sad

Here is my script for my map:


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "playsound", true, 1);
AddUseItemCallback("StudyKey", "studykey_1", "mansion_2", "UsedKeyOnDoor", true);
SetEnemyIsHallucination("servant_grunt_1", true);
AddEntityCollideCallback("Player", "ScriptArea_2", "EnemyAppear", true, 1);
AddEntityCollideCallback("servant_grunt_1", "ScriptArea_3", "EnemyDisable", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "LookTimer", true, 1); // TROUBLE HERE?
}

void playsound(string &in asParent, string &in asChild, int alState)
{
PlayMusic("break_wood1.ogg", false, 1, 0, 1.0, false);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("unlock_door.snt", "unlock_door", "mansion_2", 0.0f, false);
RemoveItem("studykey_1");
}

void EnemyAppear(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}

void EnemyDisable(string &in asParent, string &in asChild, int alState)
{
FadeEnemyToSmoke("servant_grunt_1", false);
}

// HAVING TROUBLE FROM HERE
// makes sure the player looks at Compound_5
void LookTimer(string &in asTimer)
{
AddTimer("LookAtEntity_1", 0, "LookAt_1");
}

// makes sure the player looks at chest_of_drawers_nice_broken_1
void Timer_1(string &in asTimer)
{
StopPlayerLookAt();
AddTimer("LookAtEntity_2", 1, "LookAt_2");
}

// makes sure the player looks at painting03_1
void Timer_2(string &in asTimer)
{
StopPlayerLookAt();
AddTimer("LookAtEntity_3", 1, "LookAt_3");
}

//LookTimer
void LookAt_1(string &in asEntity)
{
StartPlayerLookAt("Compound_5", 1, 1, "Timer_1");
}

// Timer_1
void LookAt_2(string &in asEntity)
{
StartPlayerLookAt("chest_of_drawers_nice_broken_1", 1, 1, "Timer_2");
}

// Timer_2
void LookAt_3(string &in asEntity)
{
StartPlayerLookAt("painting03_1", 1, 1, "Timer_3");
}

void OnLeave()
{

}

after the part that says "// HAVING TROUBLE FROM HERE" (obviously) I got stuck.. as well as the part at OnStart: "// TROUBLE HERE??" I want the player to look at 3 entities and then fall down as your sanity goes to 0. After that happened I want it to load a new map.. Though I didn't even got the player to look at certain entities... not any entity at all Sad Can someone please help me? Huh

I hope you guys can figure it out a bit..

Thanks! Big Grin

Map tester
CS creator (beginner)
Youtube:
http://www.youtube.com/pdkgaming
06-12-2012 04:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Adny Offline
Posting Freak

Posts: 1,757
Joined: Mar 2012
Reputation: 169
Post: #2
RE: Please help me :(
Aha! I love helping! I found your problem.

This line calls a collide callback

AddEntityCollideCallback("Player", "ScriptArea_4", "LookTimer", true, 1);


but this line has (string &in asTimer) instead of (string &in asParent, string &in asChild, int alState)


void LookTimer(string &in asTimer)



change it to this:


void LookTimer(string &in asParent, string &in asChild, int alState)



That should fix your problem, but I will keep looking over the script if that wasn't the solution!

Timorem and Friends are Hungry™
06-12-2012 05:14 PM
Find all posts by this user Quote this message in a reply
pdkgaming Offline
Junior Member

Posts: 16
Joined: Jun 2012
Reputation: 0
Post: #3
RE: Please help me :(
(06-12-2012 05:14 PM)andyrockin123 Wrote:  Aha! I love helping! I found your problem.

This line calls a collide callback

AddEntityCollideCallback("Player", "ScriptArea_4", "LookTimer", true, 1);


but this line has (string &in asTimer) instead of (string &in asParent, string &in asChild, int alState)


void LookTimer(string &in asTimer)



change it to this:


void LookTimer(string &in asParent, string &in asChild, int alState)



That should fix your problem, but I will keep looking over the script if that wasn't the solution!
Still nog working Sad
And could you maybe explain what "string" you use on what situations? for now I'm just guessing a bit.. Blush

Map tester
CS creator (beginner)
Youtube:
http://www.youtube.com/pdkgaming
06-12-2012 05:18 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Science Offline
Junior Member

Posts: 9
Joined: Jun 2012
Reputation: 0
Post: #4
RE: Please help me :(
Correct me if I`m wrong, (I can`t search up the string for the timers in class), but are you sure if there`s supposed to be an extra variable there? StartPlayerLookAt("Compound_5", 1, 1, "Timer_1");

EDIT: Just searched it up, and the string for the timer is string& asName, float afTime, string& asFunction
In english: the name of the timer, the time the timer runs for and the function to call.

I'm smart enough to know that I'm dumb.
(This post was last modified: 06-12-2012 05:23 PM by Science.)
06-12-2012 05:18 PM
Find all posts by this user Quote this message in a reply
Adny Offline
Posting Freak

Posts: 1,757
Joined: Mar 2012
Reputation: 169
Post: #5
RE: Please help me :(
After the first timer, you're calling all other timers as (string &in asEntity) when it should be
(string &in asTimer)

Try this instead:


void LookTimer(string &in asParent, string &in asChild, int alState)
{
AddTimer("LookAtEntity_1", 0, "LookAt_1");
}

// makes sure the player looks at chest_of_drawers_nice_broken_1
void Timer_1(string &in asTimer)
{
StopPlayerLookAt();
AddTimer("LookAtEntity_2", 1, "LookAt_2");
}

// makes sure the player looks at painting03_1
void Timer_2(string &in asTimer)
{
StopPlayerLookAt();
AddTimer("LookAtEntity_3", 1, "LookAt_3");
}

//LookTimer
void LookAt_1(string &in asTimer)
{
StartPlayerLookAt("Compound_5", 1, 1, "Timer_1");
}

// Timer_1
void LookAt_2(string &in asTimer)
{
StartPlayerLookAt("chest_of_drawers_nice_broken_1", 1, 1, "Timer_2");
}

// Timer_2
void LookAt_3(string &in asTimer)
{
StartPlayerLookAt("painting03_1", 1, 1, "Timer_3");
}

(06-12-2012 05:18 PM)Science Wrote:  Correct me if I`m wrong, (I can`t search up the string for the timers in class), but are you sure if there`s supposed to be an extra variable there? StartPlayerLookAt("Compound_5", 1, 1, "Timer_1");
It threw me off at first, too. But that actually is correct:

StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);



Two simultaneous float values looks so strange for some reason.

Timorem and Friends are Hungry™
(This post was last modified: 06-12-2012 05:24 PM by Adny.)
06-12-2012 05:22 PM
Find all posts by this user Quote this message in a reply
pdkgaming Offline
Junior Member

Posts: 16
Joined: Jun 2012
Reputation: 0
Post: #6
RE: Please help me :(
Still doesn't work Sad and suddenly the monster doesn't spawn either... I thought I pretty much knew the basics of scripting but apparently not Sad

Map tester
CS creator (beginner)
Youtube:
http://www.youtube.com/pdkgaming
06-12-2012 05:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Datguy5 Offline
Senior Member

Posts: 622
Joined: Dec 2011
Reputation: 12
Post: #7
RE: Please help me :(
You seem to have Setenemy to hallucination in between the collidecallbacks.Try moving it?

06-12-2012 06:15 PM
Find all posts by this user Quote this message in a reply
pdkgaming Offline
Junior Member

Posts: 16
Joined: Jun 2012
Reputation: 0
Post: #8
RE: Please help me :(
(06-12-2012 06:15 PM)Datguy5 Wrote:  You seem to have Setenemy to hallucination in between the collidecallbacks.Try moving it?
It doesn't matter where you put the function right? as long as they trigger an event.. right? And even so.. where should I move it to?

Map tester
CS creator (beginner)
Youtube:
http://www.youtube.com/pdkgaming
06-12-2012 06:18 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Datguy5 Offline
Senior Member

Posts: 622
Joined: Dec 2011
Reputation: 12
Post: #9
RE: Please help me :(
(06-12-2012 06:18 PM)pdkgaming Wrote:  
(06-12-2012 06:15 PM)Datguy5 Wrote:  You seem to have Setenemy to hallucination in between the collidecallbacks.Try moving it?
It doesn't matter where you put the function right? as long as they trigger an event.. right? And even so.. where should I move it to?

You dont actually even need that.You can go to the level editor and click the enemy and then click the hallucination button in the other tab.

06-12-2012 06:19 PM
Find all posts by this user Quote this message in a reply
pdkgaming Offline
Junior Member

Posts: 16
Joined: Jun 2012
Reputation: 0
Post: #10
RE: Please help me :(
(06-12-2012 06:19 PM)Datguy5 Wrote:  
(06-12-2012 06:18 PM)pdkgaming Wrote:  
(06-12-2012 06:15 PM)Datguy5 Wrote:  You seem to have Setenemy to hallucination in between the collidecallbacks.Try moving it?
It doesn't matter where you put the function right? as long as they trigger an event.. right? And even so.. where should I move it to?

You dont actually even need that.You can go to the level editor and click the enemy and then click the hallucination button in the other tab.
Oh, lol.. I didn't know that xD Thanks! Smile

Map tester
CS creator (beginner)
Youtube:
http://www.youtube.com/pdkgaming
06-12-2012 06:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)