Frictional Games Forum (read-only)
[SCRIPT] Ceremony Knife - 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] Ceremony Knife (/thread-16870.html)



Ceremony Knife - Atilla280 - 07-10-2012

How do I make it so that I cut a person open and a key falls out?


RE: Ceremony Knife - Adny - 07-10-2012

For the very basics to make this work, you can use "AddUseItemCallback", having the item set to the knife and the entity as the body to cut. For example:

AddUseItemCallback("", "NAMEOFKNIFE", "NAMEOFBODY", "FUNC", false);

As for the function, simply have a key laying next to the body inactive in the level editor, then set it active using the function "SetEntityActive".


If you would like a more complex version, let me know exactly how you envision it in your mind. There are many variations of what I said, some of the simpler effects you can add to make it look more fancy are PlaySoundAtEntity (perhaps have a cutting/stabbing sound play), CreateParticleSystemAtEntity(make blood spurt out of the body). You can also have a second knife set inactive, positioned as if it has been stabbed into the body. Simply set it active as well and it will look like the player stabbed him.

Here's the full script for the most basic idea:


void OnStart()
{
AddUseItemCallback("", "NAMEOFKNIFE", "NAMEOFBODY", "FUNC", false);
}

void FUNC(string &in asItem, string &in asEntity)
{
SetEntityActive("NAMEOFKEY", true);
}

Hope that helped.


RE: Ceremony Knife - Atilla280 - 07-10-2012

That did thank you very much