How to check if instigator of inventory is inside a vehicle

You need help? It's here!
iZumo
Disappeared Administrator
Posts: 4196
Joined: Fri 19 Mar , 2010 1:21 am
Location: Earth
Contact:

Re: How to check if instigator of inventory is inside a vehi

Post by iZumo » Sat 26 Nov , 2011 2:10 am

Azarael wrote:The pawn is the physical driver. Find some way to relate the physical driver to the vehicle, although I'm not sure if there is such a link. Might have to call a function, if one exists.
In any case, while debating this the link is (both client and server side):

Code: Select all

Vehicle = Pawn.DrivenVehicle
Pawn = Vehicle.Driver

LegendaryAgent
Member
Posts: 80
Joined: Thu 29 Sep , 2011 12:26 am
Contact:

Re: How to check if instigator of inventory is inside a vehi

Post by LegendaryAgent » Sat 26 Nov , 2011 2:38 am

Azarael wrote:Ah, yeah, rereading the first post I see he doesn't want the vehicle, just the pawn.
no no im very sorry, i want to know the actual vehicle too, because i need to get the location of the vehicle and the controller pawn, to get the controller of the pawn apparently is as easy as instigator.drivenvehicle, it works like a charm on all seats so far, but i need to know the actual vehicle position, if i write setlocation(instigator.drivenvehicle.location) it wont work because it will be referencing some seat inside the vehicle rather than the actual location of the vehicle itself, thats why i must access the actual vehicle which the pawn is in to. Im sorry for making u guys confused by my poor english grammar, did u understand now?

LegendaryAgent
Member
Posts: 80
Joined: Thu 29 Sep , 2011 12:26 am
Contact:

Re: How to check if instigator of inventory is inside a vehi

Post by LegendaryAgent » Sat 26 Nov , 2011 2:41 am

Izumo_CZ wrote:
Azarael wrote:The pawn is the physical driver. Find some way to relate the physical driver to the vehicle, although I'm not sure if there is such a link. Might have to call a function, if one exists.
In any case, while debating this the link is (both client and server side):

Code: Select all

Vehicle = Pawn.DrivenVehicle 
Pawn = Vehicle.Driver

Pawn.DrivenVehicle will be referencing an ONSweaponPawn because that too is also a vehicle subclass, so that wont work i tried to get its location and it references to the current WeaponPawn the driver is in

EDIT: hold on i think i got something, ill edit this post

REEDIT: ah finally a solution, im glad epic decided set vehiclebase property in weaponpawn, if anyone is still curious on how to do it here is how i did, please disregard the messages, ive just made them to be sure that the pawn was detected properly:

Code: Select all

else if(Instigator.DrivenVehicle.Controller!=None) //this will be true if player is inside a vehicle, be it passenger or primary driver.
{
TheOwner=Instigator.DrivenVehicle.Controller; //this is just a variable which gets the instigator controller inside a vehicle be it as a passenger or driver vehicle, to access the pawn its as easy as typing theowner.pawn
if (ONSWeaponPawn(Instigator.DrivenVehicle).VehicleBase!=None) //this checks if the player is currently in a passenger seat and if that passenger seat has a vehicle, which pretty much should in all cases.
{
Loc=ONSWeaponPawn(Instigator.DrivenVehicle).VehicleBase.Location; //just a location i need, this gives the variable Loc the location of the primary vehicle of the weaponpawnturret
TheOwner.Pawn.ReceiveLocalizedMessage(Class'UnrealGame.StringMessagePlus',8,,,class); //i use this to send a message 8 which tells the player hes a passenger
}
else
{
Loc=Instigator.DrivenVehicle.Location; //just a location i need, this is easier, this simply gives the location of the vehicle the pawn is driving
TheOwner.Pawn.ReceiveLocalizedMessage(Class'UnrealGame.StringMessagePlus',7,,,class); // i use this to send a message 7 which tells the player hes the driver
}
}

Anyways guys thanks for ur help with info about this ^^

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests