Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chipper And Hammer Animation
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#1
Chipper And Hammer Animation

Hey Forum, well the title says it all. Does anyone know how to do it? And if so, would you please help me? I know it has to do with the hammer and chipper "move" items but how does it work? It would be appreciated if someone could help.
07-15-2012, 11:34 AM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#2
RE: Chipper And Hammer Animation

There seem to be no script involved in making the hammer move. Just setting it active seem to do it automatically. The hammer needs an area to rotate around (Look at how FC did it in 15_prison_south).

"What you think is irrelevant" - A character of our time

A Christmas Hunt
07-15-2012, 12:26 PM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#3
RE: Chipper And Hammer Animation

A little tutorial:

You need an object where the hammer is pointing at, in this case it's "HammerDoor".
The next thing is an Area which defines where the hammer rotates.
And obviously a hammer. (stone_hammer_move.ent)

You place it like in this image: [Image: 3i32l.jpg]
And enter the name of the area which the hammer will rotate around into AngularOffsetArea.
My area is called AreaHammerRotate.

Here's the script:
void OnStart()
{
    AddUseItemCallback("HCOnBricks", "stone_hammer_1", "HammerDoor", "UseHCOnBricks", true);
    //stone_hammer_1 is the name of the hammer, HammerDoor the entity where you use the hammer on
}

void UseHCOnBricks(string &in asItem, string &in asEntity)
{
    SetEntityActive("stone_chipper_move_x_1",true);
    SetEntityActive("stone_hammer_move_1",true);
        
    PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);
    
    SetMoveObjectState("stone_hammer_move_1", 0.25f);
    SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    
    AddTimer("1", 0.6f, "TimerHammer");
    AddTimer("2", 1.2f, "TimerHammer");
    AddTimer("3", 1.8f, "TimerHammer");
    AddTimer("4", 2.4f, "TimerHammer");
    AddTimer("5", 3.0f, "TimerHammer");
    
    SetEntityActive(asEntity, false); //Turns off interaction message on area.
    
    //Remove hammer chisel as not needed any longer
    if(HasItem("poison_gland")) RemoveItem(asItem);
}

void TimerHammer(string &in asTimer)
{
    if(asTimer == "1"){
        SetEntityInteractionDisabled("HammerDoor", true);
        SetPropStaticPhysics("HammerDoor", true);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
        SetMoveObjectState("stone_hammer_move_1", 0.25f);
        SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
    }
    if(asTimer == "2"){
        SetMoveObjectState("stone_hammer_move_1", 0.0f);
        SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    }
    if(asTimer == "3"){
        SetMoveObjectState("stone_hammer_move_1", 0.25f);
        SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
    }
    if(asTimer == "4"){
        SetMoveObjectState("stone_hammer_move_1", 0.0f);
        SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    }
    if(asTimer == "5"){
        SetEntityActive("stone_chipper_move_x_1",false);
        SetEntityActive("stone_hammer_move_1",false);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
        CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaHammerOnDoor", false);
        SetLocalVarInt("UsedHC", 1);
        SetPropHealth("HammerDoor", 0);        
    }
}

In this case i don't have a chipper, but it's still included in the script. You may have to adjust things a bit in order to fit together.
Basically what this script does is making the hammer hit the door and make a sound on the impact.
If you don't want to hit a door, you have to remove the sounds.

Feel free to ask questions if you have problems with the script or something doesn't work.

Good luck! Wink

[Image: 18694.png]
07-15-2012, 02:19 PM
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#4
RE: Chipper And Hammer Animation

(07-15-2012, 02:19 PM)Ongka Wrote: A little tutorial:

You need an object where the hammer is pointing at, in this case it's "HammerDoor".
The next thing is an Area which defines where the hammer rotates.
And obviously a hammer. (stone_hammer_move.ent)

You place it like in this image: [Image: 3i32l.jpg]
And enter the name of the area which the hammer will rotate around into AngularOffsetArea.
My area is called AreaHammerRotate.

Here's the script:
void OnStart()
{
    AddUseItemCallback("HCOnBricks", "stone_hammer_1", "HammerDoor", "UseHCOnBricks", true);
    //stone_hammer_1 is the name of the hammer, HammerDoor the entity where you use the hammer on
}

void UseHCOnBricks(string &in asItem, string &in asEntity)
{
    SetEntityActive("stone_chipper_move_x_1",true);
    SetEntityActive("stone_hammer_move_1",true);
        
    PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);
    
    SetMoveObjectState("stone_hammer_move_1", 0.25f);
    SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    
    AddTimer("1", 0.6f, "TimerHammer");
    AddTimer("2", 1.2f, "TimerHammer");
    AddTimer("3", 1.8f, "TimerHammer");
    AddTimer("4", 2.4f, "TimerHammer");
    AddTimer("5", 3.0f, "TimerHammer");
    
    SetEntityActive(asEntity, false); //Turns off interaction message on area.
    
    //Remove hammer chisel as not needed any longer
    if(HasItem("poison_gland")) RemoveItem(asItem);
}

void TimerHammer(string &in asTimer)
{
    if(asTimer == "1"){
        SetEntityInteractionDisabled("HammerDoor", true);
        SetPropStaticPhysics("HammerDoor", true);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
        SetMoveObjectState("stone_hammer_move_1", 0.25f);
        SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
    }
    if(asTimer == "2"){
        SetMoveObjectState("stone_hammer_move_1", 0.0f);
        SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    }
    if(asTimer == "3"){
        SetMoveObjectState("stone_hammer_move_1", 0.25f);
        SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
    }
    if(asTimer == "4"){
        SetMoveObjectState("stone_hammer_move_1", 0.0f);
        SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    }
    if(asTimer == "5"){
        SetEntityActive("stone_chipper_move_x_1",false);
        SetEntityActive("stone_hammer_move_1",false);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
        CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaHammerOnDoor", false);
        SetLocalVarInt("UsedHC", 1);
        SetPropHealth("HammerDoor", 0);        
    }
}

In this case i don't have a chipper, but it's still included in the script. You may have to adjust things a bit in order to fit together.
Basically what this script does is making the hammer hit the door and make a sound on the impact.
If you don't want to hit a door, you have to remove the sounds.

Feel free to ask questions if you have problems with the script or something doesn't work.

Good luck! Wink
thanks for the help but i cant get it to work. it followed everything, and renamed all the things that needed to be renamed. I want the player to use it on padlock. When I try it, it says the cannot be used on there. And the animation wont even show.

void OnStart()
{
AddUseItemCallback("HCOnBricks", "stone_hammer_1", "padlock_rusty_1", "UseHCOnBricks", true);

}


void UseHCOnBricks(string &in asItem, string &in asEntity)
{
SetEntityActive("stone_chipper_move_x_1",true);
SetEntityActive("stone_hammer_move_1",true);

PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);

SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);

AddTimer("1", 0.6f, "TimerHammer");
AddTimer("2", 1.2f, "TimerHammer");
AddTimer("3", 1.8f, "TimerHammer");
AddTimer("4", 2.4f, "TimerHammer");
AddTimer("5", 3.0f, "TimerHammer");

SetEntityActive(asEntity, false); //Turns off interaction message on area.

//Remove hammer chisel as not needed any longer
if(HasItem("poison_gland")) RemoveItem(asItem);
}

void TimerHammer(string &in asTimer)
{
if(asTimer == "1"){
SetEntityInteractionDisabled("padlock_rusty_1", true);
SetPropStaticPhysics("padlock_rusty_1", true);
PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
}
if(asTimer == "2"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
}
if(asTimer == "3"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
}
if(asTimer == "4"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
}
if(asTimer == "5"){
SetEntityActive("stone_chipper_move_x_1",false);
SetEntityActive("stone_hammer_move_1",false);
PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaHammerOnDoor", false);
SetLocalVarInt("UsedHC", 1);
SetPropHealth("padlock_rusty_1", 0);
}
}

(07-15-2012, 02:19 PM)Ongka Wrote: A little tutorial:

You need an object where the hammer is pointing at, in this case it's "HammerDoor".
The next thing is an Area which defines where the hammer rotates.
And obviously a hammer. (stone_hammer_move.ent)

You place it like in this image: [Image: 3i32l.jpg]
And enter the name of the area which the hammer will rotate around into AngularOffsetArea.
My area is called AreaHammerRotate.

Here's the script:
void OnStart()
{
    AddUseItemCallback("HCOnBricks", "stone_hammer_1", "HammerDoor", "UseHCOnBricks", true);
    //stone_hammer_1 is the name of the hammer, HammerDoor the entity where you use the hammer on
}

