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


Thread Rating:
  • 6 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script causing game to randomly crash (No FATAL ERROR)
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#71
RE: extra_english now is working, but I need help with a different script :)

I'm blind.

Spoiler below!

void OnStart()
{
AddUseItemCallback("", "key_torture_chamber_1", "prison_section_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Player", "script_area_2", "ActivateMonster", true);
AddEntityCollideCallback("servant_grunt_1", "monstergone_area", "MonsterGone", true, 1);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.0f, "");
}


void wakeUp()
{
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(20); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddTimer("trig1", 5.9f, "beginStory"); // Change '5.9f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_section_1", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_section_1", 0, false);
RemoveItem("key_torture_chamber_1");
}

void ActivateMonster(string &in asItem, string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
}

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


You had quotes around the false at FadeEnemy, and quotes around a float at the path nodes. If the value is false/true or a number, you almost never need a quotation mark (unless your item is named 1 or true, of course)
05-23-2011, 08:32 PM
Find
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
#72
RE: extra_english now is working, but I need help with a different script :)

(05-23-2011, 08:32 PM)Roenlond Wrote: I'm blind.

Spoiler below!

void OnStart()
{
AddUseItemCallback("", "key_torture_chamber_1", "prison_section_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Player", "script_area_2", "ActivateMonster", true);
AddEntityCollideCallback("servant_grunt_1", "monstergone_area", "MonsterGone", true, 1);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.0f, "");
}


void wakeUp()
{
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(20); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddTimer("trig1", 5.9f, "beginStory"); // Change '5.9f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_section_1", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_section_1", 0, false);
RemoveItem("key_torture_chamber_1");
}

void ActivateMonster(string &in asItem, string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
}

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


You had quotes around the false at FadeEnemy, and quotes around a float at the path nodes. If the value is false/true or a number, you almost never need a quotation mark (unless your item is named 1 or true, of course)

Okay I can run the map now, but I need to know where I put void DisableEnemyTriggers("servant_grunt_1" true);
And they Wake Up function doesn't work. No more errors for the moment Smile

EDIT: I edited the Cells5.hps and added wakeUp(); to the OnStart() section, not sure if it fixed the Wake Up, will try in the morning.

I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
(This post was last modified: 05-24-2011, 04:07 AM by RawkBandMan.)
05-24-2011, 03:39 AM
Find
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
#73
RE: extra_english now is working, but I need help with a different script :)

I added a different Wake Up Function, cuz the one I had isn't what I wanted. But after I put the new one in, it gives me this error

main(157,1): ERR : Unexpected End of File

hps
Spoiler below!

void OnStart()
{
AddUseItemCallback("", "key_torture_chamber_1", "prison_section_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Player", "script_area_2", "ActivateMonster", true);
AddEntityCollideCallback("servant_grunt_1", "monstergone_area", "MonsterGone", true, 1);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.5f, "");
AddTimer("BlackOut", 0.0f, "TimerBlackOut");
}


