AI Recon Droids

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

AI Recon Droids

Post by Lagomorphia »

For the last hour I've been attempting to make a recon droid that is completely AI controlled; you deploy it and it flies around shooting hostiles without you having to control it, like an autoturret. I've managed to fix a bug with the game still treating it as a remote and thus crashing but now it just hangs in the air waiting to be shot.

If it makes any difference (which I doubt) a hero unit (AQT's Durge) is deploying them.

Also, how do you make the droids follow their deployer? I remember a Kashyyyk map I played once where a commander could deploy four infantry units and they followed him, so it can be done.
User avatar
PilotX
Private
Posts: 35
Joined: Thu Jun 17, 2010 10:58 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: California

Re: AI Recon Droids

Post by PilotX »

Doing something like this involves lua coding. Try this topic http://www.gametoast.com/forums/viewtop ... 47#p126047
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: AI Recon Droids

Post by DarthD.U.C.K. »

can you post the odf of your recondroid please?
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

Re: AI Recon Droids

Post by Lagomorphia »

Sorry, I was going to put that in the first post but forgot.

Droid Dispenser (cis_weap_inf_attackdroid)
Hidden/Spoiler:
[WeaponClass]
ClassLabel = "dispenser"

[Properties]
IconTexture = "HUD_com_probedroid_health_icon"

HUDTag = "com_weap_probedroid"
GeometryName = "com_weap_inf_grenadethermal_ord"
OrdnanceName = "cis_weap_inf_attackdroid_ord"

FireLoopSound = ""
ReloadSound = "com_weap_inf_equip_med"
ChargeSound = ""
ChargeSoundPitch = ""
ChangeModeSound = "com_weap_inf_equip_med"
WeaponChangeSound = "com_weap_inf_equip_med"
JumpSound = "com_weap_inf_pistol_mvt_jump"
LandSound = "com_weap_inf_pistol_mvt_land"
RollSound = "com_weap_inf_pistol_mvt_roll"
//ProneSound = "com_weap_inf_pistol_mvt_lie"
SquatSound = "com_weap_inf_pistol_mvt_squat"
//StandSound = "com_weap_inf_pistol_mvt_getup"

MuzzleFlash = "small_muzzle_flash"
Discharge = "small_smoke_effect"

RoundsPerClip = "1"
ReloadTime = "0.0"
LockOnRange = "80.0"
LockTime = "0.4"

ZoomMin = "0.0"
ZoomMax = "0.0"
ZoomRate = "0.0"

//AnimationBank = "grenade"
OffhandWeapon = 1

ShotDelay = "1.4"
MinSpread = "0.0"
MaxSpread = "0.0"
AutoAimSize = "1.0"

SalvoCount = "1"
SalvoDelay = "0.0"
InitialSalvoDelay = "0.3"

FireSound = "com_weap_inf_remotedroid_fire"
FireEmptySound = "com_weap_inf_ammo_empty"
Attack Droid (cis_weap_inf_attackdroid_ord)
Hidden/Spoiler:
[GameObjectClass]
ClassLabel = "droid"

[Properties]
PilotType = "self"

ExplosionName = "cis_weap_inf_remotedroid_exp1"
GeometryName = "com_weap_probedroid"
LODPriorityMod = "10.0"


WEAPONSECTION = 1
WeaponName = "cis_weap_inf_remotedroid_blaster"
PilotType = "self"

ImpactEffectWater = "com_sfx_watersplash_ord"

FLYERSECTION = "BODY"
VehicleType = "light"

PilotType = "self"

MapTexture = "troop_icon"
HealthTexture = "HUD_com_probedroid_health_icon"
MapScale = 1.0

MapViewMin = 50
MapViewMax = 50
MapSpeedMin = 0
MapSpeedMax = 100

CollisionScale = 10.0

MaxHealth = 100.0

SetAltitude = 2.0
GravityScale = 1.0//2
LiftSpring = 10.0 //10Lighter the veh the high the number
LiftDamp = 3.0

ScanningRange = 30.0
TransmitRange = 300.0

Acceleration = 25.0
Deceleration = 3.0
Traction = 22.0
ForwardSpeed = 3.5
ReverseSpeed = 3.5
StrafeSpeed = 0.25

SpinRate = 1.5
TurnRate = 1.5
TurnFilter = 5.0
PitchRate = 2.0
PitchFilter = 5.0
BankAngle = 0.0
BankFilter = 0

MoveTension = "30.0"//how much swim the craft has from the center of the screen

LevelSpring = 5.0
LevelDamp = 3.0

EyePointOffset = "0.0 0.5 0.0"
TrackOffset = "0.0 -0.25 1.8"
TiltValue = "5.0"

PitchLimits = "-50.0 50.0"
YawLimits = "-0.0 0.0"
AimerPitchLimits = "-90 90"
AimerYawLimits = "-90 90"

AISizeType = "SOLDIER"

AmbientSound = "remotedroid_engine_lp"
Ambient2Sound = "remotedroid_radio"
HurtSound = ""
DeathSound = ""

\\\\\\\\\\\\ Collision \\\\\\\\\\\\\\

BuildingCollision = "p_buildingsphere"
VehicleCollision = "p_buildingsphere"
OrdnanceCollision = "p_sphere"
SoldierCollision = "p_sphere"
User avatar
sim-al2
2nd Lieutenant
2nd Lieutenant
Posts: 412
Joined: Mon Jul 06, 2009 10:26 pm
Projects :: Mapping on occasion
Games I'm Playing :: SWBFII + MW4 + SC4
Location: In the cockpit of some vehicle...

Re: AI Recon Droids

Post by sim-al2 »

You've got three different different "pilottype="s. Try commenting out the second two and try it.
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

Re: AI Recon Droids

Post by Lagomorphia »

According to the thread where I found out about PilotType = Self it has to go under the weaponsections too.
User avatar
sim-al2
2nd Lieutenant
2nd Lieutenant
Posts: 412
Joined: Mon Jul 06, 2009 10:26 pm
Projects :: Mapping on occasion
Games I'm Playing :: SWBFII + MW4 + SC4
Location: In the cockpit of some vehicle...

Re: AI Recon Droids

Post by sim-al2 »

Turret sections do need that for sure, I'm not sure about weapon sections though... :|
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: AI Recon Droids

Post by DarthD.U.C.K. »

you only need one pilottype = self" line but that depends on if the droid is a unit or a moving turret/vehicle, if is a turret put it in the turretsection, if its a unit it shouldnt have a turretsection
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

Re: AI Recon Droids

Post by Lagomorphia »

I'll try using just one, but I think the first poster is probably right...

EDIT: Tried it, no change.
User avatar
Battleffront_Conquer
Master Sergeant
Master Sergeant
Posts: 160
Joined: Sat Apr 04, 2009 2:44 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: InDooRs

Re: AI Recon Droids

Post by Battleffront_Conquer »

THere is a way to spawn droids that can follow you, using the lua editing pilotx suggested is the only possible way to do this, it will work but you may find that if the droid is still alive you wont be able to spawn another until the original dies, though that might just be a setting that can be modified.
User avatar
Lagomorphia
Major
Major
Posts: 502
Joined: Sun Dec 13, 2009 10:02 am

Re: AI Recon Droids

Post by Lagomorphia »

I was reading through the script linked to in the first post, and have set up the required local team. However, I have no idea how to use the script. It looks like a simple matter of changing the right parts of the script. I've highlighted the parts I've changed in blue, and the parts I don't if I should change or what to to change to in red.

This is meant to spawn imp_inf_rifleman when imp_inf_stormofficer uses imp_weap_inf_spawntrooper.
Hidden/Spoiler:
TroopSpawnerWeapon = "imp_weap_inf_spawntrooper_ord"

OnCharacterDispenseControllableTeam(
function(character,controlled)
if GetEntityClass(controlled) == GetEntityClassPtr(TroopSpawnerWeapon) then
local SupportTeam = 3 --Team the new spawned character is in (change this)
local teamSize = GetTeamSize(SupportTeam)
for i = 0, teamSize-1 do
local characterIndex = GetTeamMember(SupportTeam, i)
local charUnit = GetCharacterUnit(characterIndex)
if not charUnit then
local destination = GetEntityMatrix(GetCharacterUnit(character))
SpawnCharacter(characterIndex,destination)
end
end
end
end,
IMP --User team (change this)
)
Post Reply