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
Amnesia Error, need help.
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#2
RE: Amnesia Error, need help.

Need to see entire script and every error that is being generated.

Please do not use red text, that is an eyesore to read.

if(asItem == "stone_hammer_chipper")

SetPropHealth("padlock_rusty_1", 0.0f);

SetEntityActive("padlock_broken_1", true);

SetEntityActive("padlock_rusty_1", false);

RemoveItem("stone_hammer_chipper");

PlaySoundAtEntity("", "impact_metal_high.snt", "prison_section_1", 0, false);

GiveSanityBoost();

CompleteQuest("padlockquest", "PadLockQuest");

SetEntityPlayerInteractCallback("prison_section_1", "", false);

PlayMusic("12_puzzle_cavein.ogg", false, 1.0, 0, 1, true);

AddTimer("", 30.0, "ResetMusic"); //Reset the music

I see an issue right here. When using the if statement, if you don't add brackets, it only reads the next line as part of the if statement. So you need to this entire block with

if(asItem == "stone_hammer_chipper")
{

SetPropHealth("padlock_rusty_1", 0.0f);

SetEntityActive("padlock_broken_1", true);

SetEntityActive("padlock_rusty_1", false);

RemoveItem("stone_hammer_chipper");

PlaySoundAtEntity("", "impact_metal_high.snt", "prison_section_1", 0, false);

GiveSanityBoost();

CompleteQuest("padlockquest", "PadLockQuest");

SetEntityPlayerInteractCallback("prison_section_1", "", false);

PlayMusic("12_puzzle_cavein.ogg", false, 1.0, 0, 1, true);

AddTimer("", 30.0, "ResetMusic"); //Reset the music
}

Although I would prefer the much easier to read:

if(asItem != "stone_hammer_chipper") return; //we didn't use the stone hammer/chipper, so do nothing.



SetPropHealth("padlock_rusty_1", 0.0f);

SetEntityActive("padlock_broken_1", true);

SetEntityActive("padlock_rusty_1", false);

RemoveItem("stone_hammer_chipper");

PlaySoundAtEntity("", "impact_metal_high.snt", "prison_section_1", 0, false);

GiveSanityBoost();

CompleteQuest("padlockquest", "PadLockQuest");

SetEntityPlayerInteractCallback("prison_section_1", "", false);

PlayMusic("12_puzzle_cavein.ogg", false, 1.0, 0, 1, true);

AddTimer("", 30.0, "ResetMusic"); //Reset the music


void UsedKeyOnDoor2(string &in item, string &in entity) should also be:

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)

(This post was last modified: 05-28-2012, 04:29 PM by Putmalk.)
05-28-2012, 04:26 PM
Find


Messages In This Thread
Amnesia Error, need help. - by Wapez - 05-28-2012, 03:11 PM
RE: Amnesia Error, need help. - by Putmalk - 05-28-2012, 04:26 PM



Users browsing this thread: 1 Guest(s)