void TimerBlackOut(string &in asTimer)
{
AddLocalVarInt("BlackoutStep", 1); //What step to play in the event
float fEventSpeed = 0.5f; //The default time between steps in an event

switch(GetLocalVarInt("BlackoutStep")) {
case 1:
StartPlayerLookAt("servant_grunt_1", 0.1f, 0.1f, "");
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.5f, "");
FadeIn(4);
FadeImageTrailTo(2,1);
SetPlayerMoveSpeedMul(0.05f);
SetPlayerLookSpeedMul(0.05f);
PlaySoundAtEntity("pant", "react_pant.snt", "Player", 2, false);
fEventSpeed = 3.0f;
break;
case 2:
FadePlayerRollTo(85, 1, 1);
break;
case 3:
SetPlayerActive(true);
StartPlayerLookAt("blood_splatter04_3", 0.1f, 0.1f, "");
break;
case 4:
FadeImageTrailTo(0,1);
FadePlayerRollTo(65, 1, 1);
break;
case 5:
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 2, false);
FadeOut(2);
fEventSpeed = 1.5f;
break;
case 6:
FadePlayerRollTo(85, 1, 4);
StartPlayerLookAt("key_torture_chamber_1", 0.1f, 0.1f, "");
break;
case 7:
FadeImageTrailTo(1.8f,1.5f);
FadePlayerFOVMulTo(1.25f, 0.01);
break;
case 8:
FadePlayerRollTo(45, 1, 2);
FadeIn(2);
fEventSpeed = 1.5f;
break;
case 9:
StartPlayerLookAt("wood_box2_1", 0.1f, 0.1f, "");
break;
case 10:
FadePlayerRollTo(15, 1, 2);
FadePlayerFOVMulTo(0.75f, 0.01);
break;
case 11:
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1.5f, false);
FadeOut(1);
StartPlayerLookAt("blood_splatter02_1", 1, 1, "");
FadePlayerRollTo(50, 1, 2);
fEventSpeed = 2.0f;
break;
case 12:
SetPlayerMoveSpeedMul(0.1f);
SetPlayerLookSpeedMul(0.1f);
StartPlayerLookAt("blood_splatter02_1", 1, 1, "");
FadePlayerFOVMulTo(1.1f, 0.01);
FadeImageTrailTo(0,1.5f);
fEventSpeed = 1.5f;
break;
case 13:
SetPlayerMoveSpeedMul(0.2f);
SetPlayerLookSpeedMul(0.2f);
FadePlayerRollTo(-15, 1, 2);
FadeIn(1);
StartPlayerLookAt("blood_splatter02_1", 2, 2, "");
fEventSpeed = 2.0f;
break;
case 14:
SetPlayerMoveSpeedMul(0.3f);
SetPlayerLookSpeedMul(0.3f);
FadePlayerRollTo(-30, 10, 60);
MovePlayerHeadPos(0, 0, 0, 1, 0.5f);
StartPlayerLookAt("prison_section_1", 1, 1, "");
FadePlayerFOVMulTo(0.9f, 0.01);
FadeImageTrailTo(1.5,2);
PlaySoundAtEntity("movement", "player_climb.snt", "Player", 0, false);
break;
case 15:
SetPlayerMoveSpeedMul(0.4f);
SetPlayerLookSpeedMul(0.4f);
FadePlayerRollTo(10, 10, 20);
MovePlayerHeadPos(0, -0.5f, 0, 1, 0.5f);
break;
case 16:
SetPlayerMoveSpeedMul(0.5f);
SetPlayerLookSpeedMul(0.5f);
FadePlayerRollTo(0, 10, 60);
MovePlayerHeadPos(0, 0, 0, 1, 0.5f);
StartPlayerLookAt("prison_section_1", 2, 2, "");
FadePlayerFOVMulTo(1, 0.01f);
PlaySoundAtEntity("movement", "player_climb.snt", "Player", 0, false);
SetPlayerCrouchDisabled(false);
fEventSpeed = 1.0f;
break;
case 17:
SetPlayerMoveSpeedMul(0.6f);
SetPlayerLookSpeedMul(0.6f);
FadeImageTrailTo(0,0.2f);
StopPlayerLookAt();
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1, false);
fEventSpeed = 1.0f;
break;
case 18:
SetPlayerJumpDisabled(false);
SetPlayerMoveSpeedMul(1.0f);
SetPlayerRunSpeedMul(1.0f);
SetPlayerLookSpeedMul(1.0f);
break;
}
RemoveTimer("BlackOut");

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_section_1", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_section_1", 0, false);
RemoveItem("key_torture_chamber_1");
}

void ActivateMonster(string &in asItem, string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
}

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


I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
(This post was last modified: 05-25-2011, 03:56 PM by RawkBandMan.)
05-24-2011, 01:51 PM
Find
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
#74
RE: extra_english now is working, but I need help with a different script :)

Bump. Read the post above to help me Big Grin

I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
05-25-2011, 03:57 PM
Find
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
#75
RE: extra_english now is working, but I need help with a different script :)

Bump Bump Bump Bump!!!!

I added a different Wake Up Function, cuz the one I had isn't what I wanted. But after I put the new one in, it gives me this error

main(157,1): ERR : Unexpected End of File

