1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Function Parameter: Missing Variable Type

Discussion in 'Ask a Coder' started by [FU2]SpawnKiller, Sep 14, 2003.

  1. [FU2]SpawnKiller

    [FU2]SpawnKiller New Member

    Joined:
    Sep 13, 2003
    Messages:
    26
    Likes Received:
    0
    This is what I have so far it is giving me error in line 173

    function bool ((Shot (Pawn Killer, Pawn Killed)) && (Decapitated (Pawn Killer, Pawn Killed)))

    This is line 173 I left out some line above the Variables

    Function Parameter: Missing Variable Type

    Can Someone point out to me where it is???

    Thanks if you need the rest of my files please email or PM me and I will send them to you directly.

    THANKS for the help



    Code:
    var bool 			 Initialized;
    var bool			 bTG;
    var() config bool    ActivateSpawnProtect;
    var() config int     MaximumProtectionTime;
    var() config int     MinimumProtectionTime;
    const          		 UltimateSpawnProtection 	= 1;
    const          		 Revison   	= 01;
    const    			 RefreshInterval 	= 1;
    const                NumPunishments = 10;
    var(UltimateSpawnProtection) config int PunishmentType;
    var                  Pawn LastKiller, LastVictim;
    var bool             bTargetShot;
    var bool             bTargetDecapitated;
    var localized string PunishTypeChanged, RandomString, NoneString, KillString, TypeString, HelpString;
    var                  Pawn SpawnShooters[5];
    
    ////////////////////////////////////////////////////////////////////////////////
    //
    // Advertisement
    //
    ////////////////////////////////////////////////////////////////////////////////
    
    function PostBeginPlay()
    {
    	if (Initialized)
    		return;
    	Initialized = True;
    	Level.Game.RegisterDamageMutator( Self );
    	SetTimer(RefreshInterval,true);
    	log( "***SpawnProtection***");
    	log( "***[FU2]SpawnKiller***");
    	log( "***spawnkiller@1ultimatesnipingzone.com***");
    	log( "***  Version is " $ SpawnProtection $ "." $Revison);
    	log( "***  SpawnProtection is now Operational");
    	bTG =  Level.Game.bTeamGame;
    	Spawn(class'SniperRifleNotify');
    }
    
    
    ////////////////////////////////////////////////////////////////////////////////
    //
    // Register a the player
    //
    ////////////////////////////////////////////////////////////////////////////////
    
    function ModifyPlayer(Pawn Other)
    {
    	local SpawnProtector I;
    
    	I = SpawnProtector(Other.FindInventoryType(class'SpawnProtector'));
    	if ( I != None )
    		I.Destroy();
    	if ( ActivateSpawnProtect )
    	{
    		I = Spawn( class'SpawnProtector', Other, 'SpawnProtect', Other.Location, Other.Rotation );
    		if ( I != None )
    		{
    			I.bHeldItem = True;
    			I.GiveTo(Other);
    			if ( MaximumProtectionTime > 0 )
    			I.Limit = MaximumProtectionTime * 8 + 9;
    			I.Count = MinimumProtectionTime * 8;
    			I.Activate();
    		}
    	}
    
    	Super.ModifyPlayer(Other);
    }
    
    
    ////////////////////////////////////////////////////////////////////////////////
    //
    //
    //
    //
    ////////////////////////////////////////////////////////////////////////////////
    
    function Mutate(string MutateString, PlayerPawn Sender)
    {
    	local string s;
    
    	if ( (Sender.bAdmin || Level.Netmode == NM_Standalone) && Left(MutateString, 8) ~= "SpawnShoot" ) {
    		s = Mid(MutateString, 9);
    		switch (Caps(s)) {
    		case "RANDOM":
    			PunishmentType = -2;
    			BroadcastMessage(PunishTypeChanged@RandomString);
    			break;
    		case "NOTHING":
    			PunishmentType = -1;
    			BroadcastMessage(PunishTypeChanged@NoneString);
    			break;
    		case "KILL":
    			PunishmentType = 0;
    			BroadcastMessage(PunishTypeChanged@KillString);
    			break;
    		default:
    			if ( int(s) > 0 && int(s) <= NumPunishments ) {
    				PunishmentType = int(s);
    				BroadcastMessage(PunishTypeChanged@TypeString$int(s));
    			}
    			else
    				Sender.ClientMessage(HelpString$NumPunishments);
    			break;
    		}
    		SaveConfig();
    	}
    
    	Super.Mutate(MutateString, Sender);
    }
    ////////////////////////////////////////////////////////////////////////////////
    //
    //
    //
    ////////////////////////////////////////////////////////////////////////////////
    
    function bool PreventDeath(Pawn Killed, Pawn Killer, name damageType, vector HitLocation)
    {
    	if ((!TargetShot(Killer, Killed)&&DamageType=='Shot')&&(!TargetDecapitated(Killer, Killed)&&DamageType=='Decapitated')&&Killed!=None&&Killer!=None&&Killed!=Killer)
         ////////////////////this is new line above have to work on rest of code
        {
    		LastKiller = Killer;
    		LastVictim = Killed;
    		SetTimer(0.01, False);
    		Killed.Health = Killed.default.Health;
    		Super.PreventDeath(Killed, Killer, DamageType, HitLocation);
    		return true;
    	}
    
    	return Super.PreventDeath(Killed, Killer, DamageType, HitLocation);
    }
    
    ////////////////////////////////////////////////////////////////////////////////
    //
    //
    //
    //
    ////////////////////////////////////////////////////////////////////////////////
    
    function bool ((Shot (Pawn Killer, Pawn Killed)) && (Decapitated (Pawn Killer, Pawn Killed)))
    {
    	local SniperRifle T, KillerTarget, KilledTarget;
    	local bool bKillerTargetShot;
    	local bool bKilledTargetShot;
    	local bool bKillerTargetDecapitated;
    	local bool bKilledTargetDecapitated;
    
    	ForEach AllActors(class'SniperRifle', T)
        {
    		if ( T.Instigator == Killer )
    			KillerTarget = T;
    		else if ( T.Instigator == Killed )
    			KilledTarget = T;
    		if ( KilledTarget != None && KillerTarget != None )
    			break;
    	}
    
    	bKillerTargetShot = KillerTarget != None && KillerTarget.Shot();
    	bKillerTargetShot = KilledTarget != None && KilledTarget.Shot();
    	bKilledTargetDecapitated = KillerTarget != None && KillerTarget.Decapitated();
    	bKilledTargetDecapitated = KilledTarget != None && KilledTarget.Decapitated();
    
        return ((bKilledTargetShot && (bKillerTargetShot || KillerTarget == None)) && (bKilledTargetDecapitated && (bKillerTargetDecapitated || KillerTarget == None)));
    }
    
    
    ////////////////////////////////////////////////////////////////////////////////
    //
    //
    //
    //
    ////////////////////////////////////////////////////////////////////////////////
    function Timer()
    {
    	PunishSpawnShooter(LastKiller, LastVictim);
    }
    
    function PunishSpawnShooter(Pawn SpawnShooter, Pawn Victim)
    {
    	BroadcastLocalizedMessage(class'SpawnKillMessage', 0, SpawnShooter.PlayerReplicationInfo, Victim.PlayerReplicationInfo);
    	RandomPunishment(SpawnShooter);
    }
    
    function RandomPunishment(Pawn SpawnShooter)
    {
    	local int Choice;
    	local Inventory Inv;
    
    	if ( PunishmentType < -1 )
    		Choice = Rand(NumPunishments);
    	else if ( PunishmentType == -1 )
    		return;	// no punishment, it just doesn't work
    	else
    		Choice = PunishmentType;
    
    	Switch (Choice) {
    	case 1:	// almost kill the SpawnShooter
    		SpawnShooter.Health = 1;
    		break;
    	case 2:	// detonate the SpawnShooter
    		SpawnShooter.Health = -1000;
    		Spawn(class'UT_SpriteBallExplosion',,,SpawnShooter.Location);
    		Spawn(class'UT_SpriteBallExplosion',,,SpawnShooter.Location + 0.7 * SpawnShooter.CollisionHeight * vect(0,0,1));
    		Spawn(class'UT_SpriteBallExplosion',,,SpawnShooter.Location - 0.7 * SpawnShooter.CollisionHeight * vect(0,0,1));
    		SpawnShooter.Died(SpawnShooter, 'Suicided', SpawnShooter.Location);
    		break;
    	case 3:	// slap the SpawnShooter around
    		Spawn(class'SlapDeath',SpawnShooter);
    		break;
    	case 4:
    		SpawnShooter.AddVelocity(vect(0,0,5000) + VRand() * 500);
    		break;
    	case 5:
    		Spawn(class'ThinDeath', SpawnShooter);
    		break;
    	case 6:	// smash him on the ground
    		Spawn(class'AntiGravDeath', SpawnShooter);
    		break;
    	case 7:
    		Spawn(class'DepressurizationDeath', SpawnShooter);
    		break;
    	case 8:	// no stuff for the SpawnShooter
    		For (Inv = SpawnShooter.Inventory; Inv != None; Inv = Inv.Inventory)
    			Inv.LifeSpan = FRand();
    		break;
    	case 9:
    		Spawn(class'RandomTeleport', SpawnShooter);
    		break;
    	default:
    		SpawnShooter.Health = -1000;
    		SpawnShooter.Died(SpawnShooter, 'Suicided', SpawnShooter.Location);
    		break;
    	}
    }
    
    defaultproperties
    {
        MaximumProtectionTime=8
        MinimumProtectionTime=8
        ActivateSpawnProtect=True
        PunishmentType=-2
        PunishTypeChanged="SpawnShooters: SpawnShoot punishment changed to:"
        RandomString="Random Punishment"
        NoneString="No Punishment"
        KillString="Kill SpawnShooter"
        TypeString="Punishment #"
        HelpString="Recognized types are Random, Kill, Nothing or a number between 1 and "
    }
    
     
  2. EvilDrWong

    EvilDrWong Every line of code elevates you

    Joined:
    Jun 16, 2001
    Messages:
    932
    Likes Received:
    0
    you might know something i dont... but im pretty darn sure that you define parameters as functions...
    Code:
    function bool ((Shot (Pawn Killer, Pawn Killed)) && (Decapitated (Pawn Killer, Pawn Killed)))
    
    Instead, do the Shot and Decapitated checks inside of the unnamed function

    edit: what i mean is... when you call the function, add those in... so if you were to name it DidTheGuyGetKilled() youd call it like this
    Code:
        DidTheGuyGetKilled(Shot(Killer, Killed) && Decapitated(Killer, Killed))
    
    where Shot() and Decapitated() return some sort of usable value that DidTheGuyGetKilled() takes in
     
    Last edited: Sep 14, 2003

Share This Page