Any mappers / scripters alive and/or active?

Feedback, discussion & bug reporting on current maps
DaveTheBlaze
Posts: 7
Joined: Sun 15. Mar 2020, 18:28
Description: CovidFreeMapper

Any mappers / scripters alive and/or active?

Post by DaveTheBlaze » Sun 22. Mar 2020, 22:45

Thanks for replying Crusha!
Crusha K. Rool wrote:
Sun 22. Mar 2020, 13:16
If you wanted to get it to work with regular VehicleFactories, you could have a script that takes care of spawning the UltimateRadarVehicleLRIs itself for the relevant vehicles. You would need to constantly iterate some list on basically every Tick to find relevant vehicles and also keep track of whether they already have an LRI.
As if I would be able to code something like that xD
I only know basic C++ stuff, not sufficient enough to code something like that.
Crusha K. Rool wrote:
Sun 22. Mar 2020, 13:16
If you are only interested in vehicles driven by players (since it's a racing mode), you could iterate through Level.ControllerList, check the Pawn of each controller and see if that is a vehicle or has a driven vehicle. That would seem better than iterating DynamicActors with a constraint on the Vehicle class, which could given even worse performance. You would then either need to hardcode the settings for the radar map texture, etc. or make them configurable in your actor for each vehicle class that is going to be used. If the vehicle associated with the LRI gets destroyed, the LRI will destroy itself shortly after (via the BaseChanged() event).
Is there an easy way to make it work properly? I don't have any idea where to start.
But the quote above means that if a player leaves a car, the car is no longer be tracked. Not a deal-breaker but it would be nice to have the cars tracked even without anyone driving it.
Crusha K. Rool wrote:
Sun 22. Mar 2020, 13:16
I could try to make it work better in a future release of UMTv2, but for now just overriding the initialization in a subclass seems the easiest way to go.
That would be awesome :).

So what do you think? Is scripting a new actor worth the hassle? Or should I rather try to make the TeamRadar Mutator working?
Since Corona I'm just bored, so I've got the time and energy to work on at least something ^^.
Are you up to help me out? Otherwise I'm probably lost and won't use the UltimateRadar at all.

User avatar
Crusha K. Rool
Posts: 112
Joined: Sun 28. Aug 2011, 23:14
Description: Coding Crocodile
Location: Germany

Any mappers / scripters alive and/or active?

Post by Crusha K. Rool » Tue 24. Mar 2020, 21:27

But the quote above means that if a player leaves a car, the car is no longer be tracked. Not a deal-breaker but it would be nice to have the cars tracked even without anyone driving it.
It would mean that it only gets tracked once someone enters it, but remain tracked after they leave it.

I could probably try to whip up some code to do it by next weekend and let you include it via MyLevel. I'd then include it into the official release in the future, but that might still be some time off. At some point I'll start uploading the current progress to Github and also use it to keep track of issues. But I need to clean up the package structure for that first.

DaveTheBlaze
Posts: 7
Joined: Sun 15. Mar 2020, 18:28
Description: CovidFreeMapper

Any mappers / scripters alive and/or active?

Post by DaveTheBlaze » Wed 25. Mar 2020, 17:47

Crusha K. Rool wrote:
Tue 24. Mar 2020, 21:27
It would mean that it only gets tracked once someone enters it, but remain tracked after they leave it.
ah ok I see :)
Well, better than nothing. But there is no way of tracking vehicles as well that weren't entered by a player before?
Because there are vehicles spread over the map which will be entered during the match (or not) but it would be nice to see where they are located on the map (e.g. Hellbenders, Raptors, Tanks, Scorps).
Crusha K. Rool wrote:
Tue 24. Mar 2020, 21:27
I could probably try to whip up some code to do it by next weekend and let you include it via MyLevel. I'd then include it into the official release in the future, but that might still be some time off. At some point I'll start uploading the current progress to Github and also use it to keep track of issues. But I need to clean up the package structure for that first.
wow thanks a lot, didn't think anyone would still improve code for a game that old :).
If you manage to improve the code in order for the tracking to work for any VehicleFactory you definitely earn my gratitude and a special thanks place on my map as well :).

User avatar
Crusha K. Rool
Posts: 112
Joined: Sun 28. Aug 2011, 23:14
Description: Coding Crocodile
Location: Germany

Any mappers / scripters alive and/or active?

Post by Crusha K. Rool » Tue 31. Mar 2020, 21:21

Here is some script code. I did not have time to actually test if it functionally works (let alone whether it requires special handling for network replication). I just made sure that it does not have any compile errors. You can use it in addition to the aforementioned subclass of the UltimateRadarMap actor. (I think you can/need to leave the Default Properties block away when adding it directly in UnrealEd.)

Code: Select all

//-----------------------------------------------------------------------------
// Ultimate Radar Map Dynamic Vehicle Tracker
// © 2020 by D. 'Crusha K. Rool' I.
//
// Workaround to enable vehicle tracking on the Ultimate Radar Map in scenarios
// where you can't use custom placed UltimateVehicleFactories.
// This approach has a lot of performance overhead and only starts tracking vehicles
// upon driving them, so using the factories is still preferable whenever possible.
//
// Place this actor in the map along with the UltimateRadarMap actor and configure
// in the list for which vehicle classes (including subclasses) you want to use
// which radar tracking.
//-----------------------------------------------------------------------------
class UltimateRadarMapDynamicVehicleTracker extends Info
    placeable
    DependsOn(UltimateRadarVehicleLRI);

