How to make NPC drive without \"entity\" (Mafia 2)
you need a four door car, from the garage or from traffic,the presence of Henry and that he does not follow the GG.
-- 1, so the GG must get into the car, click on the script so that the NPC gets into the car
DelayBuffer:Insert(
function(l_1_0)
playerCar = game.game:GetActivePlayer():GetOwner()
-- game.entitywrapper:GetEntityByName( "Henry "):AnimStop()
game.entitywrapper:GetEntityByName( "Henry"):GetInOutCar( playerCar, 4, false, false)
end,{},1,1,false)
-- 2, GM must vacate driver's seat, click on script for GG to sit in the back seat
DelayBuffer:Insert(
function(l_1_0)
player = game.game:GetActivePlayer()
player:LockControls(true)
player:GetInOutCar( game.entitywrapper:GetEntityByName( "Henry"):GetOwner(), 3, false, false)
player:LockControls(false)
end,{},1,1,false)
-- 3, click on script to
NPC left the passenger seat
_ },1,1,false) -- 4, click on the script to make the NPC sit in the driver's seat DelayBuffer:Insert( function(l_1_0) playerCar = game.game:GetActivePlayer():GetOwner() game.entitywrapper:GetEntityByName( "Henry "):GetInOutCar( playerCar, 1, false, true) end,{},1,1,false)
-- 5, let's go!!!
DelayBuffer:Insert(
function(l_1_0)
driveCar = game.entitywrapper:GetEntityByName( "Henry"):GetOwner()
driveCar:DestroyController() driveCar:CreateController( "car_escaper") driveCar:InitializeAIParams( enums.CarAIProfile.NORMAL, 0)
driveCar :EscapeMode() drivePos = Math:newVector() drivePos:set( -1541.3704833984, -78.82649230957, -18.380180358887) -- location where NPC will go, "Alcohol Factory"
driveCar:MoveTo(drivePos, START)
end,{},1, 1,false)
-- 5, aggressive driving !!!
DelayBuffer:Insert(
function(l_1_0)
driveCar = game.entitywrapper:GetEntityByName( "Henry"):GetOwner()
driveCar:DestroyController() driveCar:CreateController( "car_escaper") driveCar:InitializeAIParams( enums.CarAIProfile.AGGRESSIVE, 0)
driveCar:EscapeMode() drivePos = Math:newVector() drivePos:set( -1541.3704833984, -78.82649230957, -18.38018035888888888888883) -- place where the NPC will go, "Alcohol plant"
driveCar:MoveTo(drivePos, START)
end,{},1,1,false)
5 Comments
J
JackSnow
12.03.22
-- 1, first, the GG must get into the car and then get out.
-- 2, the NPC will sit on any car that the GG has sat on.
DelayBuffer:Insert(
function(l_1_0)
V = game.entitywrapper
npc1 = V:GetEntityByName( "Henry") --
Henry.player = game.game:GetActivePlayer()
npc1:GetInOutCar(V:GetEntityByGUID( game.garage:GetPlayersCar( )), 1, false, false)
player:LockControls(true)
player:GetInOutCar(V:GetEntityByGUID( game.garage:GetPlayersCar()), 2, false, false)
player:LockControls(false)
end,{},1 ,1,false)