How to check if instigator of inventory is inside a vehicle

You need help? It's here!
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 » Fri 25 Nov , 2011 7:32 pm

Azarael wrote:Is "DrivenVehicle" actually intended to be a reference to the player's current mode of transport? Looking through the code I would have suggested that the purpose of it is to give kill credit when a player exits a vehicle and that vehicle later somehow kills a player. Note the past tense of "Driven".

If you're checking for a player in a weapon turret, cast ONSWeaponPawn(Instigator). If you're looking for a player in a driving seat, cast (Vehicle(Instigator) != None && ONSWeaponPawn(Instigator) == None).
drivenvehicle references even to weapon pawns and it can detects player properties in driving seat or weapon pawn turrets, however youre showing onsweaponpawn(instigator) as reference to player, thats not bad, but it still fails to get the information of the actual vehicle itself.
Im going to check its class and see if i can find something that references to owner vehicle

EDIT: ive seen a vehiclebase property of the onsweaponpawn, but the vehiclebase itself is set in unreliable if (role==Role_authority) -_- that means that it will fail to do the check on packet loss, right?

REEDIT: ONSVehicle or Vehicle(Instigator) returns false even when in driver seat, how is so?

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 » Fri 25 Nov , 2011 8:04 pm

Reliability or unreliability is mainly a concern when replicating functions. Variables from UScript are always received at some point, unreliability only means that if the replicated variable fails to transmit and is in the mean time updated, the old value is not send to the client, just the new one. Reliable in variables means that all values are sent to the client in the given order, that is if it fails to transmit and the variable is updated, it will send the old value first and then the new one.

The variable DrivenVehicle is there for checking driven vehicle on the client as all foreign controllers do not exist there. When leaving the vehicle, you'll be set as an instigator of it so you get your point if it kills someone.

Lastly, you're checking instigator of what?

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 » Fri 25 Nov , 2011 9:22 pm

Izumo_CZ wrote:Reliability or unreliability is mainly a concern when replicating functions. Variables from UScript are always received at some point, unreliability only means that if the replicated variable fails to transmit and is in the mean time updated, the old value is not send to the client, just the new one. Reliable in variables means that all values are sent to the client in the given order, that is if it fails to transmit and the variable is updated, it will send the old value first and then the new one.

The variable DrivenVehicle is there for checking driven vehicle on the client as all foreign controllers do not exist there. When leaving the vehicle, you'll be set as an instigator of it so you get your point if it kills someone.

Lastly, you're checking instigator of what?
Hello Izu :D thanks for your reply!
im checking instigator of an inventory class, i want to see if he is currently in a vehicle, as driver or as passenger (onsweaponpawn) or walking by foot, walking by foot is easy
its just if instigator.controller!=none

in vehicle i can use
instigator.drivenvehicle!=none, however this includes both driver and passenger seats, so no joy there

i must see if its a driver or of its a passenger because if it is a passenger, i want to change the location of an actor reference (which i already taken care of so nvm about this actor) to the vehicle that the pawn is currently in and NOT the current location of the instigator.drivenvehicle which might result in a onsweaponpawn location, this is the reason why i must detect the vehicle of the passenger seat the instigator is currently in.

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 » Fri 25 Nov , 2011 9:51 pm

Instigator of Inventory will be none. Use property Owner, which is the Pawn the inventory belongs to.

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 » Fri 25 Nov , 2011 11:13 pm

Izumo_CZ wrote:Instigator of Inventory will be none. Use property Owner, which is the Pawn the inventory belongs to.
ONSWeaponPawn(Owner).Driver is None, same applies to instigator :\

EDIT:

Code: Select all

local Controller TheOwner
else if(ONSWeaponPawn(Instigator.DrivenVehicle).Driver==Instigator)
{
TheOwner=ONSWeaponPawn(Instigator.DrivenVehicle).Driver.Controller
;

this is odd, it semms to be checking true in this case as passenger, but the var controller TheOwner still isnt getting information from the line below o.O

I forgot to mention Owner doesnt have drivenvehicle property, so how did u want me to use it izu?

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 » Fri 25 Nov , 2011 11:35 pm

Actually I forgot to mention that the Owner is the actual Pawn, the driver himself, not the vehicle.

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 12:42 am

Izumo_CZ wrote:Actually I forgot to mention that the Owner is the actual Pawn, the driver himself, not the vehicle.
can u give me an example on how to use it right then?
(ONSWeaponPawn(Owner)

doesnt work at all

ONSVehicle(Owner) & Vehicle(Owner) also doesnt work at all

User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

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

Post by Azarael » Sat 26 Nov , 2011 12:57 am

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.

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 1:38 am

Just simply Pawn(Owner), forget vehicles.

User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

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

Post by Azarael » Sat 26 Nov , 2011 1:59 am

Ah, yeah, rereading the first post I see he doesn't want the vehicle, just the pawn.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests