Page 2 of 3

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

Posted: Fri 25 Nov , 2011 7:32 pm
by LegendaryAgent
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?

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

Posted: Fri 25 Nov , 2011 8:04 pm
by iZumo
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?

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

Posted: Fri 25 Nov , 2011 9:22 pm
by LegendaryAgent
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.

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

Posted: Fri 25 Nov , 2011 9:51 pm
by iZumo
Instigator of Inventory will be none. Use property Owner, which is the Pawn the inventory belongs to.

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

Posted: Fri 25 Nov , 2011 11:13 pm
by LegendaryAgent
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?

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

Posted: Fri 25 Nov , 2011 11:35 pm
by iZumo
Actually I forgot to mention that the Owner is the actual Pawn, the driver himself, not the vehicle.

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

Posted: Sat 26 Nov , 2011 12:42 am
by LegendaryAgent
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

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

Posted: Sat 26 Nov , 2011 12:57 am
by Azarael
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.

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

Posted: Sat 26 Nov , 2011 1:38 am
by iZumo
Just simply Pawn(Owner), forget vehicles.

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

Posted: Sat 26 Nov , 2011 1:59 am
by Azarael
Ah, yeah, rereading the first post I see he doesn't want the vehicle, just the pawn.