Page 1 of 2 12 LastLast
Results 1 to 40 of 47
  1. #1
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default [Code] Simple Racing/path following AI + GameType

    oy

    heres a simple ai that will follow pathnodes.
    for a race, put a line of Race_PathNodes round your track, this bot will follow them round in the order you place them on your map.
    open the Race_Pathnode properties in the editor to set MaxSpeed for the car (for corners n that)

    everything in a zip download here
    just add this to DefaultEngine.ini
    [UnrealEd.EditorEngine]
    +EditPackages=UTGame
    +EditPackages=UTGameContent
    +EditPackages=TegRace

    RaceAIController and MobileVehicleRaceGame have been updated here, MaxSpeed doesnt work in the one in the zip :sorry
    RaceAIController.uc
    Code:
    class RaceAIController extends UDKBot;
    
    var array<Race_Pathnode> Waypoints;
    var int RaceNode; //declare it at the start so you can use it throughout the script
    var int CloseEnough;
    
    simulated function PostBeginPlay()
    {
    	local Race_PathNode Current;
    
    	super.PostBeginPlay();
    
        //add the pathnodes to the array
    	foreach WorldInfo.AllActors(class'Race_Pathnode',Current)
    		{
    			Waypoints.AddItem( Current );
    		}
    
    }
    
    simulated function Tick(float DeltaTime)
    {
       //use local as its only needed in this function
      local int Distance;
    
      super.Tick(DeltaTime);
    
    	Distance = VSize2D(Pawn.Location - Waypoints[RaceNode].Location);
    
    	if (Distance <= CloseEnough)
    		{
    			RaceNode++;
    		}
    
    		if (RaceNode >= Waypoints.Length)
    		{
    			RaceNode = 0;
    		}
    GoToState('Racing');
    }
    
    state Racing
    {
    Begin:
    
    if (Waypoints[RaceNode] != None)// make sure there is a pathnode to move to
    {
    //set the max speed
    SetMaxDesiredSpeed();
    //move to it
    MoveTo(Waypoints[RaceNode].Location);
    }
    }
    
    function SetMaxDesiredSpeed()
    {
           local Vehicle V;
           V = Vehicle(Pawn);
    
           if (V != None)
    	{
                 V.AirSpeed = Waypoints[RaceNode].MaxSpeed;
                 V.GroundSpeed = Waypoints[RaceNode].MaxSpeed;
            }
    }
    
    //also give closeenough some velue in default properties
    DefaultProperties
    {
    CloseEnough=600
    }
    Race_Pathnode.uc
    Code:
    class Race_Pathnode extends PathNode;
    
    var() int MaxSpeed;
    
    DefaultProperties
    {
       MaxSpeed=11000
    }
    there you are.
    Last edited by tegleg; 10-03-2011 at 05:52 AM.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  2. #2
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    allright heres some more stuff so you can use it.
    i cant get the mobile scorpion that epic provides to work with any ai, so this requires my mobile car
    it also uses the player controller from epics mobile vehicle example

    this game type will put you in a car and spawn bot cars at every Bot_SpawnPoint you place on your map.
    MobileVehicleRaceGame.uc
    Code:
     class MobileVehicleRaceGame extends SimpleGame;
    
    simulated function PostBeginPlay()
    {
              Super.PostBeginPlay();
    
              SpawnTheBots();
    }
    
    exec function SpawnTheBots()
    {
       local vector L;
       local Rotator R;
       local Bot_SpawnPoint S;
       local MobileCarPawn P;
       local RaceAIController C;
    
       //find all the Bot_SpawnPoints in the map and spawn the bots
       foreach WorldInfo.AllActors(class'Bot_SpawnPoint', S)
    	{
            L = S.Location;
            R = S.Rotation;
            //spawn the bot car pawn
            P = Spawn(class'MobileCarPawn',,,L, R);
    
            //spawn the controller and possess pawn
            C = Spawn(class'RaceAIController',,,L, R);
            C.Possess(P, false);
        }
    }
    
    //below here is almost a copy of MobileVehicleGameInfo from epic
    function RestartPlayer(Controller NewPlayer)
    {
    	local NavigationPoint StartSpot;
    	local int Idx;
    	local array<SequenceObject> Events;
    	local SeqEvent_PlayerSpawned SpawnedEvent;
    	local Vehicle Vehicle;
    
    	if (bRestartLevel && WorldInfo.NetMode!= NM_DedicatedServer && WorldInfo.NetMode!= NM_ListenServer)
    	{
    		return;
    	}
    
    	StartSpot = FindPlayerStart(NewPlayer, 255);
    
    	if (StartSpot == None)
    	{
    		if (NewPlayer.StartSpot != None)
    		{
    			StartSpot = NewPlayer.StartSpot;
    		}
    		else
    		{
    			return;
    		}
    	}
    
    	if (NewPlayer.Pawn == None)
    	{
    		NewPlayer.Pawn = Spawn(class'MobileVehiclePawn',,, StartSpot.Location, StartSpot.Rotation);
    	}
    
    	if (NewPlayer.Pawn == None)
    	{
    		NewPlayer.GotoState('Dead');
    
    		if (PlayerController(NewPlayer) != None)
    		{
    			PlayerController(NewPlayer).ClientGotoState('Dead', 'Begin');
    		}
    	}
    	else
    	{
    		NewPlayer.Pawn.SetAnchor(StartSpot);
    
    		if (PlayerController(NewPlayer) != None)
    		{
    			PlayerController(NewPlayer).TimeMargin = -0.1;
    			StartSpot.AnchoredPawn = None;
    		}
    
    		NewPlayer.Pawn.LastStartSpot = PlayerStart(StartSpot);
    		NewPlayer.Pawn.LastStartTime = WorldInfo.TimeSeconds;
    		NewPlayer.Possess(NewPlayer.Pawn, false);
    		NewPlayer.ClientSetRotation(NewPlayer.Pawn.Rotation, true);
    
    		SetPlayerDefaults(NewPlayer.Pawn);
    
    		if (WorldInfo.GetGameSequence() != None)
    		{
    			WorldInfo.GetGameSequence().FindSeqObjectsByClass(class'SeqEvent_PlayerSpawned', true, Events);
    
    			for (Idx = 0; Idx < Events.Length; Idx++)
    			{
    				SpawnedEvent = SeqEvent_PlayerSpawned(Events[Idx]);
    
    				if (SpawnedEvent != None && SpawnedEvent.CheckActivate(NewPlayer,NewPlayer))
    				{
    					SpawnedEvent.SpawnPoint = startSpot;
    					SpawnedEvent.PopulateLinkedVariableValues();
    				}
    			}
    		}
    
    		NewPlayer.Pawn.SetCollision(false, false, false);
    		Vehicle = Spawn(class'TegMobileVehicle_Escort_Content',,, StartSpot.Location, StartSpot.Rotation);
    
    		if (Vehicle != None)
    		{
    			Vehicle.TryToDrive(NewPlayer.Pawn);
    		}
    	}
    }
    
    defaultproperties
    {
    	HUDType=class'MobileVehicleHUD'
    	PlayerControllerClass=class'MobileVehiclePlayerController'
    }
    MobileCarPawn.uc
    Code:
     class MobileCarPawn extends TegMobileVehicle_Escort_Content
       placeable;
    
    simulated function PostBeginPlay()
    {
    	super.PostBeginPlay();
    }
    
    function bool DriverEnter(Pawn P);
    function DriverLeft();
    function bool FindAutoExit(Pawn ExitingDriver);
    function DriverRadiusDamage( float DamageAmount, float DamageRadius, Controller EventInstigator, class<DamageType> DamageType, float Momentum, vector HitLocation, Actor DamageCauser, optional float DamageFalloffExponent=1.f);
    simulated function bool DisableVehicle();
    simulated function EnableVehicle();
    simulated event StartDriving(Vehicle V);
    function AdjustDriverDamage(out int Damage, Controller InstigatedBy, Vector HitLocation, out Vector Momentum, class<DamageType> DamageType);
    function DriverDied(class<DamageType> DamageType);
    function NotifyDriverTakeHit(Controller InstigatedBy, vector HitLocation, int Damage, class<DamageType> DamageType, vector Momentum);
    function float GetDamageScaling()
    {
    	return Super(Pawn).GetDamageScaling();
    }
    
    
    function bool Died(Controller Killer, class<DamageType> DamageType, vector HitLocation)
    {
    	return Super(Pawn).Died(Killer, DamageType, HitLocation);
    }
    
    function bool AnySeatAvailable()
    {
    	return false;
    }
    
    function bool HasOccupiedTurret()
    {
    	return true;
    }
    
    simulated function Destroyed()
    {
    	Super(Pawn).Destroyed();
    }
    
    function bool IsDriverSeat(Vehicle TestSeatPawn)
    {
    	return true;
    }
    
    simulated function SetInputs(float InForward, float InStrafe, float InUp)
    {
    	Throttle = InForward;
    	Steering = InStrafe;
    	Rise = InUp;
    	//ClientMessage("Throttle:"@Throttle@" Steering:"@Steering@" Rise:"@Rise);
    }
    
    simulated event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    	Super(Pawn).TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
    }
    
    simulated function TakeRadiusDamage(Controller InstigatedBy, float BaseDamage, float DamageRadius, class<DamageType> DamageType, float Momentum, vector HurtOrigin, bool	 bFullDamage, Actor DamageCauser, optional float DamageFalloffExponent=1.f)
    {
    	Super(Pawn).TakeRadiusDamage(InstigatedBy, BaseDamage, DamageRadius, DamageType, Momentum, HurtOrigin, bFullDamage, DamageCauser, DamageFalloffExponent);
    }
    
    function PossessedBy(Controller C, bool bVehicleTransition)
    {
    	//ClientMessage("PossessedBy()  Controller ="@C);
    	Driver = self;
    	SetDriving(true);
    	Super.PossessedBy(C, bVehicleTransition);
    }
    
    simulated event Tick( float DeltaTime )
    {
    	//ClientMessage("CurrentState = "$GetStateName()$", Controller.State = "$Controller.GetStateName());
    	Super.Tick(DeltaTime);
    }
    
    defaultproperties
    {
    	bAttachDriver=false
    	bDriverIsVisible=false
    	InventoryManagerClass=class'MobileInventoryManager'
    }
    MobileInventoryManager.uc
    Code:
      class MobileInventoryManager extends InventoryManager;
    
    simulated function DiscardInventory()
    {
    	local Vehicle V;
    
    	if (Role == ROLE_Authority)
    	{
    		Super(InventoryManager).DiscardInventory();
    
    		V = Vehicle(Owner);
    		// HACK to fix ininite loop - Driver will = V for default player pawn!!
    		if (V != None && V.Driver != None && V.Driver.InvManager != None && V.Driver != V)
    		{
    			V.Driver.InvManager.DiscardInventory();
    		}
    	}
    }
    Bot_SpawnPoint.uc
    place these where you want the bots to spawn
    Code:
    //=============================================================================
    class Bot_SpawnPoint extends Actor
    	hidecategories(Lighting,LightColor,Force)
    	placeable;
    
    var	CylinderComponent		CylinderComponent;
    
    /** Normal editor sprite */
    var const transient SpriteComponent GoodSprite;
    /** Used to draw bad collision intersection in editor */
    var const transient SpriteComponent BadSprite;
    
    defaultproperties
    {
    	Begin Object Class=SpriteComponent Name=Sprite
    		Sprite=Texture2D'EditorResources.S_KVehFact'
    		HiddenGame=true
    		HiddenEditor=false
    		AlwaysLoadOnClient=False
    		AlwaysLoadOnServer=False
    	End Object
    	Components.Add(Sprite)
    	GoodSprite=Sprite
    
    	Begin Object Class=SpriteComponent Name=Sprite2
    		Sprite=Texture2D'EditorResources.Bad'
    		HiddenGame=true
    		HiddenEditor=true
    		AlwaysLoadOnClient=False
    		AlwaysLoadOnServer=False
    		Scale=0.25
    	End Object
    	Components.Add(Sprite2)
    	BadSprite=Sprite2
    
    	Begin Object Class=ArrowComponent Name=Arrow
    		ArrowColor=(R=150,G=200,B=255)
    		ArrowSize=1.5
    		bTreatAsASprite=True
    		HiddenGame=true
    		AlwaysLoadOnClient=False
    		AlwaysLoadOnServer=False
    	End Object
    	Components.Add(Arrow)
    
    	Begin Object Class=CylinderComponent Name=CollisionCylinder //LegacyClassName=NavigationPoint_NavigationPointCylinderComponent_Class
    		CollisionRadius=+0050.000000
    		CollisionHeight=+0050.000000
    	End Object
    	CollisionComponent=CollisionCylinder
    	CylinderComponent=CollisionCylinder
    	Components.Add(CollisionCylinder)
    
    
    	bCollideWhenPlacing=true
    
    	bCollideActors=false
    }
    let me know if you cant get it working.
    Last edited by tegleg; 10-03-2011 at 05:49 AM.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  3. #3

    Default

    Thanks a bunch Tegleg !!!
    That really helped me
    I want to kiss you

  4. #4
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    187

    Default

    Thanks thats really helpfull

    only one question to understand it right... means the "CloseEnough" in the RaceAIController the way from one waypoint to the next or is it the distance from where the ai choose the next waypoint ?

    sry if my english is bad

  5. #5
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    CloseEnough is the distance from the ai pawn to the waypoint its heading for.
    its so the pawn doesnt have to be exactly on the waypoint, it just has to be close enough.
    when it is close enough its destination is changed to the next waypoint in the list (array).
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  6. #6
    MSgt. Shooter Person
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    187

    Default

    ok thanks so much

  7. #7
    MSgt. Shooter Person
    Join Date
    Nov 2011
    Posts
    122

    Default

    Thanks Tegleg. Good work!

    But I have a question: Do you know if it is possible to use forces, impulses instead of MoveTo(Waypoints[RaceNode].Location); ?

  8. #8
    MSgt. Shooter Person
    Join Date
    Oct 2011
    Location
    Nashville, TN
    Posts
    130

    Default

    your good! For hire?

    We definitely could have used this code a few months ago when we were making a racing game for school project....
    Game Design Student - Full Sail University

  9. #9
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    @Racer1 yes it is possible, that actually sounds like it would be fun to watch

    @Nickadimos im in negotiations for what hopefully might be something good,
    but yes ill code something for money, make me an offer, what do you want?
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  10. #10
    MSgt. Shooter Person
    Join Date
    Nov 2011
    Posts
    122

    Default

    I was thinking in something like this: Instead of making the Ai to move toward a waipont node using forces, impluses or torque (I don't know which), make him follow another actor, and this actor would be using the moveto(waipontnode). This could probably make the AI driving more fun to watch.

    The only part that I don't know how to do is the force part. Do you have any idea of how to implement that?

  11. #11
    Redeemer
    Join Date
    Nov 2009
    Location
    Caracas
    Posts
    1,629
    Gamer IDs

    Gamertag: daimakupikoro PSN ID: lone_vampire

    Default

    thanks tegleg, very usefull !!!! thanks a lot ....
    http://vincenzoravo.vrs.com.ve http://www.slaughtermaze.com

    please don't fill my inbox with questions, ask in the forum, the answers will help you and others !!!

  12. #12
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    @racer1
    heres an example of adding forces to a vehicle
    http://forums.epicgames.com/threads/...hysics-Problem
    i imagine you would need some heavy vector maths going on to try and steer it towards its destination.
    good luck
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  13. #13
    MSgt. Shooter Person
    Join Date
    Nov 2011
    Posts
    122

    Default

    Thanks, but I tried using that code, changed that, tried and tried, but the car never moved. rssss

    Anyway, even using forces or MoveTo, we still need to make the wheels to spin based on the car velocity. Do you have any idea of how to do that?
    I also need to know how to break the AI car. Because I added a trace in front of it, to detect an obstacle. But I don't know how to break.

  14. #14
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    so you want a car moved by forces? thats how cars work anyway, the wheels are somewhat fake.
    what are you trying to do?

    try using airspeed and groundspeed for the brakes
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  15. #15
    MSgt. Shooter Person
    Join Date
    Nov 2011
    Posts
    122

    Default

    The moveTo function uses forces?

    the wheels are somewhat fake
    Well, I was thinking that with wheelled vehicles, the forces would be applied to wheel, and the rest would be moving with the wheels.
    Last edited by Racer1; 11-18-2011 at 04:38 PM.

  16. #16
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    no you would have to forget about moveto()
    instead you need a vector location where you want the bot to aim for instead of moveto.
    then tie your brain in knots figuring out the vector maths to add a force to the vehicle in the required direction.

    i was thinking more of a hovering or flying vehicle when you mentioned this.
    the wheels will spin from friction on the ground if you turn the barakes off (some defaultproperty).

    i dont know how exactly how the wheels work cos i havnt got the engine source.
    test ive done suggest there is a force applied to the body to make it move, taking variables from slipfactor and whatever to rotate the graphical representetion of the wheel to make it look as if its real,
    rather than taking the wheel object and calculating the forces from there.
    of course i could be totally wrong and would welcome an explination of how it actually works.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  17. #17

    Default

    Hey, im having a problem with this. Its more on my side then anything. Im trying to use this code for a mod for a game called Dungeon Defenders, and I cant seem to find a way to edit it..Basically what im trying to do it make the Retail made Bots/AI use this script instead of the ones that they come with..

  18. #18
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    @Fantasmagore
    probably best to contact someone from the Dungeon Defenders team, it might not be possible.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  19. #19
    MSgt. Shooter Person
    Join Date
    Mar 2012
    Location
    UK
    Posts
    129

    Default

    Hi tegleg this system is really good and has been a massive help for me but when I change the max speed to try tell the AI to slow down for corners it doesnt appear to do anything I have set it to 250 and it still seems to just go flat out everywhere. I am using an edited scorpion vehicle code.
    Thanks

  20. #20
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    @tegleg: What about using Route class..?

  21. #21
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    could be a possibility VendorX
    i long since stopped using this ai though, i wont be updating it any time soon.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  22. #22
    Iron Guard
    Join Date
    Nov 2009
    Location
    CA
    Posts
    528

    Default

    Hey Tegleg, can you explain what the inventory manager is doing here? -- I'm a bit lost on the 'hack' bit
    My website: http://www.dotvawxgames.com
    How I made my game: HERE

    What I am doing now: www.warmgungame.com

  23. #23
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    Hi there,
    is there any chance you can help me to add to this script the ability to the pawn to stop when a player or anoter pawn is in front of him ?

  24. #24
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    @ vawx
    the inventory manager is a way of making the default pawn a vehicle. its much less messing codewise than spawning a normal pawn and entering a vehicle.

    @lost1990
    Trace() or AllCollidingActors()
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  25. #25
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    Thanks i managed to do it with a different methode and it works but i'm stuck in something else actually i want the pawn to start with the closest pathnode to his location i have done this (in theorie it works but i just discover that the pawn location is always set to 0.0.0 and that's only in the PostBeginPlay function )

    simulated function PostBeginPlay()
    {
    local Race_PathNode Current;
    local int ini_Distance;
    local int real_distance;
    local int m;

    super.PostBeginPlay();


    `log(Pawn.Location @ "this is the pawn location");

    //add the pathnodes to the array
    foreach WorldInfo.AllActors(class'Race_Pathnode',Current)
    {
    Waypoints.AddItem( Current );
    }

    real_distance=999999;

    for(m = 0; m <= Waypoints.Length; m++)
    {
    `log("the iterative number is " @ m);

    ini_Distance = VSize2D(Pawn.Location - Waypoints[m].Location);
    if (ini_distance < real_distance)
    {
    `log(Waypoints[m].Location @ "this is the pathnode location");

    real_distance=ini_distance;
    RaceNode=m;


    }
    }

    }



    any ideas ?
    actually if you ever asked why i wanna do that it's pretty simple i wanna create a traffic system and different spawn points in every point spawn a pawn that should continue his way begining with the nearst pathnode to him .

  26. #26
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    you could try doing it after postbeginplay to give everything chance to initialise.
    Code:
    PostBeginPlay()
    {
    blahh...
    GetNearest();
    }
    
    function GetNearest()
    {
    ini_Distance = VSize2D(Pawn.Location...
    or another way is to give the spawn point a pathnode in the editor, then give that to the ai on spawn.
    Code:
    class spawnpoint...
    var() PathNode StartNode;
    //when you spawn the ai
    MyAI = spawn(the ai...);
    MyAI.StartNode = StartNode;
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  27. #27
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Posts
    38

    Default

    Actually it didn't work but i managed to get work with changing pawn.location by location i don't know how but it did work...
    i'm sorry if i ask a lot but i never programed for games before so i'm learning step by step
    so my question is i wanna the spawn point to random the vehicle that gonna be spawned.
    is there any known function for that ?
    Last edited by lost1990; 08-01-2012 at 05:50 AM.

  28. #28

    Default

    Hi can you give me a tutorial how to set this up i have race_nodes placed. But i dont know what to do after that besides spawn a car. Im assuming kismet is required but i dont know what to place and connect.

  29. #29
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    you can do it in kismet or code
    in code
    Spawn() the car, ai and a pawn. Possess() the pawn and DriverEnter() the car.
    in kismet
    UTActorFactoryAI - use this bot for the controller and whatever pawn you want
    then use an EnterVehicle node to put the pawn in the car

    the bot should start racing round soon as the level is loaded
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  30. #30
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    actually its a LOT more simple than that, just had a look at what i gave out

    all you have to do is place a Bot_SpawnPoint where you want the bot to spawn and thats it
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  31. #31

    Default

    Ya im new to this but my brother knows how to model so i figured id learn to develop and you gotta learn from somewhere. Now you said i could enter code where would i enter it at?

  32. #32

    Default

    Also it would help if you could post a picture of the kismet. Im better at seeing pictures and not words

  33. #33
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    theres no kismet involved

    in the content browser, click the actors tab, find Bot_SpawnPoint and drag it onto your map
    each one placed on the map will spawn a bot in a car and it will start racing at level start

    and make sure its using this gametype in world properties found in the main menu
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  34. #34

    Default

    Ok thanks turned out it was not on the right gametype. Now down to my last problem how do i change my car model and give all the other cars "Their own models" Also can you change the code a little bit so the car does not start off moving?
    Last edited by zbzbz; 01-03-2013 at 10:42 PM.

  35. #35
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    Quote Originally Posted by zbzbz View Post
    how do i change my car model
    try searching for geodav tutorials

    Quote Originally Posted by zbzbz View Post
    can you change the code a little bit so the car does not start off moving?
    no
    thats up to you
    if i were to code everything that people might want i would have no time for anything else.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  36. #36

    Default

    Well can you atleast give me a website that teaches coding?

  37. #37
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  38. #38

    Default

    Well im looking at the code in your scripts for a good start and i just ordered some books on coding. I noticed that this is for mobile. Will it still work with PC?

  39. #39
    Palace Guard
    Join Date
    Feb 2010
    Location
    Tegleg Records
    Posts
    3,612
    Gamer IDs

    Gamertag: tegleg digital

    Default

    yes it will work on pc
    at the time i made this mobile and pc were 2 seperate things in udk (2 editors), nowadays its all in 1.

    glad you found some books, make sure they are not out of date or it will confuse you more.Angel_Mapper (rachel something) has a good up to date book on unreal script.
    Code:
    We.spazmodicaly.simulate.new.sound.with.technical.equipment.that.is.specificaly.manufactured.for.humans.to.communicate.in.outer.space.Tegleg.manipulates.time.and.space.to.create.new.experiences.to.generate.a.hardcore.database.generation.
    Please ask questions in the forum, NOT a private message
    tegleg.co.uk
    My Tutorials n Stuff
    Games: Tegs Playground - Unwheel2 - VCTF Game - Sponic Mesh 3D - Shh.. dont tell anyone about my android apps.
    will code for money

  40. #40

    Default

    http://www.packtpub.com/unreal-devel...ers-guide/book

    Thats one i ordered right now im trying to your cars to try to pass each other or avoid so they stop hiting each other. Also i made my track and put down all the nodes but it looks like the bot drivers are lagging and teleporting.
    Last edited by zbzbz; 01-04-2013 at 03:36 PM.


 
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.