Results 1 to 3 of 3

Thread: is there something wrong with GetNearbyTrees() ?

  1. #1
    Basic Member
    Join Date
    Mar 2013

    is there something wrong with GetNearbyTrees() ?

    I've had some trouble trying to get GetNearbyTrees working, since it tends to complain about the in pairs value as "a number value"
    I wrote print(tablenearbytrees) to see what values is that thing getting and it spat out some 0xc- type stuff (not at all like the GetNearbyCreeps/Heroes but that's probably since both of those are teambound)

    is there something I'm not getting on how to make this thing work?

    Here's the code I've put together to attempt on getting the damn thing working
    -- Get some of its values ( why does this not work )
    	local nCastRange = abilityForce:GetCastRange();
    	local nRadius = abilityForce:GetSpecialValueInt( "area_of_effect" );
    	If we're pushing a lane, find the nearest bunch of trees
    	if ( npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or
    		 npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or
    		 npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT )
    		 local tableNearbyTrees = npcBot:GetNearbyTrees ( nCastRange + nRadius );
    		 for _,nTree in pairs( tableNearbyTrees )
    			return BOT_ACTION_DESIRE_MODERATE, nTree:GetLocation();
    (to clarify, this piece of code is for Furion's Force of Nature)
    Last edited by Ace Deeds; 03-23-2017 at 10:32 AM.

  2. #2
    Basic Member
    Join Date
    Dec 2016
    GetNearbyTrees() returns a table of "integers" identifying all the trees. They are not handles to the trees like you try and use "nTree:GetLocation()". To get a tree's location you use: "GetTreeLocation( nTree )"

  3. #3
    Basic Member
    Join Date
    Mar 2013
    well that might explain a few things

    cheers, mate

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts