Simple lua function fix menu

User Tag List

Results 1 to 3 of 3
  1. #1
    Numba1stunna1's Avatar Active Member
    Reputation
    70
    Join Date
    Dec 2013
    Posts
    182
    Thanks G/R
    1/34
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple lua function fix

    Need a quick fix to a simple lua function. It's crashing my client and I need someone's help.
    Code:
    function GroundZ(object)
    	local oY,oX,oZ = ObjectPosition(object)
    	local intZ = oZ + 1
    	while TraceLine(oX,oY,oZ + 3 ,oX,oY,intZ) == nil do
    		intZ = intZ - 0.5
    	end
    	return intZ + 0.5
    end
    The idea is to find a Z coordinate closest to the ground of an object.TraceLine returns true if 2 points collide. When traceline returns true, it means intZ point is past the ground. Or, perhaps someone has a better way of determining the GROUND COORDINATES OF THE OBJECT'S X,Y. If that still doesn't make sense, imagine a flying object, and I want the coordinates of the ground BENEATH.

    Simple lua function fix
  2. #2
    Numba1stunna1's Avatar Active Member
    Reputation
    70
    Join Date
    Dec 2013
    Posts
    182
    Thanks G/R
    1/34
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Figured out out, no need for a while loop.

  3. #3
    cryptexx's Avatar Active Member
    Reputation
    20
    Join Date
    Sep 2016
    Posts
    35
    Thanks G/R
    3/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This could possibly work if the original position is not too far away from the bottom. A better solution would be to check if the original z is below or above the ground and then trying to get the nearest possible position with a loop, either by approaching the ground z position until a specific threshold (let‘s say a offset of 0.5 to the ground) or by looping so long that the original z switches its plane relative to the ground (lets say you started with a position that lays above the ground and you want to decrease the z coordinate until the z coordinate lays below the ground). I‘ve implemented a mixin of both of these approaches, my function approches the ground but it always ends up 0.1 above the ground even if the original z was initially below the ground. However, I cannot share any snippets unfortunately

Similar Threads

  1. Need help fixing some simple lua scripts :-)
    By kaato in forum WoW EMU Questions & Requests
    Replies: 7
    Last Post: 04-10-2009, 06:11 PM
  2. Replies: 22
    Last Post: 05-29-2008, 03:52 PM
  3. [Question] Lua functions
    By Lich King in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 04-10-2008, 07:39 PM
  4. [Request] I need this simple lua
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 02-29-2008, 03:18 PM
  5. Simple Lua Script , not working need help!
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 16
    Last Post: 12-30-2007, 02:06 PM
All times are GMT -5. The time now is 03:17 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search