Announcement

Collapse
No announcement yet.

team gun

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    team gun

    im wondering if its possable to make a gun that when it takes the opponet down to 0 health it dosent kill him but instead unpossess him and places an AI controller in him nad puts the health back to full. and the AI controller needs to be on the same team as you and all its kills go towards your kills. and whats more i want this gun to be capable of working in DM. not just team DM. so it is even possable to make something be on a team in DM? (i kinda figure a change to the ai controller will be needed but im primaraly wondering about the guns capability of unpossessing someone and making a team in DM.)

    #2
    New bot controller:
    Code:
    class MyBot extends xBot;
    
    var Controller MyAllie;
    
    function ChangeEnemy(Pawn NewEnemy, bool bCanSeeNewEnemy)
    {
        if( NewEnemy.Controller == MyAllie )
            return;
        if( MyBot(NewEnemy.Controller) != None && MyBot(NewEnemy.Controller).MyAllie == MyAllie )
            return;
        Super.ChangeEnemy(NewEnemy,bCanSeeNewEnemy);
    }
    
    defaultproperties
    {
    
    }
    So if the new enemy it picks is you, it wont change it(hence not atk u) or if the new enemy's allie is you it doesnt change, making a team.

    Example:
    A has bots 123 in a team
    B has bots 456 in a team

    123 will not atk you or eachother cuz they have a common Allie, only atking B or its bots.

    Set the MyAllie in the new controller when its spawned.

    instead of preventing a death of the pawn at 0, have a check:
    if( P.Health - MaxDamage <= 0 ) // InstantFire
    {
    Unposses here and do stuff lol
    return; // put this if in a spot BEFORE dealing dmg
    }

    if( P.Health - Damage <= 0 ) // projectile
    {
    Unposses here and do stuff lol
    return; // put this if in a spot BEFORE dealing dmg
    }

    Comment


      #3
      oh wow thanks but what about the kills the bots on my team deal. can i make it count towards me?

      Comment


        #4
        hmm with rpg ive seen it down ill look at it

        Comment


          #5
          Well the way rpg does it is it prevents the killed persons death, then placing a marker the peson to tell hp and stuff to overide the killer so the bot itself doesnt get it.

          GameRules:
          Code:
          class MyRules extends GameRules;
          
          function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
          {
              if (MyBot(Killer) != None && MyBot(Killer).MyAllie != None)
              {
                  M = spawn(class'MyBotKillMarker', Killed);
                  M.Killer = MyBot(Killer).MyAllie ;
                  M.Health = Killed.Health;
                  M.DamageType = DamageType;
                  M.HitLocation = HitLocation;
                  return true;
              }
          }
          Add the Rules:
          Code:
          class MyMut extends Mutator;
          
          function PostBeginPlay()
          {
              local GameRules G;
              G = Spawn'MyRules';
              if (Level.Game.GameRulesModifiers != None)
                  G.NextGameRules = Level.Game.GameRulesModifiers;
              Level.Game.GameRulesModifiers = G;
              Super.PostBeginPlay();
          }
          Your Marker as so:
          Code:
          class MyBotKillMarker extends Inventory;
          
          var Controller Killer;
          var int Health;
          var class<DamageType> DamageType;
          var vector HitLocation;
          
          function DropFrom(vector StartLocation)
          {
              Destroy();
          }
          
          function Tick(float deltaTime)
          {
              local Pawn P;
          
              P = Pawn(Owner);
              if (P != None)
              {
                  P.LastHitBy = None;
                  P.Health = Health;
                  P.Died(Killer, DamageType, HitLocation);
              }
          
              Destroy();
          }
          
          defaultproperties
          {
              RemoteRole=0
          }
          Little long but effective!

          Comment


            #6
            --edit--
            hmm it says there is no ChangeEnemy in the xBot class. imma try it without the super.

            hmm the MyMut says "Error, Bad or missing expression in '='" it seems it has a problem with setting G = Spawn'MyRules'; im not sure why but im thinking it wants a value or maybe its the spawn.

            wee third edit...
            ok i got it to compile. i had to change local gamerules to local MyRules
            and in gametype i had to add a local MyBotKillMarker M to make it work with the M's but it compiles now. i still dont know if it works and cant test till tuesday when i get my unreal disk back. then i will see if it works in practice.

            Comment


              #7
              hmm well the teamates dont shoot eachother only problem is, just stand there not shooting eachother.

              i think they shoot others but when two of the same team come in contact with each other they stand there pointing a gun at the other, then putting it down, then pointing it again. its realy kinda sad to watch. how do i make them disengage from one another too. it seems they know not to shoot eachother but they dont know to disengage and go after someone else.

              Comment


                #8
                **** i totally forgot i need to tell em to find another ememy ill look at that

                Comment


                  #9
                  This is one awesome idea! I'd love to see it work.

                  Comment


                    #10
                    ok put /* and */ around my thing and try,
                    Code:
                    function bool SameTeamAs(Controller C)
                    {
                        if( C == MyAllie )
                            return true;
                        if( MyBot(C) != None && MyBot(C).MyAllie == MyAllie )
                            return true;
                        return false;
                    }
                    that might work

                    Comment


                      #11
                      well they still stand there not shooting each other. they group around a single pickup and do nothing. if a pickup never goes away does an ai never leave?
                      they still die but they seem to spawn with the controller. i have this part here:

                      Code:
                      simulated function ProcessTouch( actor Other, vector HitLocation ) {
                      	local pawn p;
                      	local Controller oldpawn;
                      	if ( Pawn(Other) != None && (Other != Instigator)) {
                      		p = Pawn(Other);
                      		oldpawn = p.controller;
                      	}
                      	if( P.Health - DamageMax <= 0 ) // InstantFire
                      	{
                      		p.controller.UnPossess();
                      		p.controllerclass= class'AssimilationGun.mybot';
                      		
                      	return; // put this if in a spot BEFORE dealing dmg
                      	}
                      }
                      they still die and not unpossess. i wasent sure where to put he code u said so i put it in a process touch for when the projectile touches them. was i mistaken?

                      Comment


                        #12
                        well the thing is they dont have a target and arnt told to find another

                        Comment


                          #13
                          shouldnt they start wondering around aimlessly? but i guess they are running out of targets...however what i want is the one i killed should not die but stay there and then the old controller should respawn. this way i never run out of people to kill. whats happening is the people are dieing and respawning with the new controller. so untill they die, no one with a non-team controller will spawn. so i run around just killing team mates for no reason.

                          Comment


                            #14
                            OHhh! you need to set this, after unpossessing or before im not exactly sure, do:
                            C.GotoState('Dead');

                            Comment

                            Working...
                            X