Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

DruidsRPGcvs.Summonifact


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
class Summonifact extends RPGArtifact
    abstract
    config(UT2004RPG);

var() Sound BrokenSound;
var class<Pawn> SummonItem;
var string FriendlyName;
var int Adrenaline;
var int Points;
var int StartHealth;

replication
{
    reliable if (Role == ROLE_Authority)
        Points, Adrenaline, FriendlyName;
}

static function bool ArtifactIsAllowed(GameInfo Game)
{
    return true;
}

function setup(String Name, class<Pawn> Item, int AdrenalineUsed, int PointsUsed, int InitialHealth)
{
    SummonItem = Item;
    Adrenaline = AdrenalineUsed;
    Points = PointsUsed;
    FriendlyName = Name;
    StartHealth = InitialHealth;
}

function BotConsider()
{
    if (bActive)
        return;

    if ( Instigator.Health + Instigator.ShieldStrength > 130 && Instigator.Controller.Enemy != None
         && Instigator.Controller.Adrenaline > rand(100) && NoArtifactsActive())
        Activate();
    return;     
}

function PostBeginPlay()
{
    Super.PostBeginPlay();

    disable('Tick'); //this artifact doesn't need ticks. It gets activated externally
}

// overridable functions for the different things that can be summoned
function bool SpawnIt(TransBeacon Beacon,Pawn P,EngineerPointsInv epi)
{
    return false;
}

function bool CanAirSummon()
{
    return false;
}

function bool isAvailable(LevelInfo level)
{
    return true;
}

function Activate()
{       
    local EngineerPointsInv Inv;
    Local TransLauncher tr;

    if (Instigator == None)
        return;
    Inv = EngineerPointsInv(Instigator.FindInventoryType(class'EngineerPointsInv'));
    if(Inv == None)
    {
        Inv = Instigator.spawn(class'EngineerPointsInv', Instigator,,, rot(0,0,0));
        if(Inv == None)
        {
            bActive = false;
            GotoState('');
            return; //get em next pass I guess?
        }

        Inv.giveTo(Instigator);
    }

    if (Instigator.Weapon == None || TransLauncher(Instigator.Weapon) == None)
    {
        Instigator.ReceiveLocalizedMessage(MessageClass, 2000, None, None, Class);
        bActive = false;
        GotoState('');
        return; //get em next pass I guess?
    }
    tr = TransLauncher(Instigator.Weapon);
    if (tr.TransBeacon == None)     // no beacon out, so can't spawn
    {
        Instigator.ReceiveLocalizedMessage(MessageClass, 3000, None, None, Class);
        bActive = false;
        GotoState('');
        return; //get em next pass I guess?
    }

    // let try to summon it. If it works, bring back the beacon.
    if (SpawnIt(tr.TransBeacon, Instigator, Inv))
    {
        // successfully summoned something
        tr.TransBeacon.Destroy();   
        tr.TransBeacon = None;
    }

}

function SetStartHealth(Vehicle NewItem)
{
    if (StartHealth > 0 && NewItem != None)
    {
        NewItem.Health = StartHealth;
        NewItem.HealthMax = StartHealth;
    }
    NewItem.SuperHealthMax = NewItem.HealthMax; // set to non-199 so can pickup later
}

function ApplyStatsToConstruction(Vehicle NewItem,Pawn Other)
{
    Local RPGStatsInv StatsInv;
    Local Inventory Inv;
    Local int x;


    if (NewItem == None)
        return;

    // and lets set the eject to be false. If you have the correct skill later, it can reset
    NewItem.bEjectDriver = False;

    for (Inv = Other.Controller.Inventory; Inv != None; Inv = Inv.Inventory)
    {
        StatsInv = RPGStatsInv(Inv);
        if (StatsInv != None)
            break;
    }
    if (StatsInv == None) //fallback, should never happen
        StatsInv = RPGStatsInv(Other.FindInventoryType(class'RPGStatsInv'));
    if (StatsInv != None)
    {
        for (x = 0; x < StatsInv.Data.Abilities.length; x++)
        {
            if(ClassIsChildOf(StatsInv.Data.Abilities[x], class'EngineerAbility'))
                class<EngineerAbility>(StatsInv.Data.Abilities[x]).static.ModifyConstruction(NewItem, StatsInv.Data.AbilityLevels[x]);
        }

        if (NewItem.Controller != None)
        {
            if (NewItem.Controller.Inventory == None)
                NewItem.Controller.Inventory = StatsInv;
            else
            {
                for (Inv = NewItem.Controller.Inventory; Inv.Inventory != None; Inv = Inv.Inventory)
                {}
                Inv.Inventory = StatsInv;
            }
        }
    }
}

static function string GetLocalString(optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2)
{
    if (Switch == 2000)
        return "You need to be using the Translocator for this artifact to operate";
    if (Switch == 3000)
        return "You need to have the Translocator beacon deployed to use this artifact";
    if (Switch == 4000)
        return "There is nothing to spawn the item on";
    return default.Adrenaline@"Adrenaline and"@default.Points@"points are required to use this artifact";
}

defaultproperties
{
    MinActivationTime=0.000001
    CostPerSec=1
    BrokenSound=Sound'PlayerSounds.NewGibs.RobotCrunch3'
    ItemName="Summoning Artifact"
    IconMaterial=Texture'UTRPGTextures.Icons.SummoningCharmIcon'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 3/11/2006 19:16:36.000 - Creation time: Wed 7/2/2007 19:16:53.437 - Created with UnCodeX