hps
Spoiler below!

void OnStart()
{
AddUseItemCallback("", "key_torture_chamber_1", "prison_section_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Player", "script_area_2", "ActivateMonster", true);
AddEntityCollideCallback("servant_grunt_1", "monstergone_area", "MonsterGone", true, 1);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.5f, "");
AddTimer("BlackOut", 0.0f, "TimerBlackOut");
}


void TimerBlackOut(string &in asTimer)
{
AddLocalVarInt("BlackoutStep", 1); //What step to play in the event
float fEventSpeed = 0.5f; //The default time between steps in an event

switch(GetLocalVarInt("BlackoutStep")) {
case 1:
StartPlayerLookAt("servant_grunt_1", 0.1f, 0.1f, "");
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.5f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.5f, "");
FadeIn(4);
FadeImageTrailTo(2,1);
SetPlayerMoveSpeedMul(0.05f);
SetPlayerLookSpeedMul(0.05f);
PlaySoundAtEntity("pant", "react_pant.snt", "Player", 2, false);
fEventSpeed = 3.0f;
break;
case 2:
FadePlayerRollTo(85, 1, 1);
break;
case 3:
SetPlayerActive(true);
StartPlayerLookAt("blood_splatter04_3", 0.1f, 0.1f, "");
break;
case 4:
FadeImageTrailTo(0,1);
FadePlayerRollTo(65, 1, 1);
break;
case 5:
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 2, false);
FadeOut(2);
fEventSpeed = 1.5f;
break;
case 6:
FadePlayerRollTo(85, 1, 4);
StartPlayerLookAt("key_torture_chamber_1", 0.1f, 0.1f, "");
break;
case 7:
FadeImageTrailTo(1.8f,1.5f);
FadePlayerFOVMulTo(1.25f, 0.01);
break;
case 8:
FadePlayerRollTo(45, 1, 2);
FadeIn(2);
fEventSpeed = 1.5f;
break;
case 9:
StartPlayerLookAt("wood_box2_1", 0.1f, 0.1f, "");
break;
case 10:
FadePlayerRollTo(15, 1, 2);
FadePlayerFOVMulTo(0.75f, 0.01);
break;
case 11:
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1.5f, false);
FadeOut(1);
StartPlayerLookAt("blood_splatter02_1", 1, 1, "");
FadePlayerRollTo(50, 1, 2);
fEventSpeed = 2.0f;
break;
case 12:
SetPlayerMoveSpeedMul(0.1f);
SetPlayerLookSpeedMul(0.1f);
StartPlayerLookAt("blood_splatter02_1", 1, 1, "");
FadePlayerFOVMulTo(1.1f, 0.01);
FadeImageTrailTo(0,1.5f);
fEventSpeed = 1.5f;
break;
case 13:
SetPlayerMoveSpeedMul(0.2f);
SetPlayerLookSpeedMul(0.2f);
FadePlayerRollTo(-15, 1, 2);
FadeIn(1);
StartPlayerLookAt("blood_splatter02_1", 2, 2, "");
fEventSpeed = 2.0f;
break;
case 14:
SetPlayerMoveSpeedMul(0.3f);
SetPlayerLookSpeedMul(0.3f);
FadePlayerRollTo(-30, 10, 60);
MovePlayerHeadPos(0, 0, 0, 1, 0.5f);
StartPlayerLookAt("prison_section_1", 1, 1, "");
FadePlayerFOVMulTo(0.9f, 0.01);
FadeImageTrailTo(1.5,2);
PlaySoundAtEntity("movement", "player_climb.snt", "Player", 0, false);
break;
case 15:
SetPlayerMoveSpeedMul(0.4f);
SetPlayerLookSpeedMul(0.4f);
FadePlayerRollTo(10, 10, 20);
MovePlayerHeadPos(0, -0.5f, 0, 1, 0.5f);
break;
case 16:
SetPlayerMoveSpeedMul(0.5f);
SetPlayerLookSpeedMul(0.5f);
FadePlayerRollTo(0, 10, 60);
MovePlayerHeadPos(0, 0, 0, 1, 0.5f);
StartPlayerLookAt("prison_section_1", 2, 2, "");
FadePlayerFOVMulTo(1, 0.01f);
PlaySoundAtEntity("movement", "player_climb.snt", "Player", 0, false);
SetPlayerCrouchDisabled(false);
fEventSpeed = 1.0f;
break;
case 17:
SetPlayerMoveSpeedMul(0.6f);
SetPlayerLookSpeedMul(0.6f);
FadeImageTrailTo(0,0.2f);
StopPlayerLookAt();
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1, false);
fEventSpeed = 1.0f;
break;
case 18:
SetPlayerJumpDisabled(false);
SetPlayerMoveSpeedMul(1.0f);
SetPlayerRunSpeedMul(1.0f);
SetPlayerLookSpeedMul(1.0f);
break;
}
RemoveTimer("BlackOut");

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_section_1", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_section_1", 0, false);
RemoveItem("key_torture_chamber_1");
}

