make pheromone visible for all aliens regardless of distance?

WyzcrakWyzcrak Pot Pie Aficionado Join Date: 2002-12-04 Member: 10447Forum Moderators, Constellation, NS2 Playtester, Squad Five Blue
I've created a pheromone with Pheromone.lua's CreatePheromone(...). It's a LargeThreatMarker.

How can I make that pheromone visible to all alien players regardless of distance or location, such that the pheromone's icon appears in the player's HUD and provides a waypoint on the ground no matter where that player is on the map when the pheromone is created?

Put another way: How do I override the distance at which the pheromone renders in the alien player's HUD?

Comments

  • WyzcrakWyzcrak Pot Pie Aficionado Join Date: 2002-12-04 Member: 10447Forum Moderators, Constellation, NS2 Playtester, Squad Five Blue
    I've tried overriding Pheromone's GetAppearDistance to return kMaxRelevancyDistance.

    function Pheromone:GetAppearDistance()
    return kMaxRelevancyDistance
    end

    This seems not to change the distance from which I can see the pheromone as a player, and I'm not sure what else to modify.

    My goal is to see the ThreatMarker pheromone, and its waypoint, from any location on the map.
  • WyzcrakWyzcrak Pot Pie Aficionado Join Date: 2002-12-04 Member: 10447Forum Moderators, Constellation, NS2 Playtester, Squad Five Blue
    I made the pheromone render regardless of distance by replacing GetMostRelevantPheromone in PlayerUI_GetOrderPath such that 300 is passed into GetEntitiesWithinRange when my mod needs the greater render distance.
    local function ReplacementGetMostRelevantPheromone(toOrigin)
        local pheromones = GetEntitiesWithinRange("Pheromone", toOrigin, modSpecificCondition and 300 or 100)
        local bestPheromone
        local bestDistSq = math.huge
        for p = 1, #pheromones do
        
            local currentPheromone = pheromones[p]
            local currentDistSq = currentPheromone:GetDistanceSquared(toOrigin)
    
            if currentDistSq < bestDistSq then
            
                bestDistSq = currentDistSq
                bestPheromone = currentPheromone
                
            end
            
        end
        
        return bestPheromone
    end
    
    ReplaceLocals( PlayerUI_GetOrderPath, { GetMostRelevantPheromone = ReplacementGetMostRelevantPheromone } )
    

    Many thanks to Dragon, McGlaspie, Samus, and Golden for their help in Discord. :)

    Note to self: the contents above of ReplacementGetMostRelevantPheromone were copied from build 279's GetMostRelevantPheromone in Player_Client.lua, so I might need to update my replacement method's contents to suit changes in future builds.
Sign In or Register to comment.