Freon mutator code  (Read 12772 times)

wife

  • Sr. Member
  • *
  • Posts: 148
  • Country: gb
Freon mutator code
« on: January 20, 2020, 20:11 »
---
« Last Edit: September 26, 2021, 14:50 by wife »
---

Piglet

  • 1337
  • *
  • Posts: 3251
  • Country: gb
Re: Freon mutator code
« Reply #1 on: January 20, 2020, 20:24 »
It's not code I've ever looked at. Hagis might know as he has contributed code to Freon too.

All the code is left on the package so it's there to read & suggest improvements

holyspam

  • 1337
  • *
  • Posts: 342
  • Country: gr
Re: Freon mutator code
« Reply #2 on: January 20, 2020, 20:30 »
Most of the pickup classes are removed or replaced when tam is initialised, but i can't recall which class this was.
It will probably be in one of the parent classes, like teamgamebase or teamarenamaster

hagis

  • 1337
  • *
  • Posts: 404
  • Country: gb
Re: Freon mutator code
« Reply #3 on: January 20, 2020, 21:40 »
it's been a (long) while when I looked at this,. in 3spn I think it uses some of the player start nodes or something to pick the places where the pickups will be - or I might be completely wrong,.

 I can say fo sure it's in 3psn as I remember looking at the code, the pickups are designed to be random though mostly they aren't as random as they might have been intended,. we had a thought to make the number of pickups configurable - didn't but it is possible

Piglet

  • 1337
  • *
  • Posts: 3251
  • Country: gb
Re: Freon mutator code
« Reply #4 on: January 20, 2020, 22:25 »
Code: [Select]
function SpawnRandomPickupBases()
{
    local float Score[3];
    local float eval;
    local NavigationPoint Best[3];
    local NavigationPoint N;

    for(N = Level.NavigationPointList; N != None; N = N.NextNavigationPoint)
    {
        if(InventorySpot(N) == None || InventorySpot(N).myPickupBase == None)
            continue;

        eval = FRand() * 5000.0;

        if(Best[0] != None)
            eval += VSize(Best[0].Location - N.Location) * (FRand() * 4.0 - 2.0);
        if(Best[1] != None)
            eval += VSize(Best[1].Location - N.Location) * (FRand() * 3.5 - 1.75);
        if(Best[2] != None)
            eval += VSize(Best[2].Location - N.Location) * (FRand() * 3.0 - 1.5);

        if(Best[0] == N)
            eval = 0;
        if(Best[1] == N)
            eval = 0;
        if(Best[2] == N)
            eval = 0;
           
        if(eval > Score[0])
        {
            Score[2] = Score[1];
            Score[1] = Score[0];
            Score[0] = eval;

            Best[2] = Best[1];
            Best[1] = Best[0];
            Best[0] = N;
        }
        else if(eval > Score[1])
        {
            Score[2] = Score[1];
            Score[1] = eval;

            Best[2] = Best[1];
            Best[1] = N;
        }
        else if(eval > Score[2])
        {
            Score[2] = eval;
            Best[2] = N;
        }
    }

    if(Best[0] != None)
    {
        Bases[0] = Spawn(class'Misc_PickupBase',,, Best[0].Location, Best[0].Rotation);
        Bases[0].MyMarker = InventorySpot(Best[0]);
    }
    if(Best[1] != None)
    {
        Bases[1] = Spawn(class'Misc_PickupBase',,, Best[1].Location, Best[1].Rotation);
        Bases[1].MyMarker = InventorySpot(Best[1]);
    }
    if(Best[2] != None)
    {
        Bases[2] = Spawn(class'Misc_PickupBase',,, Best[2].Location, Best[2].Rotation);
        Bases[2].MyMarker = InventorySpot(Best[2]);
    }
}