struct _VehicleRadarProperties
{
  var() class<Vehicle>   VehicleClass;   // Vehicle class to which this tracking applies.
  var() bool   bRadarVisibleToDriver; // Should the vehicle be shown on the radar to it's driver?
  var() bool   bRadarNeutralWhenEmpty;// If true, the vehicle is drawn with white team color when it's left.
  var() bool   bRadarHideWhenEmpty;   // If true, the vehicle is not drawn when it's empty.

  var() UltimateRadarVehicleLRI.ERadarVehicleVisibility RadarVehicleVisibility;

  var() float  RadarOwnerUpdateTime; // How many seconds have to pass before the location of vehicle is updated for the owning team.
  var() float  RadarEnemyUpdateTime; // Same as above, just for enemies.
  var() bool   bRadarFadeWithOwnerUpdateTime; // If True, the icon on the radar map will interpolate between opaque and translucent as time passes between location updates on the radar.
  var() bool   bRadarFadeWithEnemyUpdateTime; // If False, the icon will always stay fully opaque.

  var() Material RadarTexture;       // This image will represent the vehicle on the Radar.
                                     // The texture shouldn't have any other colours than white and transparent, otherwise you will get an ugly dark square.
  var() float  RadarTextureScale;    // The image will be scaled by this factor.
  var() int    RadarTextureRotationOffset;
};

// Here you can define which vehicle classes will automatically get tracked on the radar and which properties the tracking uses.
var() array<_VehicleRadarProperties>  VehicleRadarPropertyList;

var array<Vehicle> CheckedVehicles;

simulated event Tick(float DeltaTime)
{
    local Controller C;
    local Vehicle V;

    for ( C = Level.ControllerList; C != none; C = C.nextController )
    {
        if ( Vehicle( C.Pawn ) != none )
        {
            V = Vehicle( C.Pawn );
        }
        else if ( C.Pawn != none && C.Pawn.DrivenVehicle != none )
        {
            V = C.Pawn.DrivenVehicle;
        }
        if ( V != none )
        {
            MaybeTrackVehicle( V );
        }
    }
}

function MaybeTrackVehicle( Vehicle V )
{
    local int i;
    local bool AlreadyTracked;
    local UltimateRadarVehicleLRI NewVehicleLRI;

    for ( i = 0; i < CheckedVehicles.Length; i++ )
    {
        if ( V == CheckedVehicles[ i ] )
        {
            AlreadyTracked = true;
            break;
        }
    }

    if ( !AlreadyTracked )
    {
        // Find the first properties set from the list that has a matching vehicle class.
        for ( i = 0; i < VehicleRadarPropertyList.Length; i++ )
        {
            if ( ClassIsChildOf( V.class, VehicleRadarPropertyList[ i ].VehicleClass ) )
            {
                break;
            }
        }

        // if i is not less than the length of the array, we didn't find a match.
        if ( i < VehicleRadarPropertyList.Length )
        {
            NewVehicleLRI = Spawn( class'UltimateRadarVehicleLRI' );

            NewVehicleLRI.TrackedVehicle = V;
            NewVehicleLRI.OldOwnerTeam = V.Team;
            NewVehicleLRI.RadarMaterial = VehicleRadarPropertyList[ i ].RadarTexture;
            NewVehicleLRI.RadarTextureScale = VehicleRadarPropertyList[ i ].RadarTextureScale;
            NewVehicleLRI.RadarTextureRotationOffset = VehicleRadarPropertyList[ i ].RadarTextureRotationOffset;
            NewVehicleLRI.RadarVehicleVisibility = VehicleRadarPropertyList[ i ].RadarVehicleVisibility;
            NewVehicleLRI.bRadarVisibleToDriver = VehicleRadarPropertyList[ i ].bRadarVisibleToDriver;
            NewVehicleLRI.bRadarNeutralWhenEmpty = VehicleRadarPropertyList[ i ].bRadarNeutralWhenEmpty;
            NewVehicleLRI.bRadarHideWhenEmpty = VehicleRadarPropertyList[ i ].bRadarHideWhenEmpty;
            NewVehicleLRI.RadarOwnerUpdateTime = VehicleRadarPropertyList[ i ].RadarOwnerUpdateTime;
            NewVehicleLRI.RadarEnemyUpdateTime = VehicleRadarPropertyList[ i ].RadarEnemyUpdateTime;
            NewVehicleLRI.bRadarFadeWithOwnerUpdateTime = VehicleRadarPropertyList[ i ].bRadarFadeWithOwnerUpdateTime;
            NewVehicleLRI.bRadarFadeWithEnemyUpdateTime = VehicleRadarPropertyList[ i ].bRadarFadeWithEnemyUpdateTime;
            NewVehicleLRI.SetBase( V );
        }
        CheckedVehicles[ CheckedVehicles.Length ] = V;
    }

}

DefaultProperties
{

}