Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Refueling with Jerry can problems. Trigger not attaching to vehicle.

  1. #11
    Private First Class
    Join Date
    Jun 29 2012
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Author of the Thread
    I think we've nearly got this perfected. I played around with it a bit more and I really didn't like how Attach Options was still available and it would activate case 0 of attachtruck.sqf so I made it a seperate .sqf.
    Posting all the code for anyone who wants to try this out,modify it or perfect it.

    Spoiler:

  2. #12
    How do you want the attach to truck to work?

    Other things that really need fixing are :-

    When you die you need to release the can, I had that working and needs putting back.
    When you get in a truck while carrying item it sticks out the window. I see two solutions, Auto drop item or try and prevent entry while carrying.
    Set variable for full and empty can.
    Script need placing in one folder, minor path change.

  3. #13
    Private First Class
    Join Date
    Jun 29 2012
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Author of the Thread
    Allo F2k Sel,

    After testing it out and having a few runs with a couple of buddies ( I know the code isn't for multiplayer, I just needed a few lab mice to see where an ideal spot was to place the jerry can), they seemed confused on how to attach it (drop and look)I might switch back so that the actions appear on the truck. (I could easily pop in a hint that tells the player to look at the can for more options when near the vehicle).

    Edit: I'll keep with the actions on the truck but you have to drop the can. I like this approach.
    Edit2: I've added sounds for fueling and attaching to truck that my friend made for me, I'll have to wait till he is online for the dropping sound.

    From the things that need fixing

    1. Will definitely put that back in.
    2. I was thinking about that yesterday, I think a force disembark or eject with a prompt or hint (something witty like "You struggle to get in") would work perfectly
    3. I was writing a mini abstraction for that early today. I was trying to figure out if there is a way to have a global variable and then call to check it in another function.
    What I had planned was a trigger would be set near a fuel pump, the player would go to the fuel pump with the jerry can, drop it and be able to fill it (I'll pop an animation in)
    The amount of fuel (fuelAmount) would be random (between 0.1-1.0) in the fuel pump and would be added to an int var on the Jerry Can (jerryfuelAmount).
    I would have a statement to check if it would be over 1.0 and it would set jerryfuelAmount to 1. I also had plans so that the player could check how much fuel was in the jerry can
    via nested loops (quarter,half,three thirds and full).
    4. Cheers for reminding me about that! I'll get on that right away.
    Last edited by Allanp; Jul 2 2012 at 21:08.

  4. #14
    Had a big problem today, when I added the killed eventhandler I kept getting multiple actions. I t took forever to sort it out but seems to be working.
    I've also added a kick out from vehicle if carrying can.
    I used calls for these as I needed to learn how to use them and it saves adding more scripts or adding them to the case statement.

    It's better to use setvariable and getvariable. ie

    scase setvariable ["fuel",10,true];
    hint format ["Jerry Can Has %1 Liters of Fuel",scase getvariable "fuel"];

    Spoiler:



    Place this in the fuel cans init, you can adjust amount of fuel if you wish. It's not pretty but it worked.
    scase setvariable ["fuel",10,true];

    Spoiler:

  5. #15
    Private First Class
    Join Date
    Jun 29 2012
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Author of the Thread
    Cheers F2k Sel!

    I got a chance to play with it some more. I changed it so the value put on fuel will determine how full the truck will be. The only problem I have now is in carry (the changes I made) where it still states the Jerry Can as being full, would I have to merge them so that the value is constant or is there a way to call that var from another script? I also found a problem, when I attach the can to the truck and try to enter it kicks me out. but if I detach it from the truck and enter it lets me in.
    As always, your help is greatly appreciated.

    Spoiler:
    Last edited by Allanp; Jul 3 2012 at 06:24.

  6. #16
    Hi Allanp.

    Took an age to debug some of these actions.
    I've changed the way the take variable works, it now changes to a value which corresponds to what actions are being used.
    I'm not going to say it's sorted as there's bound to be something messing up and it needs a major clean up.

    What I think I've fixed.

    Getting kicked when fuel attached to truck.
    All options removed when getting in vehicle.
    All options removed when refuelling.
    Fuel amounts now work correctly. (you hadn't passed _fuelcount to setvariable)

    I've removed the truck startup eventhandlers and they're applied when you drop a can near to the truck.

    I've done it as a download, pasting it gets tedious.

    See how you go.

    http://www.sendspace.com/file/hvqc8x

  7. #17
    Private First Class
    Join Date
    Jun 29 2012
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Author of the Thread
    Allo F2k Sel,
    Did a really quick run-through after work and I found out if you attach the fuel can and then drop it in range to refuel it starts creating multiple instances of the "Refuel Truck" action if the player hadn't already refueled. I noticed in case 4 there was another instance of refuel truck being created so I removed it (not sure if it was there for testing reasons?) but it seemed to have fixed it. I also fixed the if statements. I forgot proof read over it and left out an = (>=5)sign on feels somewhat full.

    PHP Code:

     _fuelCount 
    _fuel;
            if (
    _fuel >=1then {_fuelCount=10_fuel=1};
            if (
    _fuel and _fuel 1then {_fuelCount=_fuel*10};
            if (
    _fuel == 10then titleText ["This feels full","PLAIN",0.3]};
            if (
    _fuelCount >=and _fuelCount 10then {titleText ["This  feels somewhat full","PLAIN",0.3]};
            if (
    _fuelCount >=and _fuelCount then {titleText ["This feels half way full","PLAIN",0.3]};
            if (
    _fuelCount >=and _fuelCount then {titleText ["This feels close to empty","PLAIN",0.3]};
            if (
    _fuel == 0then {titleText ["This feels empty","PLAIN"]}; 
    I also refined some of the timing and added a few sounds. I'm really enjoying how this script is turning out. I looked through the Arma2 scripting references and jotted down a few more ideas.

  8. #18
    Cheers Allanp it's hard to test every aspect every time you make a change. I'll take another look, the script is poorly written to be honest that's why we keep getting multiple actions.

    I'm trying to come up with a solution for scase and truck_start, I'd rather not use specific names for objects but that will take a while as it needs a complete re-write.
    Currently I've re-written carry.sqf where as long as an object type is in the list you can carry it in either hand or on hip.
    I'm just stuck on the in out car trigger. It keeps kicking me when I've dropped items.

    A few ideas for the current script would be to add damage/hit eventhandler to the can. One shot it starts to leak, two or more it explodes. I have a script for the second it just needs the leak adding to it.
    I also thought about a syphon fuel option so you could get it from abandon vehicles.


    Only had a quick look today, the refuel action number was incorrect it was act5 it should be act3
    Last edited by F2k Sel; Jul 4 2012 at 21:03.

  9. #19
    Private First Class
    Join Date
    Jun 29 2012
    Location
    Edmonton, Alberta, Canada
    Posts
    12
    Author of the Thread
    Cheers on the Honesty, I know it is poorly written, I only have a limited knowledge in programming. I know a bit of C# (I had fun making silly text based adventure games hah) and I started looking up on Java. I also found a few articles on cleaning up my code so fingers crossed it soaks in my Brain.

    I had that thought run by about not giving specific names to objects so the script can be more general.

    Some thoughts I had were:
    Being able to fuel a specific amount into the vehicle (1/4 , 1/2 , 3/4 or until vehicle is full (or can is empty)) (I also like your siphon fuel idea, this could go hand in hand with that)
    I also like the damage/hit eventhandles. Perhaps if the fuel is empty no explosion happens, but can leak if filled ( a way to repair?)

    I took a look at your mission and saw that you had planned a way for the can to be refilled. I think I'll poke at that for a while and see what I can come up with.

  10. #20
    Well for limiting the amount of fuel you could do a distance check, If you move away to far refuelling stops. It should have that already and the same when filling. Repair would be possible you could drop the can and if it's damaged perform the healing action of the medic to repair it. Then just end the leak script.
    I did fuel leak for a jeep.

    http://www.sendspace.com/file/801ofn


    I'm really stuck on my other idea, I just can't stop a script running every time I fire a new one so I end up with multiple events.

    Any way here's my burning barrel script if you want to take a look, it may give you some ideas. It will need scaling down for a fuel can and sound needs to be set up for multiplayer.

    http://www.sendspace.com/file/p3lcr7

    If you can rip anything from them do so.

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Attaching trigger to moving object
    By braincrush in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 5
    Last Post: Sep 3 2010, 14:38
  2. Trigger isn't attaching to Wreck
    By Devil Dogs SF in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Jul 12 2010, 00:31
  3. Attaching a Trigger to a vehicle
    By JDMT in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 8
    Last Post: Mar 16 2010, 22:23
  4. Attaching a Trigger to a Vehicle
    By Schwab in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 0
    Last Post: Jul 4 2007, 09:30
  5. Attaching a camera to a vehicle
    By [TheOne] in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 7
    Last Post: Jul 11 2006, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •