Jump to content

Breakable object script


ionoblivion

Recommended Posts

I am trying for a long time to make a static object to get broken when I hit with a melee weapon. It is easy to do that when I hit with a bow, but I want do it with a axe example. Now I know OBSE has this ability with those functions : reference.GetObjectHealth ; reference.setObjectHealth but still don't know exactly how to do it. I have the object, it is a wooden plank animated for a broken damage, just need the script. Please help if someone know the script?!

Link to comment
Share on other sites

Si if you hit a static object, which effect do you want it to have when it is broken? To look broken? If you want the object to look like you hit it, then you need to replace that object with a premade broken object I guess. A static is static after all... You can exchange a static object with another in a script but first you need to make the broken meshes.

Link to comment
Share on other sites

Maybe can you do this with a OnHit effect by reproducing the pushable planks' script MPlanksBreakAway01Script.

 

Never tested it but I think it's worth trying.

I AM SURE I DID IT BUT NOT WORKING WITH ONE HIT COMMAND IF I USE MELEE. STRANGE, IT IS WORKING WITH RANGE ATTACK, ARROWS OR EVEN SPELL MAGIC

Link to comment
Share on other sites

Si if you hit a static object, which effect do you want it to have when it is broken? To look broken? If you want the object to look like you hit it, then you need to replace that object with a premade broken object I guess. A static is static after all... You can exchange a static object with another in a script but first you need to make the broken meshes.

Interesant. The problem is I want do that just after I will hit that static object with a axe. To replace with a script or put animation in that object is easy for me. How to do that after hit with weapon melee?

Link to comment
Share on other sites

Scn BreakStaticObjectSCR

Float xPos
Float yPos
Float zPos

Float xAngle
Float yAngle
Float zAngle

Begin OnHit

	set xPos to OriginalObject.GetStartingPos x
	set yPos to OriginalObject.GetStartingPos y
	set xPos to OriginalObject.GetStartingPos z
	
	set xAngle to OriginalObject.GetStartingAngle x
	set xAngle to OriginalObject.GetStartingAngle y
	set xAngle to OriginalObject.GetStartingAngle z

	OriginalObject.disable
	
	BrokenObject.SetPos x xPos
	BrokenObject.SetPos y yPos
	BrokenObject.SetPos z zPos
	
	BrokenObject.SetAngle x xAngle
	BrokenObject.SetAngle y yAngle
	BrokenObject.SetAngle z zAngle

	BrokenObject.enable
end


That could work I guess

Link to comment
Share on other sites

 

Pellape

 

Scn BreakStaticObjectSCR

Float xPos
Float yPos
Float zPos

Float xAngle
Float yAngle
Float zAngle

Begin OnHit

	set xPos to OriginalObject.GetStartingPos x
	set yPos to OriginalObject.GetStartingPos y
	set xPos to OriginalObject.GetStartingPos z
	
	set xAngle to OriginalObject.GetStartingAngle x
	set xAngle to OriginalObject.GetStartingAngle y
	set xAngle to OriginalObject.GetStartingAngle z

	OriginalObject.disable
	
	BrokenObject.SetPos x xPos
	BrokenObject.SetPos y yPos
	BrokenObject.SetPos z zPos
	
	BrokenObject.SetAngle x xAngle
	BrokenObject.SetAngle y yAngle
	BrokenObject.SetAngle z zAngle

	BrokenObject.enable
end


That could work I guess

 

Sorry my friend I tried what you proposed to me but no chance with melee to do it. Is working well with a spell or a bow but not melee. Seems that function Begin OnHit works only on npc.

 

Link to comment
Share on other sites

Okay. I will give you another hint then...

 

In MOO, you can hit trees, flora and rocks with axes, hand scythes and pickaxes. The tools do not have scripts. It is not easy to follow Maskar's nested scripts, so I will not, well at least not now but take a look at his scripts as these tools acts exactly in the same way that you are looking for. If you do not find it, I might take a peek...

 

I am harvesting so much that I made Maskar a new Hand Scythe that most likely will be added in the next update :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...