[POC] Breakable Glass Statue

Post » Thu Sep 02, 2010 12:59 am

While messing around in my Serpent Isle remake I decided to try to make a glass statue I had made breakable. This is sort of a "proof of concept" of that. It's a mod that adds a glass statue to the tavern in the Elven Gardens district of the Imperial City. The statue should break if you throw it around the room a little. I'm still messing around with the script to see how to make it a little more reliable, but it works sufficiently well at the moment.

http://etherealsoftware.com.au/ultima/files/TPLGlassStatue.7z

Simply extract to the Data directory, select the mod and go to the Imperial City.

I'm thinking I might release a mod pack of a bunch of statues/items if I get around to making more.
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Wed Sep 01, 2010 9:26 pm

Did I just make up the Proof of Concept abbreviation?

Nope; I'd used it for the original thread about NifScript, for one.

Hehe, anyway! This is awesome, very cool. Also, holy crap it's Thepal! How are you doing? Great to see you!
User avatar
Laura
 
Posts: 3456
Joined: Sun Sep 10, 2006 7:11 am

Post » Wed Sep 01, 2010 9:52 pm

Needs to be [POCz] so it's searchable.
User avatar
Matthew Aaron Evans
 
Posts: 3361
Joined: Wed Jul 25, 2007 2:59 am

Post » Wed Sep 01, 2010 3:23 pm

Needs to be [POCz] so it's searchable.
Don't think that's a problem anymore.
User avatar
Zoe Ratcliffe
 
Posts: 3370
Joined: Mon Feb 19, 2007 12:45 am

Post » Wed Sep 01, 2010 4:01 pm

Nope; I'd used it for the original thread about NifScript, for one.

Hehe, anyway! This is awesome, very cool. Also, holy crap it's Thepal! How are you doing? Great to see you!


I'm good. Kinda surprised I still get "holy crap"s when I visit the forums :P

I realised I didn't put a link to a video of the breaking statue thingy. Which is silly since I only made it yesterday and put it up on youtube.

http://www.youtube.com/watch?v=XN5zP3-shK8
http://www.youtube.com/watch?v=IKbBQoiSVgg
http://www.youtube.com/watch?v=4wsgUSoIMyU

Those are some videos of the statue in action.

When I feel like doing some modelling I might make a lot more pieces and have it shatter instead of just break.
User avatar
electro_fantics
 
Posts: 3448
Joined: Fri Mar 30, 2007 11:50 pm

Post » Wed Sep 01, 2010 12:51 pm

By the way, you could use getSoundPlaying to detect the collision sound being played in the vicinity. I use a similar system in PiiiP that you might want to take a look at.
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Wed Sep 01, 2010 7:57 pm

I had thought about checking for sound, but it could just be too many things that could be making the sound... unless you found a way to make it a little more specific? (for example, if there were two glass items on a shelf, would I be able to tell which one made the sound?)
User avatar
Eliza Potter
 
Posts: 3481
Joined: Mon Mar 05, 2007 3:20 am

Post » Thu Sep 02, 2010 2:21 am

The getSoundPlaying function takes an argument to use as the radius for its checking.
ref.getSoundPlaying "C*" 35
That will return true if a collision sound was playing within 35 units from the calling ref.
User avatar
sara OMAR
 
Posts: 3451
Joined: Wed Jul 05, 2006 11:18 pm

Post » Wed Sep 01, 2010 12:48 pm

Wow. I didn't realise that. Excellent. I can make my script work a little better so the glass doesn't break weirdly. Thanks.
User avatar
Isabella X
 
Posts: 3373
Joined: Sat Dec 02, 2006 3:44 am

Post » Wed Sep 01, 2010 6:21 pm

Hey Thepal! There is http://www.invision.tesalliance.org/forums/index.php?/topic/2553-wip-lets-break-stuff/page__p__40603__fromsearch__1#entry40603 about developing breakable stuff. Maybe you could exchange your ideas.
User avatar
Trey Johnson
 
Posts: 3295
Joined: Thu Oct 11, 2007 7:00 pm

Post » Wed Sep 01, 2010 11:45 pm

The getSoundPlaying function takes an argument to use as the radius for its checking.
ref.getSoundPlaying "C*" 35
That will return true if a collision sound was playing within 35 units from the calling ref.


You are a legend. I incorporated GetSoundPlaying into the script, and it got rid of all the random issues I was having (such as it randomly exploding in mid-air) and made the script simpler. It only breaks when it hits something. I've uploaded a new version with the new script. I think it is actually pretty much done now...

I'm attaching the code to this post in case anyone is interested:

Spoiler
scn AATPLGlassStatueSCRIPTfloat xPosfloat yPosfloat zPosfloat xPosOldfloat yPosOldfloat zPosOldfloat xDifffloat yDifffloat zDifffloat fastSpeedfloat slowSpeedshort doOncefloat movingFastTimerref glassRefref myRefbegin OnAdd	set doOnce to 1	set xPos to GetPos x	set yPos to GetPos y	set zPos to GetPos z	set xPosOld to xPos	set yPosOld to yPos	set zPosOld to zPos	set myRef to GetSelfendbegin OnDrop	set doOnce to 1	set xPos to GetPos x	set yPos to GetPos y	set zPos to GetPos z	set xPosOld to xPos	set yPosOld to yPos	set zPosOld to zPos	set myRef to GetSelfendbegin GameMode	if GetDisabled		return	endif	if doOnce == 0		set doOnce to 1		set xPos to GetPos x		set yPos to GetPos y		set zPos to GetPos z		set xPosOld to xPos		set yPosOld to yPos		set zPosOld to zPos		set myRef to GetSelf	endif	set movingFastTimer to movingFastTimer - GetSecondsPassed	set xPos to GetPos x	set yPos to GetPos y	set zPos to GetPos z	if IsControlPressed 28 == 0		set xDiff to xPos - xPosOld		set yDiff to yPos - yPosOld		set zDiff to zPos - zPosOld		if xDiff < 0			set xDiff to 0 - xDiff		endif		if yDiff < 0			set yDiff to 0 - yDiff		endif		if zDiff < 0			set zDiff to 0 - zDiff		endif		set slowSpeed to 1 * GetSecondsPassed		if myRef.GetSoundPlaying "CGlass*" 50			if movingFastTimer > 0				set glassRef to PlaceAtMe AATPLGlassStatueBrokenTop 1				glassRef.SetAngle X 50				glassRef.SetAngle Y 45				glassRef.SetAngle Z 143				set glassRef to PlaceAtMe AATPLGlassStatueBrokenBottom 1 0 30				glassRef.SetAngle X 120				glassRef.SetAngle Y 14				glassRef.SetAngle Z -153				Disable			endif		endif		set fastSpeed to 50 * GetSecondsPassed		if xDiff > fastSpeed			set movingFastTimer to 0.1		endif		if yDiff > fastSpeed			set movingFastTimer to 0.1		endif		if zDiff > fastSpeed			set movingFastTimer to 0.1		endif	endif	set xPosOld to xPos	set yPosOld to yPos	set zPosOld to zPosend


Hey Thepal! There is http://www.invision.tesalliance.org/forums/index.php?/topic/2553-wip-lets-break-stuff/page__p__40603__fromsearch__1#entry40603 about developing breakable stuff. Maybe you could exchange your ideas.


Looks like I might be a bit further along than them. I'll put a post in there letting them know about my method.
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Wed Sep 01, 2010 6:02 pm

I heard that place at me is not good, since it put permanant reference is save game, that we cannot remove, even if the cell reset, or you disable it or you delete the item.
User avatar
Philip Lyon
 
Posts: 3297
Joined: Tue Aug 14, 2007 6:08 am

Post » Wed Sep 01, 2010 3:18 pm

I'm good. Kinda surprised I still get "holy crap"s when I visit the forums :P

Sad to say, there aren't many of us left (at least in the Oblivion forums) who I'd guess would remember you, but I certainly do.

For those who are reading this and don't know, Thepal was the author of the Unofficial Morrowind Patch, which was every bit as amazing as UOP. Quarn and Kivan were originally inspired by Thepal, and a lot of the methodology they used for the patch was started by Thepal.

I heard that place at me is not good, since it put permanant reference is save game, that we cannot remove, even if the cell reset, or you disable it or you delete the item.

PlaceAtMe has its... place (drr), it's just that it is (or was) frequently misused by scripters early in Oblivion's lifetime. Yes, it adds a permanent reference to the save game, however, I'll draw your attention to something:
        if GetDisabled                return        endif...                                set glassRef to PlaceAtMe AATPLGlassStatueBrokenTop 1...                                set glassRef to PlaceAtMe AATPLGlassStatueBrokenBottom 1 0 30...                                Disable
Because he ends with that disable, and starts with if GetDisabled Return, the script will only call PlaceAtMe twice. PlaceAtMe is bad if you're calling it infinitely. Twice is OK. Even a hundred, two hundred times would be ok - as long as it's finite. The problem was when a script would call PlaceAtMe all the time, and often needlessly. Here, Thepal probably does need to use PlaceAtMe to achieve the effect, and it isn't "bloat" - you want the broken halves of the statue to be there!
User avatar
Jeremy Kenney
 
Posts: 3293
Joined: Sun Aug 05, 2007 5:36 pm

Post » Wed Sep 01, 2010 9:14 pm

You are a legend. /snip
For those who are reading this and don't know, Thepal was the author of the Unofficial Morrowind Patch, which was every bit as amazing as UOP. Quarn and Kivan were originally inspired by Thepal, and a lot of the methodology they used for the patch was started by Thepal.
I wonder what that makes you :)
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Wed Sep 01, 2010 4:36 pm

