Some water movement tag related criticism - Page 2

Some water movement tag related criticism

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

8611z
Posts: 169
Joined: 08 Jul 2015, 20:20

Re: Some water movement tag related criticism

Post by 8611z »

I understand that solution a would be a gadget, with lots of overhead, yes?
You can use Spring.XXX functions in unitscripts, too.
(If you need unitID as parameter, the unitID of the unit which runs the script is already stored in a variable named "unitID")
Something like

Code: Select all

script.Create()
  StartThread (waterCheck)
end

function waterCheck()
while (true) 
  local x,y,z = Spring.GetUnitPosition(unitID)
    groundHeight = Spring.GetGroundHeight(x,z)
    if groundHeight < 0 then --water always at y==0
     ...is on water...
     else
     ...on land...
Sleep (100)
end
setSFXoccupy() gets called when unit drives from "terrain type" to another. For example from land into water.
Make testscript and look what it outputs when you drive around.

Code: Select all

function script.setSFXoccupy (terrainType)
	Spring.Echo (terrainType)
end
UnitEnteredWater/UnitLeftWater would be gadget, yes.

I do not understand what you are doing with "hovers that can move underwater"...
Post Reply

Return to “Game Development”