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
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Script Randomly Bugged

Test out the map again up till where you can no longer progress. Then check the hpl.log at Documents/Amnesia/Main for any errors (and warnings) related to your map.

Tutorials: From Noob to Pro
03-20-2012, 07:14 AM
Website Find
DaAinGame Offline
Member

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

For saving space on the thread
http://pastebin.com/6aZ6Mq8L
From what I gathered it had something to do with the door and the grunt 2. I removed the second grunt, updated the map save, deleted the cache file and played through again. Yet I got the same error? Same thing with that enabled02 sound. I removed that from LONG ago yet it still shows up? And I'm not sure with whats up with all the
WARNING: Could not find language file entry ''
Even if it has something to do with the .lang file, how could that effect music being player? And what really makes me itch my head is that timer. Suppose to last 1.5 seconds, and it is now lasting nearly 5 seconds? Honestly, I almost feel as if it's using my older script, where it had no music and that timer was longer, but opening the file located IN my custom story folder brings up my updated script, not my older one?

Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
03-20-2012, 07:32 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Script Randomly Bugged

Skimming through the code you posted, things seem fine to me, so i won't be able to help you any further unless i can get a copy of your custom story with all its custom resources.

Tutorials: From Noob to Pro
03-20-2012, 07:47 AM
Website Find
DaAinGame Offline
Member

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

I am too tired to continue on the matter tonight, but after exploring through my level a bit more I truly believe that it is using my older script file. It fits in; no music playing after picking up the oil, the Grunt(s) lasting nearly 4 seconds longer, and the fact that the level door refuses to unlock, even after using the key on it. When I first began scripting for the map I had that same exact issue. My question, however, is how on earth could it possibly be using my older script when its sitting somewhere in my recycling bin, and the updated version is what rests in my custom story folder? I'll have to look into it further. I'll probably use load map and see if I can use any of the items from another part of the story in it, such as the knife on the web. If that doesn't work then I'll know for sure it's not running an up-to-date script.

***EDIT*** Here's where this gets odd. I believe that the map works for other people, but when I play it, it messes up right? Well I fully removed the .hps file from my custom stories, and it still runs a script file? Simply what the heck?

***EDIT*** Finally solved the issue. Somehow a old copy of the .hps file got into my maps folder in the main Amnesia directory. Since it looks there first, it used that script! How it got there I don't know, why it always ran the up to date version until yesterday? I don't know! But it doesn't matter fixed the issue and can finally finish up my story!

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, 08:15 AM
Find




Users browsing this thread: 2 Guest(s)