Aller au contenu

Photo

CreateObject and terrain height (z axis)


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
acomputerdood

acomputerdood
  • Members
  • 219 messages
so, i've got a script and all it does is read from a mysql database for parameters to a CreateObject function each heartbeat.  i use a webform to populate this mysql db with creatures and other placeables.

the in-game function is very dumb - it relies upon the webform completely for the appropriate parameters to CreateObject (including the location vector).

the problem i've run into is this:  i don't know how to handle the z axis.  x and y are easy, since i've dumped the minimaps from the module and can calculate them from the mouse clicks on the bitmap.  but i don't have a way of figuring out the z axis, so i've just been using 0.

that worked fine for awhile, until i tried to spawn something on a hill.  actually, a creature object was still fine, since they kind of "fly" in from the sky and land on whatever hill is at the x,y location.

placeables, however, are a problem.  they are still spawned at 0 on the z axis, which means they're now inside the hills and whatnot.


now for the question:  is there a way to get my desired action?  that placeables show up on the "ground" of whatever x,y vector i give them?  can they just "fall down" and land on whatever z axis is there?  is there a way to calculate (in game) what the z axis of the ground will be?  or perhaps an even more clever solution?


thanks guys :)

#2
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
This one's been asked before. Do a search, you'll find both a nwnx solution and a vanilla nwn solution. If not, let us know, and I can link you when I have more time.

Funky

#3
acomputerdood

acomputerdood
  • Members
  • 219 messages
my apologies, but my forum searching skills must be sub-par. i was unable to find anything related. :/

#4
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
The vanilla creation method involves spawning in an invisible creature, and using it to find the z point of the ground at that x/y point. You'd need to delay the placeable creation a tiny bit to allow for the creature to "settle" to ground level. Without NWNX that's the only method of accurately finding Z.

#5
acomputerdood

acomputerdood
  • Members
  • 219 messages
oh very clever! i was so close to figuring it out when i saw that creatures worked fine. i don't think i would have made that last step, though.