void UseHCOnBricks(string &in asItem, string &in asEntity)
{
    SetEntityActive("stone_chipper_move_x_1",true);
    SetEntityActive("stone_hammer_move_1",true);
        
    PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);
    
    SetMoveObjectState("stone_hammer_move_1", 0.25f);
    SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    
    AddTimer("1", 0.6f, "TimerHammer");
    AddTimer("2", 1.2f, "TimerHammer");
    AddTimer("3", 1.8f, "TimerHammer");
    AddTimer("4", 2.4f, "TimerHammer");
    AddTimer("5", 3.0f, "TimerHammer");
    
    SetEntityActive(asEntity, false); //Turns off interaction message on area.
    
    //Remove hammer chisel as not needed any longer
    if(HasItem("poison_gland")) RemoveItem(asItem);
}

void TimerHammer(string &in asTimer)
{
    if(asTimer == "1"){
        SetEntityInteractionDisabled("HammerDoor", true);
        SetPropStaticPhysics("HammerDoor", true);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
        SetMoveObjectState("stone_hammer_move_1", 0.25f);
        SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
    }
    if(asTimer == "2"){
        SetMoveObjectState("stone_hammer_move_1", 0.0f);
        SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    }
    if(asTimer == "3"){
        SetMoveObjectState("stone_hammer_move_1", 0.25f);
        SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
    }
    if(asTimer == "4"){
        SetMoveObjectState("stone_hammer_move_1", 0.0f);
        SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
    }
    if(asTimer == "5"){
        SetEntityActive("stone_chipper_move_x_1",false);
        SetEntityActive("stone_hammer_move_1",false);
        PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
        PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
        CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaHammerOnDoor", false);
        SetLocalVarInt("UsedHC", 1);
        SetPropHealth("HammerDoor", 0);        
    }
}

In this case i don't have a chipper, but it's still included in the script. You may have to adjust things a bit in order to fit together.
Basically what this script does is making the hammer hit the door and make a sound on the impact.
If you don't want to hit a door, you have to remove the sounds.

Feel free to ask questions if you have problems with the script or something doesn't work.

Good luck! Wink
Never mind i got it to works. Thanks very much!
(This post was last modified: 07-15-2012, 10:08 PM by HoyChampoy.)
07-15-2012, 10:06 PM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#5
RE: Chipper And Hammer Animation

Good to know that it worked! Smile
What was it you had to fix in order to make it work?

[Image: 18694.png]
07-15-2012, 11:04 PM
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#6
RE: Chipper And Hammer Animation

(07-15-2012, 11:04 PM)Ongka Wrote: Good to know that it worked! Smile
What was it you had to fix in order to make it work?
changed some names thats all. I also added some stuff to the timers Smile

heres the whole script



void UseHCOnBricks(string &in asItem, string &in asEntity)
{
SetEntityActive("stone_chipper_move_x_1",true);
SetEntityActive("stone_hammer_move_1",true);
SetEntityActive("padlock_rusty_1", true);

PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);

SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);

AddTimer("1", 0.6f, "TimerHammer");
AddTimer("2", 1.2f, "TimerHammer");
AddTimer("3", 1.4f, "TimerHammer");
AddTimer("4", 2.0f, "TimerHammer");
AddTimer("5", 2.6f, "TimerHammer");
AddTimer("6", 2.8f, "TimerHammer");
AddTimer("7", 3.4f, "TimerHammer");
AddTimer("8", 4.0f, "TimerHammer");
AddTimer("9", 4.2f, "TimerHammer");
AddTimer("10", 4.250f, "TimerHammer");
AddTimer("11", 4.64f, "TimerHammer");

}

void TimerHammer(string &in asTimer)
{
if(asTimer == "1"){
SetEntityInteractionDisabled("padlock_rusty_1", true);
SetPropStaticPhysics("padlock_rusty_1", true);
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
}
if(asTimer == "2"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
}
if(asTimer == "3"){
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
}
if(asTimer == "4"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
}
if(asTimer == "5"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
}
if(asTimer == "6"){
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
}
if(asTimer == "7"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
}
if(asTimer == "8"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
}
if(asTimer == "9"){

SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
PlaySoundAtEntity("bang", "hit_wood", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaHammerOnDoor", false);
SetLocalVarInt("UsedHC", 1);
}
if(asTimer == "10"){
SetSwingDoorLocked("prison_section_1", false, true);
SetEntityActive("padlock_rusty_1", false);
SetEntityActive("padlock_broken_1", true);
PlaySoundAtEntity("", "pickaxe_hit", "prison_section_1", 0, false);
AddPlayerSanity(25);
RemoveItem("stone_hammer_chipper");
}
if(asTimer == "11"){
SetEntityActive("stone_chipper_move_x_1",false);
SetEntityActive("stone_hammer_move_1",false);
}
}
07-16-2012, 09:48 AM
Find




Users browsing this thread: 1 Guest(s)