Spawning an item on inclined terrain?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
Ixnatifual

Spawning an item on inclined terrain?

Post by Ixnatifual »

I have a script that spawns an items in a terrain area affected by a heightmap. Unfortunately this means the item isn't very visible because it's partially "buried" into the incline. Only when walking into the square does the item pop out of the terrain.

Anyone found a clever general method to make items "float up" when spawning them on heightmapped terrain through a script?
Ixnatifual

Re: Spawning an item on inclined terrain?

Post by Ixnatifual »

I attempted to do it by spawning the item in the air, hoping it would then drop down to the ground on top of the incline instead of inside it.

Code: Select all

spawnedItem:setPosition(entity.x, entity.y, entity.facing, entity:getElevation() + 1, entity.level
Doesn't help, though. The item is still halfway buried in the ground... or completely buried if it's a small item. My current workaround is to only allow the item to spawn on flattened squares in the area.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Spawning an item on inclined terrain?

Post by Batty »

Did you try GameObject:setWorldPositionY(y)? You can make small intratile adjusments with it.

Something like rock_1:setWorldPositionY(.08) might do it. Although, it may popup above ground when you step on the tile...
Post Reply