Ravenfield

Ravenfield

87 ratings
Flying spawnpoint example
   
Award
Favorite
Favorited
Unfavorite
Content Type: Vehicles
File Size
Posted
3.312 MB
31 May, 2022 @ 5:43am
1 Change Note ( view )

Subscribe to download
Flying spawnpoint example

Description
This is a lazy proof-of-concept vehicle that turns airplane into a moving spawnpoint.

select TRANSPORT PLANE in the vehicle slot and start the game.

when you or the bot is driving TRANSPORT PLANE, some soldiers will be spawned from the plane as Airborne Troopers.

You are also spawned from the plane, if you don't want that, simply add 'actor.isBot' if statement at line 19.


behaviour("vehiclespawnpoint")
function vehiclespawnpoint:Start()
self.vehicle = self.gameObject.GetComponent(Vehicle)
GameEvents.onActorSpawn.AddListener(self, "OnActorSpawn")
self.spawn=0
self.maxspawn=8
end

function vehiclespawnpoint:Update()
if self.spawn>0 then
self.spawn=self.spawn-Time.deltaTime*2
if self.spawn<0 then
self.spawn=0
end
end
end

function vehiclespawnpoint:OnActorSpawn(actor)
if not self.vehicle.isDead and not self.vehicle.isBurning and self.vehicle.altitude>15 and self.vehicle.hasDriver and actor.team==self.vehicle.driver.team and self.spawn<self.maxspawn then
local nodes=false

for i=1,#ActorManager.capturePoints do
if nodes==false and Vector3.distance(Vector3(self.vehicle.transform.position.x,0,self.vehicle.transform.position.z),Vector3(ActorManager.capturePoints.transform.position.x,0,ActorManager.capturePoints.transform.position.z))<300 then
nodes=true
end
end

if nodes==true then
self.spawn=self.spawn+1
actor.TeleportTo(self.targets.spawnpoint.transform.position,self.targets.spawnpoint.transform.rotation)

if actor.isBot then
local sqds={actor}
Squad.Create(sqds)
local atkpoint=1
for i = 2, #ActorManager.capturePoints do
if Vector3.Distance(self.vehicle.transform.position,ActorManager.capturePoints.transform.position) < Vector3.Distance(self.vehicle.transform.position,ActorManager.capturePoints[atkpoint].transform.position) then
atkpoint = i
end
end
actor.squad.AssignOrder(Order.Create(OrderType.Attack, ActorManager.capturePoints[atkpoint], ActorManager.capturePoints[atkpoint]))
end

end
end
end
33 Comments
Capt Wavey 6 Oct, 2023 @ 8:05pm 
Excellent work. Cheers
Hijong park  [author] 16 Feb, 2023 @ 11:22pm 
I have experimented such feature but scrapped as it created many AI issues.
usaMi 16 Feb, 2023 @ 10:42pm 
is it possible to make it into a mutator that reads and uses vehicle slots?
Real 30 Aug, 2022 @ 1:55pm 
Clever
Jima 27 Aug, 2022 @ 3:06pm 
really nice mod but would it be possible to also do it for the transport heli ? it would be more effective since it hover over capture points
kakaponya 18 Jun, 2022 @ 12:19pm 
i dont understand how is it works. When i choose a spawnpoint and see that plane i can choose him and spawn, but bots can. how is it works??
Stockphot 5 Jun, 2022 @ 3:27am 
@Gazzer I'm not sure about the disabling of the kill vehicle hud, but i think this ( https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2790584747 ) works for your second question
Hijong park  [author] 5 Jun, 2022 @ 3:21am 
not possible too
Gazzer 5 Jun, 2022 @ 3:14am 
would it be possible to make a mutator that makes bots unable to eject from a burning vehicle?
Hijong park  [author] 4 Jun, 2022 @ 7:44pm 
not possible because vehicle burning API is not available