Frictional Games Forum (read-only)
How to make things like crowbar and surgical needle. - 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: How to make things like crowbar and surgical needle. (/thread-9953.html)



How to make things like crowbar and surgical needle. - Khan - 08-24-2011

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.


RE: How to make things like crowbar and surgical needle. - Kyle - 08-24-2011

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.

Code:
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);
}



RE: How to make things like crowbar and surgical needle. - Khan - 08-24-2011

(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.

Code:
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



RE: How to make things like crowbar and surgical needle. - Elven - 08-24-2011

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?


RE: How to make things like crowbar and surgical needle. - Kyle - 08-24-2011

(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

:/


RE: How to make things like crowbar and surgical needle. - Elven - 08-24-2011

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.


RE: How to make things like crowbar and surgical needle. - Juby - 08-24-2011

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

:/

So true.


RE: How to make things like crowbar and surgical needle. - DRedshot - 08-24-2011

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


RE: How to make things like crowbar and surgical needle. - Elven - 08-24-2011

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!!!