
ModuleComp = (CR4HudModuleCompanion)hud.GetHudModule( "CompanionModule" ) ((CActor)ent).SetAttitude( thePlayer, AIA_Friendly ) // Just to make sure it's always friendly to usĮnt.AddTag( 'InPlayerParty' ) // add companion tag ((CActor)ent).SetTemporaryAttitudeGroup( 'player', AGP_Default ) // Put the NPC into same attitude group as player to share friendlies/enemies ((CActor)ent).ForceAIBehavior( l_aiTree, BTAP_AboveEmergency2) // Force the follower behavior tree onto the spawned NPC L_aiTree.OnCreated() // Once we're done initializing behavior tree L_aiTree = new CAIFollowSideBySideAction in ent // Initialize follower behavior Template = (CEntityTemplate)LoadResource("sword1h_super_hard") // Determine what we spawn, replace with any NPC template you wishĮnt = theGame.CreateEntity(template, pos, rot ) // This directly handles the spawning Rot = VecToRotation(thePlayer.GetWorldPosition() - pos) // Determine spawn rotation

Pos = thePlayer.GetWorldPosition() + VecRingRand(1.f,2.f) // Determine position for spawning the companion ModuleComp = (CR4HudModuleCompanion)hud.GetHudModule( "CompanionModule" ) //Find companion module Var ModuleComp : CR4HudModuleCompanion //For the companion module Var l_aiTree : CAIFollowSideBySideAction //For follower behavior

Var ent : CEntity //For spawning functionality Var rot : EulerAngles //For spawning functionality

Var pos : Vector //For spawning functionality Var template : CEntityTemplate //For spawning functionality Var hud : CR4ScriptedHud //For the companion module Exec function SimpleComp(optional wanthud : bool)
