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 Randomly Bugged
DaAinGame Offline
Member

Posts: 90
Threads: 11
Joined: Mar 2012
Reputation: 4
#1
Script Randomly Bugged

I was putting the final touches on Chapter 1 of my custom story, so I saved all the changes made to my maps and went through a test run. Perfect no errors. Decided to run through it again and BAM! My script bugs on a level. I thought it all together just stopped working, but here's where it gets odd. I'll use Red text to mark where things start to go wrong.

void OnStart()
{
AddUseItemCallback("", "key_5", "level_3", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("oil1", "Sound", true);
SetEntityPlayerInteractCallback("key_5", "Scare1", true);
AddUseItemCallback("", "ceremony_knife_1", "web_1", "Collapse", true);
AddUseItemCallback("", "hand_drill_1", "level_wood_1", "UnlockDoor", true);
AddUseItemCallback("", "NorthWing_key", "level_wood_2", "UnlockDoor1", true);
}
My only idea is that something is put in wrongly in the OnStart. Maybe some should be moved to OnEnter since some of the items are retrieved from another map?

void UnlockDoor1(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level_wood_2", false);
PlaySoundAtEntity("", "unlock_door.snt", "level_wood_2", 0, false);
GiveSanityBoost();
RemoveItem("NorthWing_key");
}<--- This is the last thing I added the the script. I already tried removing it and seing what would happen. Problem persisted.
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level_wood_1", false);
PlaySoundAtEntity("", "unlock_door.snt", "level_wood_1", 0, false);
GiveSanityBoost();
}

void Collapse(string &in asItem, string &in asEntity)
{
AddPlayerBodyForce(0, 0, -30000, false);
FadeOut(.5);
FadePlayerRollTo(50, 220, 220);
SetPlayerCrouching(true);
SetPlayerActive(false);
AddTimer("", 5, "GetUp");
PlaySoundAtEntity("", "explosion_rock_large", "web_1", 0, false);
SetLanternActive(false, false);
}

void GetUp(string &in asTimer)
{
SetEntityActive("cave_in_1", true);
SetEntityActive("cave_in_2", true);
SetEntityActive("cave_in_3", true);
SetEntityActive("cave_in_4", true);
SetEntityActive("web_1", false);
FadeIn(7);
AddTimer("", 7.5, "StandUp");
RemoveItem("lantern_1");
}

void StandUp(string &in asTimer)
{
FadePlayerRollTo(0, 33, 33);
SetPlayerCrouching(false);
SetMessage("Broke", "Lantern", 3);
SetPlayerActive(true);
}



Anything above this is untested, as I could not progress into my custom story to test it when it happens


void Sound(string &in item)
{
SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("armour_nice_complete_2", true);
SetEntityActive("armour_nice_complete_3", true);
SetEntityActive("armour_nice_complete_4", true);
SetEntityActive("armour_nice_complete_5", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_7", false);
SetEntityActive("armour_nice_complete_8", false);
SetEntityActive("armour_nice_complete_9", false); <---- These entities being set to inactive does not
occur, which was later added into the script. Supports my idea of it
using an older script even more?

PlayMusic("11_event_dog", false, 2, 0, 0, false); <---- This Music does not play, but the rest of the script works
AddEntityCollideCallback("Player", "ScriptArea_1", "StatueScare", true, 1); <--- This also does not activate
}

void StatueScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("armour_nice_complete_10", true); Since StatueScare doesn't even activate, this part of the script never happens
StartPlayerLookAt("armour_nice_complete_10", 2, 2, "");
SetPlayerActive(false);
AddTimer("", 2, "React");
}
void React(string &in asTimer)
{
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(15, true);
SetPlayerActive(true);
StopPlayerLookAt();
}

void Scare1(string &in item)
{
SetEntityActive("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
ShowEnemyPlayerPosition("servant_grunt_1");
ShowEnemyPlayerPosition("servant_grunt_2");
AddTimer("", 1.5, "FadeDust"); <--- Timer works, but almost seems delayed now. The monsters use to fade right before they hit you, now they last nearly 3x as long, but still do fade.
PlayMusic("12_event_blood", false, 2, 0, 0, false);
}

void FadeDust(string &in item)
{
FadeEnemyToSmoke("servant_grunt_1", true);
FadeEnemyToSmoke("servant_grunt_2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level_3", false);
PlaySoundAtEntity("", "unlock_door.snt", "level_3", 0, false);
RemoveItem("key_5"); <--- Script works, but door remains locked?
}


void OnEnter()
{
}

void OnLeave()
{

}

I have NO idea what has happened, I've went through and checked for ANY missing ; or "" but could not find any. Even if that were the problem wouldn't I have gotten some kind of script error? I don't believe it to be a script error as the map still runs. It can't be a naming error either if everything still activates. Its just like certain parts of the code don't activate, and others are just delayed. If anyone can even provide an idea of what went wrong, I'd appreciate it. Right now the only course of action I see, is just to redo all of this script, which I don't really want to, because I really wanna release my part 1 and get some feedback on what to do better. Confused

Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
(This post was last modified: 03-20-2012, 07:47 PM by DaAinGame.)
03-20-2012, 04:52 AM
Find


Messages In This Thread
Script Randomly Bugged - by DaAinGame - 03-20-2012, 04:52 AM
RE: Script Randomly Bugged - by Your Computer - 03-20-2012, 07:14 AM
RE: Script Randomly Bugged - by DaAinGame - 03-20-2012, 07:32 AM
RE: Script Randomly Bugged - by Your Computer - 03-20-2012, 07:47 AM
RE: Script Randomly Bugged - by DaAinGame - 03-20-2012, 08:15 AM



Users browsing this thread: 1 Guest(s)