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.
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#1
Amnesia Error, need help.

Hey guys, so i've been working alot on my custom story, and now i'm really tired, it kinda makes me retarded. So please tell me why Amnesia crashes, I'm sure it's some lame stupid problem, i'm just feeling really retarded right now. Please help.


These are the Callbacks for my padlock, that i'm supposed to break with a "stone_hammer_chipper".



AddUseItemCallback("", "stone_hammer_chipper", "padlock_rusty_1", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "stone_hammer_chipper", "prison_section_1", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "chipper_1", "prison_section_1", "UsedKeyOnDoor2", false);
AddUseItemCallback("", "chipper_1", "padlock_rusty_1", "UsedKeyOnDoor2", false);
AddUseItemCallback("", "hammer_2", "prison_section_1", "UsedKeyOnDoor2", false);
AddUseItemCallback("", "hammer_2", "padlock_rusty_1", "UsedKeyOnDoor2", false);
SetEntityPlayerInteractCallback("prison_section_1", "PadLockHint", true);
SetEntityPlayerInteractCallback("padlock_rusty_1", "PadLockHint", true);

This is the Callback syntax.


void UsedKeyOnDoor2(string &in item, string &in entity)
{
if(asItem == "hammer_2")
SetMessage("Padlock", "UseHammerOnPadlock", 0);
if(asItem == "chipper_1")
SetMessage("Padlock", "UseChipperOnPadlock", 0);

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 think it said it was 4 errors when the game crashed. Something with that a "boolean" (or something like that) value was needed, 1 said that the "asItem" wasn't declared, and the others said something else.

Thank you for taking your time!

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
05-28-2012, 03:11 PM
Find
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




Users browsing this thread: 1 Guest(s)