legacy-hyperforce
10-05-2004, 10:39 AM
I'm trying to make a vehicle spawn offset for my Helix because its being summoned by a mutator but spawns and gets stuck in the ground.
The vehicle is pretty big and i'm not changing the position of my root bone because its on the right place.
the only thing i need to know is how i can go and make my vehicle spawn on an offset towards the vehicle factory (lets say 50-75 units higher in Z axis)
I'm refering a line (or multiple lines) of code offcourse.
its a plane by the way and its root bone is called attackcraft.
because otherwise it will spawn with its landing gear in the ground and won't move.
Help plz
Hsoolien
10-05-2004, 04:20 PM
You can adjsut the spwan offset in the factory that spawns it, if have to have it use a already in map factory, have the mut adjust the offset in the factory
legacy-hyperforce
10-06-2004, 01:16 AM
Originally posted by Hsoolien
You can adjsut the spwan offset in the factory that spawns it, if have to have it use a already in map factory, have the mut adjust the offset in the factory
Ok this is what i found out so far:
I've copyed the onsvehiclefactory and added a copy of it in my classes folder called onshelixvehiclefactory ( <- the name of the uc file).
this is the code:
look at the part between the lines(that's where i need to add some ammout of value to it (but what to add?)
//-----------------------------------------------------------
//
//-----------------------------------------------------------
class ONSHelixVehicleFactory extends SVehicleFactory
abstract
placeable;
var() float RespawnTime;
var float PreSpawnEffectTime;
var() bool bReverseBlueTeamDirection;
var bool bActive;
var bool bNeverActivate;
var bool bPreSpawn; // Neither the vehicle or build effect have been spawned yet
var class<Emitter> RedBuildEffectClass, BlueBuildEffectClass;
var Emitter BuildEffect;
var int TeamNum;
var Vehicle LastSpawned;
simulated event PostBeginPlay()
{
Super.PostBeginPlay();
if ( Level.NetMode != NM_DedicatedServer )
VehicleClass.static.StaticPrecache(Level);
}
simulated function UpdatePrecacheMaterials()
{
Level.AddPrecacheMaterial(Material'VMParticleTextu res.buildEffects.PC_buildBorderNew');
Level.AddPrecacheMaterial(Material'VMParticleTextu res.buildEffects.PC_buildStreaks');
VehicleClass.static.StaticPrecache(Level);
}
function PostNetBeginPlay()
{
local GameObjective O, Best;
local float BestDist, NewDist;
Super.PostNetBeginPlay();
if ( !bDeleteMe && !Level.Game.IsA('ONSOnslaughtGame') )
{
ForEach AllActors(class'GameObjective',O)
{
NewDist = VSize(Location - O.Location);
if ( (Best == None) || (NewDist < BestDist) )
{
Best = O;
BestDist = NewDist;
}
}
if ( Best != None )
Activate(Best.DefenderTeamIndex);
}
}
function Activate(byte T)
{
if (!bNeverActivate && (!bActive || TeamNum != T))
{
TeamNum = T;
bActive = True;
bPreSpawn = True;
Timer();
}
}
function Deactivate()
{
bActive = False;
}
event VehicleDestroyed(Vehicle V)
{
Super.VehicleDestroyed(V);
bPreSpawn = True;
SetTimer(RespawnTime - PreSpawnEffectTime, False);
}
//============================================
//============================================
//============================================
//============================================
function SpawnVehicle()
{
local Pawn P;
local bool bBlocked;
foreach CollidingActors(class'Pawn', P, VehicleClass.default.CollisionRadius * 1.25)
{
bBlocked = true;
if (PlayerController(P.Controller) != None)
PlayerController(P.Controller).ReceiveLocalizedMes sage(class'ONSOnslaughtMessage', 11);
}
if (bBlocked)
SetTimer(1, false); //try again later
else
{
if (bReverseBlueTeamDirection && ONSOnslaughtGame(Level.Game) != None && ((TeamNum == 1 && !ONSOnslaughtGame(Level.Game).bSidesAreSwitched) || (TeamNum == 0 && ONSOnslaughtGame(Level.Game).bSidesAreSwitched)))
LastSpawned = spawn(VehicleClass,,, location, Rotation + rot(0,32768,0);
else
LastSpawned = spawn(VehicleClass,,, location, Rotation,);
if (LastSpawned != None )
{
VehicleCount++;
LastSpawned.SetTeamNum(TeamNum);
LastSpawned.Event = Tag;
LastSpawned.ParentFactory = Self;
TriggerEvent(Event, Self, LastSpawned);
}
}
}
//============================================
//============================================
//============================================
//============================================
// General purpose check to make sure there aren't any pawns in the way
function bool ValidateSpawnLocation(float Radius)
{
local Pawn P;
foreach CollidingActors(class'Pawn', P, Radius)
return False;
return True;
}
function SpawnBuildEffect()
{
local rotator YawRot;
YawRot = Rotation;
YawRot.Roll = 0;
YawRot.Pitch = 0;
if (TeamNum == 0)
BuildEffect = spawn(RedBuildEffectClass,,, Location, YawRot);
else
BuildEffect = spawn(BlueBuildEffectClass,,, Location, YawRot);
}
function Timer()
{
if (bActive && Level.Game.bAllowVehicles && VehicleCount < MaxVehicleCount)
{
if (bPreSpawn)
{
bPreSpawn = False;
SpawnBuildEffect();
SetTimer(PreSpawnEffectTime, False);
}
else
SpawnVehicle();
}
}
// Onslaught doesn't use the trigger system
event Trigger( Actor Other, Pawn EventInstigator )
{
}
defaultproperties
{
RespawnTime=15.000000
PreSpawnEffectTime=2.000000
RedBuildEffectClass=Class'Onslaught.ONSVehicleBuil dEffect'
BlueBuildEffectClass=Class'Onslaught.ONSVehicleBui ldEffect'
DrawType=DT_Mesh
}
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.