void ActivateMonster(string &in asItem, string &in asEntity)
{
SetEntityActive("servant_grunt_2", true);
}

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


I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
05-26-2011, 06:09 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#76
RE: extra_english now is working, but I need help with a different script :)

RemoveTimer("BlackOut");
that is outside any function

Also yout case/break thingie wont work... there is nothing triggering the timer after the first one
I created this simple switch timer thingie for everyone to use. If someone has questions about how it really works, ask me!
//SIMPLE SWITCH TIMER THINGIE//
//FIRST SOMETHING TO START IT (timer in some function you want it to start from)
        AddTimer("", 0.0f, "ThisIsTheTimer");
void ThisIsTheTimer(string &in asTimer)
{    AddLocalVarInt("Stage", 1);
    float fEventSpeed = 1.0f;
    switch(GetLocalVarInt("Stage"))
        {case 1:
            //Whatever you wantto happen goes in between case and break
            break;
        case 2:
            //TYPICAL WAKE UP/BLACK OUT FUNCTONS:
            //MovePlayerHeadPos(float afX, float afY, float afZ, float afSpeed, float afSlowDownDist); If I remember right, float afY at 1.0f is the normal head position
            //FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);     float afX is normal when its 0.0f
            //SetPlayerCrouchDisabled(bool abX);
            //SetPlayerJumpDisabled(bool abX);  These are so that the player cant jump or crouch underground while passing out...
            //SetPlayerRunSpeedMul(float afMul);
            //SetPlayerMoveSpeedMul(float afMul); These so that the player cant run when down on the ground...
            //FadeOut(float afTime); //self explanatory...
            break;
        }
    if(GetLocalVarInt("Stage") < 6)   AddTimer("ThisRepeatsTheTimer", fEventSpeed, "ThisIsTheTimer");
}
(This post was last modified: 05-26-2011, 06:36 PM by Khyrpa.)
05-26-2011, 06:16 PM
Find
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
#77
RE: extra_english now is working, but I need help with a different script :)

(05-26-2011, 06:16 PM)Khyrpa Wrote: RemoveTimer("BlackOut");
that is outside any function

Also yout case/break thingie wont work... there is nothing triggering the timer after the first one
I created this simple switch timer thingie for everyone to use. If someone has questions about how it really works, ask me!
//SIMPLE SWITCH TIMER THINGIE//
//FIRST SOMETHING TO START IT (timer in some function you want it to start from)
        AddTimer("", 0.0f, "ThisIsTheTimer");
void ThisIsTheTimer(string &in asTimer)
{    AddLocalVarInt("Stage", 1);
    float fEventSpeed = 1.0f;
    switch(GetLocalVarInt("Stage"))
        {case 1:
            //Whatever you wantto happen goes in between case and break
            break;
        case 2:
            //TYPICAL WAKE UP/BLACK OUT FUNCTONS:
            //MovePlayerHeadPos(float afX, float afY, float afZ, float afSpeed, float afSlowDownDist); If I remember right, float afY at 1.0f is the normal head position
            //FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);     float afX is normal when its 0.0f
            //SetPlayerCrouchDisabled(bool abX);
            //SetPlayerJumpDisabled(bool abX);  These are so that the player cant jump or crouch underground while passing out...
            //SetPlayerRunSpeedMul(float afMul);
            //SetPlayerMoveSpeedMul(float afMul); These so that the player cant run when down on the ground...
            //FadeOut(float afTime); //self explanatory...
            break;
        }
    if(GetLocalVarInt("Stage") < 6)   AddTimer("ThisRepeatsTheTimer", fEventSpeed, "ThisIsTheTimer");
}

