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
How to make things like crowbar and surgical needle.
Khan Offline
Member

Posts: 61
Threads: 12
Joined: Aug 2011
Reputation: 0
#1
How to make things like crowbar and surgical needle.

I was wondering wat the code to make the crowbar usable on a door or something, just the the code for those general things like crowbar, needle, all that good stuffs.
08-24-2011, 12:44 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: How to make things like crowbar and surgical needle.

It's called the AddUseItemCallback command function. Go ahead and search it in the script functions page.

To make a needle open a door is like making a key open a door.

void OnStart()
{
     AddUseItemCallback("needle_1", "DoorName", "Func01", false);
}
void Func01(string &in asItem, string &in asEntity)
{
     RemoveItem(asItem);
     SetSwingDoorLocked(asEntity, false, true);
     PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
}

08-24-2011, 12:59 AM
Find
Khan Offline
Member

Posts: 61
Threads: 12
Joined: Aug 2011
Reputation: 0
#3
RE: How to make things like crowbar and surgical needle.

(08-24-2011, 12:59 AM)Kyle Wrote: It's called the AddUseItemCallback command function. Go ahead and search it in the script functions page.

To make a needle open a door is like making a key open a door.

void OnStart()
{
     AddUseItemCallback("needle_1", "DoorName", "Func01", false);
}
void Func01(string &in asItem, string &in asEntity)
{
     RemoveItem(asItem);
     SetSwingDoorLocked(asEntity, false, true);
     PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
}

Would that be the same with a crowbar and everything? I understand basic scripting pretty good, but the more complicated stuff I have no clue, so, lol. Sad
08-24-2011, 01:11 AM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#4
RE: How to make things like crowbar and surgical needle.

Kyle, if you use crowbar like that, does it set crowbar automatically into that effect that you have to push it or script it Smile?

The Interrogation
Chapter 1

My tutorials
(This post was last modified: 08-24-2011, 01:14 AM by Elven.)
08-24-2011, 01:14 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#5
RE: How to make things like crowbar and surgical needle.

(08-24-2011, 01:14 AM)Elven Wrote: Kyle, if you use crowbar like that, does it set crowbar automatically into that effect that you have to push it or script it Smile?

That requires more scripting, if you ever looked "deep enough" into the script functions page where it talks about prop connection and rotation and movement. That's when you can make things move by themselves when doing some of that stuff. For the crowbar script, I looked into Amnesia's script files and saw that it used other types of crowbar objects like the item type and then the one that can be moved, and then the other one that is broken. I was able to get it working once, but I never really wanted to try it.

Crowbar Opening Door = Old

:/

08-24-2011, 01:21 AM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#6
RE: How to make things like crowbar and surgical needle.

Hell yes it is ^^. But if I would use crowbar on something, then not on opening door. On more puzzle way and stuff. That's why I asked Smile.

The Interrogation
Chapter 1

My tutorials
08-24-2011, 01:48 AM
Find
Juby Away
Senior Member

Posts: 290
Threads: 2
Joined: May 2011
Reputation: 5
#7
RE: How to make things like crowbar and surgical needle.

(08-24-2011, 01:21 AM)Kyle Wrote: Crowbar Opening Door = Old

:/

So true.

Insanity. Static.
08-24-2011, 02:50 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#8
RE: How to make things like crowbar and surgical needle.

crowbar opening a door is old, but as long as you use it in an unusual / unexpected way, I have no problem with it. There are so many things you could do with items what HPL is capable of, you just need to learn your way around the model editor. Smile

For example, if you look through all of the entities, every single one can be turned into an item, which opens the possiblities for hundreds of unique puzzles! Also, anything can be turned into a lever, a wheel, or even a door! so you can increase interactivity greatly by simply turning for example an old broom into a makeshift lever or something...


For your question, it's simple.
1. when you interact with the puzzle, set a crowbar joint entity active
2. when the crowbar joint entity touches a set area - ie: it has bent too much - break the door Smile

(This post was last modified: 08-24-2011, 03:48 AM by DRedshot.)
08-24-2011, 03:19 AM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#9
RE: How to make things like crowbar and surgical needle.

Quote:For your question, it's simple.
1. when you interact with the puzzle, set a crowbar joint entity active
2. when the crowbar joint entity touches a set area - ie: it has bent too much - break the door Smile

Thanks! That answers my question Smile!!!

The Interrogation
Chapter 1

My tutorials
08-24-2011, 03:21 AM
Find




Users browsing this thread: 1 Guest(s)