Frictional Games Forum (read-only)
How to make a hammer destroy a padlock (or other enteties) - 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 a hammer destroy a padlock (or other enteties) (/thread-11964.html)



How to make a hammer destroy a padlock (or other enteties) - Quotentote - 12-20-2011

hi there.

i got another question.
how do i scritp that hammer-xyz destroys padlock-xyz?

PHP Code:
void OnStart()
{
AddUseItemCallback("""torturekey""tortureroom""unlock_door1"true);
}

void unlock_door1(string &in asItemstring &in asEntity)
{
    
SetPropHealth("tortureroom"0.0f);


dont be confused by the names^^ torturekey=hammer tortureroom=padlock Wink

so how do i script this, that the padlock will be destroyed when using the hammer on it?

ty
quotentote



RE: How to make a hammer destroy a padlock (or other enteties) - Dobbydoo - 12-20-2011

(12-20-2011, 03:29 PM)Quotentote Wrote: hi there.

i got another question.
how do i scritp that hammer-xyz destroys padlock-xyz?

PHP Code:
void OnStart()
{
AddUseItemCallback("""torturekey""tortureroom""unlock_door1"true);
}

void unlock_door1(string &in asItemstring &in asEntity)
{
    
SetPropHealth("tortureroom"0.0f);


dont be confused by the names^^ torturekey=hammer tortureroom=padlock Wink

so how do i script this, that the padlock will be destroyed when using the hammer on it?

ty
quotentote

The code you have should already work? Or is it the animation you're looking for? Then you should check out the prison_south.hps Smile




RE: How to make a hammer destroy a padlock (or other enteties) - Quotentote - 12-20-2011

no its not working :/ thats why im asking =)
or is it an special padlock i have to use? <.<

how animations work i already know (should be like using a crowbar)



RE: How to make a hammer destroy a padlock (or other enteties) - flamez3 - 12-20-2011

(12-20-2011, 03:42 PM)Quotentote Wrote: no its not working :/ thats why im asking =)
or is it an special padlock i have to use? <.<

how animations work i already know (should be like using a crowbar)


I would try making it inactive and spawn a padlock broken one right on the original padlock. I'm not sure the padlock use's health.


RE: How to make a hammer destroy a padlock (or other enteties) - Quotentote - 12-20-2011

you mean something like that?

PHP Code:
    void VOIDNAME (string &in asItemstring &in asEntity)
            {
            
SetEntityActive("BROKENPADLOCK",true);
            
SetEntityActive("PADLOCK",false);
            
RemoveItem("HAMMER");
            } 



RE: How to make a hammer destroy a padlock (or other enteties) - flamez3 - 12-20-2011

(12-20-2011, 04:03 PM)Quotentote Wrote: you mean something like that?

PHP Code:
    void VOIDNAME (string &in asItemstring &in asEntity)
            {
            
SetEntityActive("BROKENPADLOCK",true);
            
SetEntityActive("PADLOCK",false);
            
RemoveItem("HAMMER");
            } 
Pretty much, maybe add a sound or something?


RE: How to make a hammer destroy a padlock (or other enteties) - Quotentote - 12-20-2011

i add sounds when everything works ^^

ty for that hint i'll let my boyfriend test it later ^^




RE: How to make a hammer destroy a padlock (or other enteties) - Your Computer - 12-20-2011

(12-20-2011, 06:02 PM)Quotentote Wrote: i add sounds when everything works ^^

ty for that hint i'll let my boyfriend test it later ^^

Rolleyes Here's a tip that can help speed up the process for testing:

When using a profile enabled for development, ScriptDebugOn() returns true. If you check for when it returns true, for example, in OnStart(), you can temporarily set up the game environment to quickly and easily accomplish a task by giving the player items and teleporting the player to a specific area, etc.


RE: How to make a hammer destroy a padlock (or other enteties) - Quotentote - 12-20-2011

thats not the problem.... the problem is the waterlurker....im so afraid of these things that i dont WANT to test it xD i feel so silly by saying this but i dont change anything in my scripts. they work and this should remain so ^^

i also feel silly by creating a new thread everyday, but all of you guys make the start in scripting so much easier.

thank you for that i gonna test the script later this evening