The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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 [Solved, sort of] Grunt Not Disappearing
MsHannerBananer Offline
Member

Posts: 218
Threads: 34
Joined: Sep 2013
Reputation: 10
#1
[Solved, sort of] Grunt Not Disappearing

I have a script set up where the player sees a grunt, or as she describes it, "creature" from down a hall. The thing is scripted to appear, cross through a doorway, and then hits a script box that deactivates it. I felt it was better than making the grunt a hallucination, because you can here the poofing sound and see the dust. I wanted to make it a clean magic trick and have the grunt just plain ol' disappear.

Script is below. My names match and everything, but I feel like I'm missing something. I recently put in some hammer+chipper script, so I don't know if something's messing with it or what. I just need a second, third, and fourth set of eyes to make sure I haven't done anything wrong.

NOTE: The script WORKED ONCE. The FIRST time I tested and before I put in any hammer+chipper stuff, the script actually worked.

PHP Code: (Select All)
int Swings = 0;

void OnStart()
{
    
AddEntityCollideCallback("Player", "seeShadow", "See_Grunt",true, 1);
    
AddEntityCollideCallback("silent_grunt", "silent_grunt_gone", "Disable_Grunt",true, 1);
    
AddEntityCollideCallback("Player", "MapChange", "ChangeMap", false, 1);
    
AddUseItemCallback("", "stone_hammer_chipper", "breakstone_1", "Break_Rock", true);
}

void OnEnter()
{

}

void OnLeave()
{

}


//GRUNT//

void See_Grunt(string &in asParent, string &in asChild, int alState)
{
    
SetPlayerActive(false);
    
StartPlayerLookAt("silent_grunt", 2.0f, 4.0f, "See_Grunt_Walk");
}

void See_Grunt_Walk()
{
    
SetEntityActive("silent_grunt", true);
    
AddTimer("endwalkTimer", 8.0f, "End_Walk_Timer");
    
SetEnemyDisableTriggers("silent_grunt", true);
    
AddEnemyPatrolNode("silent_grunt", "silent_path_3", 0.1f, "");
    
AddEnemyPatrolNode("silent_grunt", "silent_path_5", 0.1f, "");
    
AddEnemyPatrolNode("silent_grunt", "silent_path_7", 0.1f, "");
    
AddEnemyPatrolNode("silent_grunt", "silent_path_8", 0.1f, "");
}

void Disable_Grunt(string &in asParent, string &in asChild, int alState)
{
    
SetEntityActive("silent_grunt", false);
}

void End_Walk_Timer(string &in asTimer)
{
    
SetPlayerActive(true);
    
StopPlayerLookAt();
}

//CHANGE MAP//

void ChangeMap(string &in asParent, string &in asChild, int alState)
{
ChangeMap("014_wateroffice.map", "PlayerStartArea_1", "", "");
}


//HAMMER CHIPPER//

void Break_Rock(string &in asItem, string &in asEntity)
{
    
Swings = 1;
    
SetEntityActive("move_hammer", true);
    
SetEntityActive("rock_chipper", true);
    
StartPlayerLookAt("move_hammer", 2, 2, "");
    
AddTimer("hammermove", 0.1, "MoveHammerTimer");
    
AddTimer("hammersound", 0.27, "MoveHammerTimer");
    
AddTimer("hammerreset", 0.4, "MoveHammerTimer");
    
AddTimer("hammerrepeat", 0.6, "MoveHammerTimer");
}

void MoveHammerTimer(string &in asTimer)
{
    if(
asTimer == "hammermove") SetMoveObjectState("move_hammer", 0.4);
    
    else if(
asTimer == "hammersound")
        {
            
StopPlayerLookAt();
            
PlaySoundAtEntity("", "impact_rock_high", "breakstone_1", 0, false);
            
PlaySoundAtEntity("", "15_hammer", "Player", 0, false);
        }
        
    else if(
asTimer =="hammerreset") SetMoveObjectState("move_hammer", 0);
    
    if(
Swings < 3 && asTimer =="hammerrepeat")
        {
            
AddTimer("hammermove", 0.01, "MoveHammerTimer");
            
AddTimer("hammersound", 0.17, "MoveHammerTimer");
            
AddTimer("hammerreset", 0.3, "MoveHammerTimer");
            
AddTimer("hammerrepeat", 0.5, "MoveHammerTimer");
            
Swings = Swings + 1;
        }
        
    else if(
Swings == 3 && asTimer =="hammerrepeat")
        {
            
AddTimer("hammermove", 0.2, "MoveHammerTimer");
            
AddTimer("hammersound", 0.37, "MoveHammerTimer");
            
AddTimer("hammerreset", 0.5, "MoveHammerTimer");
            
AddTimer("hammerrepeat", 0.8, "MoveHammerTimer");
            
AddTimer("Break", 0.42, "MoveHammerTimer");
            
Swings = Swings + 1;
        }
        
    else if(
Swings == 4 && asTimer =="Break")
        {
            
Break_Rocks_Complete();
            
SetEntityActive("move_hammer", false);
            
SetEntityActive("rock_chipper", false);
        }
}

void Break_Rocks_Complete()
{
    
SetEntityActive("breakstone_1", false);
    
SetEntityActive("breakstone_2", false);
    
SetEntityActive("med_rock_1", true);
    
SetEntityActive("med_rock_2", true);
    
SetEntityActive("med_rock_3", true);
    
SetEntityActive("large_rock_1", true);
    
SetEntityActive("large_rock_2", true);
    
SetEntityActive("large_rock_3", true);
    
SetEntityActive("small_rock_1", true);
    
SetEntityActive("small_rock_2", true);
    
SetEntityActive("small_rock_3", true);
    
SetEntityActive("small_rock_4", true);
    
SetEntityActive("small_rock_5", true);
    
SetEntityActive("small_rock_6", true);
    
SetEntityActive("small_rock_7", true);
    
SetEntityActive("small_rock_8", true);
    
SetEntityActive("small_rock_9", true);
    
SetEntityActive("small_rock_10", true);
    
CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "breakrock_dust", false);
    
PlaySoundAtEntity("", "25_break_rock", "Player", 0, false);
} 

(This post was last modified: 06-19-2014, 03:16 AM by MsHannerBananer.)
06-19-2014, 02:44 AM
Find


Messages In This Thread
[Solved, sort of] Grunt Not Disappearing - by MsHannerBananer - 06-19-2014, 02:44 AM
RE: Grunt Not Disappearing - by Mudbill - 06-19-2014, 02:51 AM
RE: Grunt Not Disappearing - by MsHannerBananer - 06-19-2014, 03:15 AM



Users browsing this thread: 1 Guest(s)