I'd have to ask yo how it actually works, and what I could put in each thing....

I copied it from the 25_nave_tunnels.map from Main or whatever the map is called and I thought it would basically work without much editing.

I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
05-27-2011, 07:25 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#78
RE: extra_english now is working, but I need help with a different script :)

(05-27-2011, 07:25 PM)XxRoCkBaNdMaNxX Wrote: I'd have to ask yo how it actually works, and what I could put in each thing....

I copied it from the 25_nave_tunnels.map from Main or whatever the map is called and I thought it would basically work without much editing.

Allright I try to make this as simple as possible, for I too had serious problems figuring this out.
This is a more simplified version of the code:
void TimerItself(string &in asTimer)
{    AddTimer("SPAM", 2.0f, "TimerItself"); // 1.
    AddLocalVarInt("Stage", 1); // 2.
    switch(GetLocalVarInt("Stage")) //3.
        {case 1:
            FadeOut(1.0f);
            break;
        case 2:                //
            FadeIn(1.0f);    //4.
            break;            //
        case 3:
            FadeOut(1.0f);
            break;
        }
}
I marked each particular part of the code in numbers so I can explain them here:

1. The timer inside the timer does exactly what you'd think it does. Every 2 seconds the "TimerItself" is called.

2. This makes sure the actions progress, meaning that when this first comes the "Stage" variable will become 1. And every time the "TimerItself" function is called, this adds +1 into the variable.

3. I don't know the specifics about this thing, but it checks how big the variable is (in this case its "Stage") and picks the case with the same number.

4. In between the case and break, you can put functions you want to use. And in this case the next case comes every 2 seconds



Here I'm going to complicate it a little bit so it can be utilized better. This is how it will look (color coding for easier explanation and I suggest you copy pasting this into notepad ++ and setting the Language to C++):

void TimerItself(string &in asTimer)
{float fEventSpeed = 2.0f;
AddLocalVarInt("Stage", 1);
switch(GetLocalVarInt("Stage"))
{case 1:
FadeOut(1.0f);
break;
case 2:
FadeIn(1.0f);
fEventSpeed = 5.0f;
break;
case 3:
FadeOut(1.0f);
break;
}
if(GetLocalVarInt("Stage") < 4) AddTimer("SPAM", fEventSpeed, "TimerItself");
}

So the function above does exactly the same as the simpler one except that the second FadeOut(1.0f); comes 3 seconds later.

if(GetLocalVarInt("Stage") < 4) AddTimer("SPAM", fEventSpeed, "TimerItself"); has to be placed in the end of the function so that the first float fEventSpeed = 2.0f; is before fEventSpeed = 5.0f; so that the second event speed effects the if(getblehblah litany.
Because the fEventSpeed = 5.0f; is in case 2:, case 4 would trigger 2 seconds after case 3 (the function ingnores all other cases than the one that fits to the "Stage" variable).

if(GetLocalVarInt("Stage") < 4) simply means that you can decide when the timer stops looping itself (when cases end, without this part the timer would stay and loop without anything happening. That could possibly slow the game down or something).
the < 4 part means that "TimerItself" is called 4 times then stop ("Stage" variable would be 4).

Checking the color coding and with a little logic this should be possible to understand. If anyone has any more questions, I could try and explain... again Smile
(This post was last modified: 05-27-2011, 09:19 PM by Khyrpa.)
05-27-2011, 08:53 PM
Find
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
#79
RE: extra_english now is working, but I need help with a different script :)

(05-27-2011, 08:53 PM)Khyrpa Wrote:
(05-27-2011, 07:25 PM)XxRoCkBaNdMaNxX Wrote: I'd have to ask yo how it actually works, and what I could put in each thing....

