Determine distance to ground beneath a static object?

Post » Sat Nov 13, 2010 4:03 am

I'm using a script that randomly places static objects around the player, the static is a butterfly static.

Unfortunately statics don't have any physics so they don't fall to the ground, they need to be placed, bit like the floating Paintbrushes.

I use randompercent and some calculations to determine the x and y coordinates in relation to the Player and then currently just use 120 for Z to get height.

If the player is next to a hill or rock etc, the butterfly can sometimes be placed inside the hill (120 above players head), instead of on top of it.

I need to be able to tell where the ground is and then place the static about 200 or so above the ground level.

Is there anyway I can do this?
User avatar
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Fri Nov 12, 2010 10:41 pm

Dude.. umm lolwut? Why not just do it in the ESCS? It would be so much easier.
User avatar
Christina Trayler
 
Posts: 3434
Joined: Tue Nov 07, 2006 3:27 am

Post » Fri Nov 12, 2010 6:37 pm

Dude.. umm lolwut? Why not just do it in the ESCS? It would be so much easier.

No it needs to be dynamic placement, with the static moving from position to another randomly.

In my signature there is a mod L's More Butterflies and Fireflies, this mod is the one I'm trying to improve. It randomly places butterflies etc around the players cell and they shift positions every few seconds to make the world look more lively.

Currently to solve problem I use an NPC as a ref who is dropped into position randomly around the player and the butterfly is moved to this location; I do this so the NPC always falls to the ground or is placed on the ground so the butterfly will always be near the ground and not beneath it or high above it.

Using an NPC though is quite intensive and slows the game down slightly, depending on the machine. But without an NPC, it's much smoother and less intensive. But I can't get round the issue of how to place the static butterflies near the ground and not just at a height relative to the player.
User avatar
Epul Kedah
 
Posts: 3545
Joined: Tue Oct 09, 2007 3:35 am

Post » Sat Nov 13, 2010 3:48 am

OBSE v20 beta adds a GetTerrainHeight command.
It solves only half of your problem, as it does not detect rocks or other statics that may be around.
User avatar
Sierra Ritsuka
 
Posts: 3506
Joined: Mon Dec 11, 2006 7:56 am

Post » Fri Nov 12, 2010 8:32 pm

OBSE v20 beta adds a GetTerrainHeight command.
It solves only half of your problem, as it does not detect rocks or other statics that may be around.

Excellent, that might work ok, as there is bound to be clipping even when using an object with physics like an NPC, if they spawn next to a rock and the Butterfly just happens to spawn to the side where the rock is.

Is this available now? Or are we awaiting release? I have version 19 currently.
User avatar
RObert loVes MOmmy
 
Posts: 3432
Joined: Fri Dec 08, 2006 10:12 am

Post » Sat Nov 13, 2010 1:29 am

http://www.gamesas.com/index.php?/topic/1153305-beta-oblivion-script-extender-obse-v0020/.
It is a beta version, therefore not good for released mods, but you may play with it (and check for bugs) for the time being.
User avatar
Jose ordaz
 
Posts: 3552
Joined: Mon Aug 27, 2007 10:14 pm

Post » Sat Nov 13, 2010 5:37 am

I remember someone was working on a flying carpet or such and wanted a way to determine the current height above the ground. The idea was to drop a small transparent object with clutter collision, then keep checking the distance from the carpet to the clutter object until the distance stopped changing. That final distance was the distance from the carpet to the ground. I'm not sure the idea is applicable to your butterfly issue, just food for thought.
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am

Post » Sat Nov 13, 2010 4:15 am

This is pretty much what I do to place the plants on the ground in this old farming mod. (had forgotten about it) (http://www.youtube.com/watch?v=bw7wwQ22Ys8)
Items will only fall if the player is really close, so you need to use an actor instead (I use a scaled-way-down dog).
This works, if you can wait a few seconds until the creature reaches the ground.
if you are interested, the mod is http://www.tesnexus.com/downloads/file.php?id=20878. Get the file: "QQuix Conceptual - Realistic Farming V1a"

There is also a technique using the playing sound, but I am not familiar with the details.
User avatar
Jade Muggeridge
 
Posts: 3439
Joined: Mon Nov 20, 2006 6:51 pm


Return to IV - Oblivion