Jump to content

Recommended Posts

Hi guys !

 

I'm currently searching for a solution, I'd like to check if there is a specific item in the vehicle inventory...

I use the addon "Hero survive" and I'm currently creating a script that allow to repair brokens car if you have the specifics items. But some of them like wheels and battery are to heavy for backpacks so... I'd like to check if the tyres etc are in the car inventory.

something like :

 


_vehicle = _this select 0;

_Wheels = {"herl_o_tyer" == _x} count ("InventoryOfCar" _vehicle); // Like (BackpackItems _player)
 

if (_wheels == 4) then {
blablabla car is repaired...} else {

blablabla wheels missing.... };

I have all the "blablabla" thing, I just need to know how to check the car inventory, I already know how to check if player has specific item in his vest/backpack/uniform... but for vehicle.... :/

Thanks.


 

Share this post


Link to post
Share on other sites

If the "herl_o_tyer" class exists and can be added in cargo of the car, try itemCargo :

{typeOf _x == "herl_o_tyer"} count itemCargo yourCar

  • Haha 1

Share this post


Link to post
Share on other sites
Just now, pierremgi said:

If the "herl_o_tyer" class exists and can be added in cargo of the car, try itemCargo :

{typeOf _x == "herl_o_tyer"} count itemCargo yourCar

 

Yeah I just find it 1 minute ago and it works haha, thanks by the way ;)

Next time I'll search more longer before posting something x)

Share this post


Link to post
Share on other sites

Ohh finaly I find thread younger then 4 months and to fit topic about my problem. Please if anyone can tell me how to check PLAYER inventory which will fire a trigger but when player is in the VEHICLE.

I figure out how to check when player walk in trigger area but how to check if player have desired item (for example-in backpack) but he is at driver seat of vehicle.

Situation: There is guarded gate and when unit aproach to gate it opens if player have card in inventory.

condition: player in thisList && ("herl_o_card_red" in items player);

on act: hint "welcome officer" ; gate animate ["Door_1_move", 1] ; 

on deact:  gate animate ["Door_1_move", 0] ; 

There is no point to exit vehicle to "show up" card in trriger area because when player enter vehicle again to move accros opened gate, the gate is closing again. (player kicked from trigg because he is in the vehicle again)

So my question is: Is there a way to force trigger to check through items of player who sitting in vehicle or maybe even better to DELAY animate closing the gate for some time while player come back to vehicle and cross the opened gate while it is still open. That is more realistic (player get out, go to post and show identifications to guard soldiers, come back to vehicle and have about 10 seconds to move in base area) and after that gate will close automaticly again-   on deact: gate animate ["Door_1_move", 0] ;  

Thanks in advance and sorry on my English i was try my best.

I was tried on deact: {sleep 0.5; gate animate ["Door_1_move", 0] ;};    but gate now does not closing at all. Trigger was finished I know that because I was try to re-enter area and hint message "wlcm officer" showed again, gate opens but not closing behind me when I left area.

Edited by Nemanjic
tried solutions
  • Like 1

Share this post


Link to post
Share on other sites

You probably use blufor present to obtain a thisList array. The problem is that this list doesn't return the player but his vehicle.

So, two solutions:

just change your condition for:

vehicle player in thisList && ("herl_o_card_red" in items player)

or pass the pre-conditon to any player present, instead of blufor and remove the "player in thisList" useless here.

  • Thanks 1

Share this post


Link to post
Share on other sites

i am using anybody present but I was thinking that condition field overrides side and present/not present settings because it defines only area with items no matter on who owns it.

Ok Ill try and report back. 

Thank you sir!

It works! First solution works in both situations. (player out of vehicle and in vehicle)

Thank you friend. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×