I copied it from the 25_nave_tunnels.map from Main or whatever the map is called and I thought it would basically work without much editing.

Allright I try to make this as simple as possible, for I too had serious problems figuring this out.
This is a more simplified version of the code:
void TimerItself(string &in asTimer)
{    AddTimer("SPAM", 2.0f, "TimerItself"); // 1.
    AddLocalVarInt("Stage", 1); // 2.
    switch(GetLocalVarInt("Stage")) //3.
        {case 1:
            FadeOut(1.0f);
            break;
        case 2:                //
            FadeIn(1.0f);    //4.
            break;            //
        case 3:
            FadeOut(1.0f);
            break;
        }
}
I marked each particular part of the code in numbers so I can explain them here:

1. The timer inside the timer does exactly what you'd think it does. Every 2 seconds the "TimerItself" is called.

2. This makes sure the actions progress, meaning that when this first comes the "Stage" variable will become 1. And every time the "TimerItself" function is called, this adds +1 into the variable.

3. I don't know the specifics about this thing, but it checks how big the variable is (in this case its "Stage") and picks the case with the same number.

4. In between the case and break, you can put functions you want to use. And in this case the next case comes every 2 seconds



Here I'm going to complicate it a little bit so it can be utilized better. This is how it will look (color coding for easier explanation and I suggest you copy pasting this into notepad ++ and setting the Language to C++):

void TimerItself(string &in asTimer)
{float fEventSpeed = 2.0f;
AddLocalVarInt("Stage", 1);
switch(GetLocalVarInt("Stage"))
{case 1:
FadeOut(1.0f);
break;
case 2:
FadeIn(1.0f);
fEventSpeed = 5.0f;
break;
case 3:
FadeOut(1.0f);
break;
}
if(GetLocalVarInt("Stage") < 4) AddTimer("SPAM", fEventSpeed, "TimerItself");
}

So the function above does exactly the same as the simpler one except that the second FadeOut(1.0f); comes 3 seconds later.

if(GetLocalVarInt("Stage") < 4) AddTimer("SPAM", fEventSpeed, "TimerItself"); has to be placed in the end of the function so that the first float fEventSpeed = 2.0f; is before fEventSpeed = 5.0f; so that the second event speed effects the if(getblehblah litany.
Because the fEventSpeed = 5.0f; is in case 2:, case 4 would trigger 2 seconds after case 3 (the function ingnores all other cases than the one that fits to the "Stage" variable).

if(GetLocalVarInt("Stage") < 4) simply means that you can decide when the timer stops looping itself (when cases end, without this part the timer would stay and loop without anything happening. That could possibly slow the game down or something).
the < 4 part means that "TimerItself" is called 4 times then stop ("Stage" variable would be 4).

Checking the color coding and with a little logic this should be possible to understand. If anyone has any more questions, I could try and explain... again Smile

I have just one more question.

What would the function to make Daniel roll to look like he is laying, then to get back up? (I think its like FadePlayerRollTo(X Axis,Y axis, Z axis) or something). But what would be the Numbers for the X, Y, and Z axis?? (For the laying on the ground like sleeping, and the default.)

I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
05-27-2011, 10:59 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#80
RE: extra_english now is working, but I need help with a different script :)

(05-27-2011, 10:59 PM)XxRoCkBaNdMaNxX Wrote: What would the function to make Daniel roll to look like he is laying, then to get back up? (I think its like FadePlayerRollTo(X Axis,Y axis, Z axis) or something). But what would be the Numbers for the X, Y, and Z axis?? (For the laying on the ground like sleeping, and the default.)
Well you would just have to tweak and test and tweak these:
MovePlayerHeadPos(float afX, float afY, float afZ, float afSpeed, float afSlowDownDist);
if you want your head close to the ground change float afY to -1 or something.

then there is this what youre mainly after I guess:
FadePlayerRollTo(float afX, float afSpeedMul, float afMaxSpeed);
change float afX to -45 or 45 and your view is turned 45 degrees
05-27-2011, 11:22 PM
Find




Users browsing this thread: 3 Guest(s)