Community Forum

Function getDensityAtWorldPos

Forum Overview >> Scripting

CategoryScripting
Created20.11.2016 22:15


Bad Touch (Unknown) 20.11.2016 22:18
Hello,
I'm having an issue with the getDensityAtWorldPos() function. It is presenting a call stack error saying: "Warning (LUA): Function 'getDensityAtWorldPos' called with invalid number of arguments. 2 instead of 3."

I am passing it 3 valid variables (I checked with print statements), and also tried passing hard-coded values, and it still reports the same error.

Does anyone have any ideas on this odd behavior?

Thanks,
Alan

D. Ecker (Decker_MMIV) 21.11.2016 17:02
Looking through the LUADocs - Vehicle, Weeder - it seems like getDensityAtWorldPos needs to be called with 4 arguments;

getDensityAtWorldPos(g_currentMission.terrainDetailId, wx, wy, wz)

Depending on whatever your script does, it could be some other utility-method that call it, where you have not supplied the correct arguments to that utility-method?

Also maybe the https://gdn.giants-software.com/documentation_scripting.php?version=engine&category=19&function=282 is wrongly documented?

Bad Touch (Unknown) 21.11.2016 20:11
Decker,
Thanks so much for finding that. I was going by the documentation under Terrain Detail also, which only shows the 3 parameters. I tried adding the 4th, and voila, it works!

Much appreciated, and now I'm on to see what the next thing is that Giants changed/deleted.

Alan


Note: Log in to post. Create a new account here.