Sorry, this is the first time I've tried to use this, so I probably did something stupid-obvious wrong.
Spoilers for possible length issues
Spoiler below!
What should be happening: 1. The player goes through the dream 2. Answering machine ends dream 3. Player slowly opens eyes/blinks and rolls over 4. Player sits up (phone_2 starts around here) 5. Player stands up 6. Player takes a step forward 7. Player is set active so the person can control him (phone_3 starts a little while after) What's happening: The player goes through the 'dream' sequence all well and lovely, it fades out, lucid_phone_1 and lucid_phone_2 plays, screen still hasn't faded in. The last music, lucid_phone_3, gets stuck on look and the player is in a black-out coma. If left running for more than 15 minutes on the script, the game crashes.
I removed irrelevant parts of the script. If you think it would all be useful for answering the question, let me know so I can post all 221 lines (which could probably be condensed a lot, but I'm too lazy).
switch (GetLocalVarInt("var_wakeup")) { case 1: //Teleporting player and setting up sequence TeleportPlayer("PlayerStartArea_2"); //Moves player from castle to bed SetPlayerCrouching(true); //places the player on the bed sheeds AddEntityCollideCallback("Player", "area_standup", "script_standup", true, 1); //makes player stand up MovePlayerHeadPos(0.8f, -0.8f, 0.0f, 20.0f, 1.0f); //player's head is on the bed FadePlayerRollTo(-90.0f, 150.0f, 200.0f); //player is looking at ceiling
SectionSpeed = 4.0f; break;
case 2: //I don't remember why I needed this since the same thing is in the last case, but I'm leaving it in to be safe FadePlayerRollTo(-90.0f, 1.0f, 1.0f);
SectionSpeed = 0.5f; break;
case 3: //fade in, blurry eyes FadeIn(1.3f); StartScreenShake(0.02f ,0.0f, 0.3f, 1.0f); FadeRadialBlurTo(0.03f, 1.5f); FadePlayerFOVMulTo(1.3f, 1.7f);
SectionSpeed = 1.5f; break;
case 4: //fade out again FadeOut(2.3f); FadeRadialBlurTo(0.01f, 0.01f);
SectionSpeed = 2.75f; break;
case 5: //fade in, still blurry FadeIn(2.5f); FadeRadialBlurTo(0.03f, 0.02f); FadePlayerFOVMulTo(0.75f, 0.2f);
SectionSpeed = 2.75f; break;
case 6: //blinking - kind of FadeOut(2.0f); FadeRadialBlurTo(0.01f, 0.01f);
SectionSpeed = 2.5f; break;
case 7: //opening eyes, a little blurry still FadeIn(2.0f); FadeRadialBlurTo(0.03f, 0.03f);
SectionSpeed = 2.5f; break;
case 8: //Roll over and sit FadePlayerFOVMulTo(1.0f, 3.4f); MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 0.4f, 0.1f); FadePlayerRollTo(0, 5.0f, 23.0f); StartPlayerLookAt("area_look1", 2.0f, 4.0f, ""); //Floor FadeRadialBlurTo(0.01f, 0.01f);
My apologies if the inconsistencies in my scripting are confusing. They're caused by the change in experience; this was the second map I scripted and I just came back to it after writing 4 other map scripts and starting ENGG 233 (Computing for Engineers - it's a computer software course based around C++).
I'm sorry if this question's been answered a million times, I tried searching "case break" on the forum to double-check, but I couldn't find anything that might be similar to my problem (usually, I have to actually do something to understand it :p).
Thanks for the help - in case I forget to thank you personally for some reason.
(This post was last modified: 09-25-2013, 07:58 AM by CarnivorousJelly.)
Inside your function timer_wakeup you have a name of a variable wrong:
The counter++ AddLocalVarInt("var_wakup", 1);
And the check at the bottom if (GetLocalVarInt("var_wakeup") <9)
Since var_wakeup it's gonna return 0, the timer is gonna get called every time.
Additionally, since the switch function above failed to find any match after case 9, the variable SectionSpeed remains with 0.0f, as it was initially declared, creating an infinite timer.
And when your computer can't handle it, it crashes.
(09-25-2013, 08:40 AM)JustAnotherPlayer Wrote: I don't see you even calling StartPlayerLookAt yet you're using StopPlayerLookAt.
"StartPlayerLookAt("area_entitylook", 1.0f, 2.0f, "");" (L5)
" StartPlayerLookAt("area_look1", 2.0f, 4.0f, ""); //Floor" (L5 of Case 8)
There's at least two places I used StartPlayerLookAt... but that's not the point, so I'm going to move on.
(09-25-2013, 08:40 AM)JustAnotherPlayer Wrote: Also, the reason why it's not working, you have to match the same number var with the case number.
Care to elaborate on what you mean? Like I said: first time using case/break and I barely know what I'm doing.
(09-25-2013, 12:00 PM)Amn Wrote: Inside your function timer_wakeup you have a name of a variable wrong:
The counter++ AddLocalVarInt("var_wakup", 1);
And the check at the bottom if (GetLocalVarInt("var_wakeup") <9)
Since var_wakeup it's gonna return 0, the timer is gonna get called every time.
Additionally, since the switch function above failed to find any match after case 9, the variable SectionSpeed remains with 0.0f, as it was initially declared, creating an infinite timer.
And when your computer can't handle it, it crashes.
Ohhhhhh I didn't notice the typo D: Well, that's embarrassing c: Thank you!