Frictional Games Forum (read-only)
Script doesnt work. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Script doesnt work. (/thread-12418.html)



Script doesnt work. - kartanonperuna - 01-07-2012

It says:

A funciton with the same name and parameters already exist(hps) and "Downstairskey"is not declared.




void OnStart()
{
AddEntityCollideCallback("crowbar_joint_2", "crowcollide", "crowopen_func", true, 1);
AddUseItemCallback("", "crowbar_1", "prison_locked", "activatecrowdoor", true);
}



void crowopen_func(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("prison_locked", false, true);
CreateParticleSystemAtEntity("", "ps_break_wood.ps", "area1", false);
SetEntityActive("crowbar_joint_2", false);
GiveSanityBoost();
PlaySoundAtEntity("", "break_wood.snt", "area1", 0, false);
SetSwingDoorClosed("prison_locked", false, true);
SetSwingDoorDisableAutoClose("prison_locked", true);
AddPropImpulse("prison_locked", 0, 0, -3, "world");
}

void activatecrowdoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_2", true);
RemoveItem("crowbar_1");
}

void OnStart()
{
AddUseItemCallback("", "Downstairsdoor", "cellar_wood01_slow", "KeyOnDoor", true);
}


void KeyOnDoor(string &in , string &in door)
{
SetSwingDoorLocked("cellar_wood01_slow", false, true);
PlaySoundAtEntity("", "unlock_door", "cellar_wood01_slow", 0, false);
RemoveItem(Downstairskey);
}


After I added they key opening door script.Whats wrong?


RE: Script doesnt work. - flamez3 - 01-07-2012

You have 2 void OnStart()'s

PHP Code:
void OnStart()
{
AddEntityCollideCallback("crowbar_joint_2""crowcollide""crowopen_func"true1);
AddUseItemCallback("""crowbar_1""prison_locked""activatecrowdoor"true);
AddUseItemCallback("""Downstairsdoor""cellar_wood01_slow""KeyOnDoor"true); 
}



void crowopen_func(string &in asParentstring &in asChildint alState)
{
SetSwingDoorLocked("prison_locked"falsetrue);
CreateParticleSystemAtEntity("""ps_break_wood.ps""area1"false);
SetEntityActive("crowbar_joint_2"false);
GiveSanityBoost();
PlaySoundAtEntity("""break_wood.snt""area1"0false);
SetSwingDoorClosed("prison_locked"falsetrue);
SetSwingDoorDisableAutoClose("prison_locked"true);
AddPropImpulse("prison_locked"00, -3"world");
}

void activatecrowdoor(string &in asItemstring &in asEntity)
{
SetEntityActive("crowbar_joint_2"true);
RemoveItem("crowbar_1");
}

void KeyOnDoor(string &in string &in door)
{
SetSwingDoorLocked("cellar_wood01_slow"falsetrue);
PlaySoundAtEntity("""unlock_door""cellar_wood01_slow"0false);
RemoveItem("Downstairskey");



The reason Downstairskey didn't work is because you didn't have "" around it.


RE: Script doesnt work. - kartanonperuna - 01-07-2012

Okay it works.But what about the other issue?


RE: Script doesnt work. - kartanonperuna - 01-07-2012

Wait it didnt work.


RE: Script doesnt work. - flamez3 - 01-07-2012

What didn't work, what did the error say?


RE: Script doesnt work. - kartanonperuna - 01-07-2012

No object to use the item on.it doesnt open



RE: Script doesnt work. - flamez3 - 01-07-2012

Did you name everything correctly. Is it .hps, not .map?


RE: Script doesnt work. - kartanonperuna - 01-07-2012

Khyrpa solved it.


RE: Script doesnt work. - flamez3 - 01-07-2012

You mind telling me what was wrong?