diff options
| author | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2015-12-28 22:43:36 -0500 |
|---|---|---|
| committer | Alexander Pickering <Alexander.Pickering@anondomain.site90.net> | 2015-12-28 22:43:36 -0500 |
| commit | 789be4eda3dcac19eb9fe3a290b3283529277c9d (patch) | |
| tree | f135b7de8704dbc04472febfdea8d008971cb624 /gamemode/npcsystem/npcs/bird.lua | |
| parent | 5c4ebc932d8c02522802c842d43d863d89aca162 (diff) | |
| download | wintersurvival2-789be4eda3dcac19eb9fe3a290b3283529277c9d.tar.gz wintersurvival2-789be4eda3dcac19eb9fe3a290b3283529277c9d.tar.bz2 wintersurvival2-789be4eda3dcac19eb9fe3a290b3283529277c9d.zip | |
Updated to current
Diffstat (limited to 'gamemode/npcsystem/npcs/bird.lua')
| -rw-r--r-- | gamemode/npcsystem/npcs/bird.lua | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gamemode/npcsystem/npcs/bird.lua b/gamemode/npcsystem/npcs/bird.lua index d5cd1e0..b1702d0 100644 --- a/gamemode/npcsystem/npcs/bird.lua +++ b/gamemode/npcsystem/npcs/bird.lua @@ -35,28 +35,34 @@ end function NPC:Behave()
print("Going into bird's custom behaviour")
while ( true ) do
- self:StartActivity( ACT_FLY ) -- walk anims
+ self:StartActivity( ACT_IDLE ) -- walk anims
self.loco:SetDesiredSpeed( 100 ) -- walk speeds
self:MoveToPos( self:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 200 ) -- walk to a random place within about 200 units (yielding)
- self:StartActivity( ACT_IDLE ) -- revert to idle activity
+ -- revert to idle activity
self:PlaySequenceAndWait( "Idle01" ) -- Sit on the floor
--Check if there are any players nearby
local players = ents.FindByClass("Player")
for k,v in pairs(players) do
- print(k)
- print(v)
+ if(v:GetPos():Distance(self:GetPos()) < 300) then
+ self:StartActivity(ACT_FLY)
+ print("I should fly away")
+ self:SetSequence( "Fly01" )
+ local topos = self:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 1000
+ self:MoveToPos(topos)
+ print("Flying to (" .. topos.x .. "," .. topos.y .. "," .. topos.z .. ")")
+ end
end
--self:SetSequence( "sit_ground" ) -- Stay sitting
--coroutine.wait( self:PlayScene( "scenes/eli_lab/mo_gowithalyx01.vcd" ) ) -- play a scene and wait for it to finish before progressing
- self:PlaySequenceAndWait( "Fly01" ) -- Get up
+ -- Get up
-- find the furthest away hiding spot
- local pos = self:FindSpot( "random", { type = 'hiding', radius = 5000 } )
+ --local pos = self:FindSpot( "random", { type = 'hiding', radius = 5000 } )
-- if the position is valid
|