I heard that place at me is not good, since it put permanant reference is save game, that we cannot remove, even if the cell reset, or you disable it or you delete the item.


As Dragoonwraith said, PlaceAtMe has its uses. I use it a lot in my mods, often with unlimited calls to it (which is what leads to savegame bloat if done wrong). I always make sure to remove every reference in those cases though which stops the bloat from happening. In this case it only creates the twio objects however, which i don't want to delete since they belong in the game from that point forward. Thousands of statues would need to be broken before sg bloat would need to be worried about.

I wonder what that makes you :)


Surprised, maybe? I was checking the stats on my site, and it seems thousands of people are downloading my UMP every month still, despite it being a decade old and the MPP having been created by other people since then (it is actually still using up GBs of bandwidth a month despite the download being less than a MB). And that is just from my site. I can't believe it is still going that strong. Most mods didn't do that well back whem Morrowind was still popular
User avatar
Ryan Lutz
 
Posts: 3465
Joined: Sun Sep 09, 2007 12:39 pm

Post » Wed Sep 01, 2010 11:47 pm

You could limit the amount of placeatme's used to just one by combining all statue parts into one nif. That way you could also make more parts, which would look more realistic.
User avatar
Britta Gronkowski
 
Posts: 3475
Joined: Mon Apr 09, 2007 3:14 pm

Post » Wed Sep 01, 2010 11:31 pm

You could limit the amount of placeatme's used to just one by combining all statue parts into one nif. That way you could also make more parts, which would look more realistic.


I was about to say that they wouldn't move around independently then, but I think I could make it so they could... So i guess I just need to decide which way I'd prefer it... Savegame bloat isn't really an issue. I just need to decide if I want the player to pick up all the pieces when they pick up one or not. Hmmm.... You have a point though. If i do make them shatter like I plan to then that could start to cause a bloat problem... I wonder how the game handles nifs with multiple independent parts... It might store each part like a seperate nif anyway... I might have to investigate
User avatar
Hussnein Amin
 
Posts: 3557
Joined: Sun Aug 05, 2007 2:15 am

Post » Wed Sep 01, 2010 9:32 pm

I was about to say that they wouldn't move around independently then, but I think I could make it so they could... So i guess I just need to decide which way I'd prefer it... Savegame bloat isn't really an issue. I just need to decide if I want the player to pick up all the pieces when they pick up one or not. Hmmm.... You have a point though. If i do make them shatter like I plan to then that could start to cause a bloat problem... I wonder how the game handles nifs with multiple independent parts... It might store each part like a seperate nif anyway... I might have to investigate


It won't store each part as separate item (just look at the skeleton creature when it's dead for example), but who wants to collect independent shattered pieces of an object? I think it would look much better if the statue shattered into something like ten different parts instead of just two - using placeatme 10x for just one object is most likely not a good idea.

The parts will move independently if each has their own collision property. Just make sure you check the 'linked' flag in the rigid body properties or else the collision of each part won't be affected by the collision of other parts.
User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm

Post » Wed Sep 01, 2010 3:12 pm

It won't store each part as separate item (just look at the skeleton creature when it's dead for example), but who wants to collect independent shattered pieces of an object? I think it would look much better if the statue shattered into something like ten different parts instead of just two - using placeatme 10x for just one object is most likely not a good idea.

The parts will move independently if each has their own collision property. Just make sure you check the 'linked' flag in the rigid body properties or else the collision of each part won't be affected by the collision of other parts.


Yes, it won't store it as a seperate item, but what I was wondering about is if it would cause just as much bloat because it could have to store extra position information about each part of the model anyway. The skeleton is all one model, but the game still needs to store where each bone is. That's what I meant I needed to investigate... how they are stored. If it causes bloat anyway then I could choose either option based on what works better for my needs.
User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Thu Sep 02, 2010 2:56 am

Some great minds in this thread, I'm expecting great things. :wink_smile:

Looking good so far! :thumbsup:
User avatar
Tanika O'Connell
 
Posts: 3412
Joined: Fri Jan 26, 2007 1:34 am

Post » Wed Sep 01, 2010 8:49 pm

I like this :D I tried to use sound too but it didn't really fit with my needs. I completed the force calculation script with Critterman and it worked very well, so you could indeed throw a bottle to pieces in the ceiling or shoot a watermelon with an arrow off of the skingrad bridge, so the arrow sticks, the melon falls to pieces and the arrow is still sticking in the piece it landed on the melon :D I haven't been working on this for a while since I lost everything in the summer(had meshes uploaded), but I think I could recreate it from scraps of scripts in old posts, so you can change how tough the material is (objects move with different acceleration according to their mass I think, can become a factor in some instances). In any case it's necessary anyway, I'm more than happy to help with something if it's welcome :)
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm


Return to IV - Oblivion