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 Help Ceremony Knife
Atilla280 Offline
Junior Member

Posts: 24
Threads: 6
Joined: Jul 2012
Reputation: 1
#1
Ceremony Knife

How do I make it so that I cut a person open and a key falls out?
07-10-2012, 05:01 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: Ceremony Knife

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.

I rate it 3 memes.
07-10-2012, 05:22 AM
Find
Atilla280 Offline
Junior Member

Posts: 24
Threads: 6
Joined: Jul 2012
Reputation: 1
#3
RE: Ceremony Knife

That did thank you very much
07-10-2012, 05:33 AM
Find




Users browsing this thread: 1 Guest(s)