System Vehicle System

Rinpun

Ex TH Member
Reaction score
105
This is a fully based unloading system for making truly working vehicles. This means you can customize it for making LoaPs, or instead modify it and use it for a cool Halo game or other games relating to cars (like a GTA variant).

The JASS version does NOT need any handle variables with the way I've written it! However, by not using handles, I can't guarantee the system will work well with a heavy amount of vehicles. Feel free to point out issues with the JASS system via PM, as I could easily have overlooked something.

It might be better for that to be the case, but I'm able to get by with two global group variables, one for all the vehicles, one for all the loaded units, and then a global integer to create a unique id for each vehicle.

JASS Explanation

Now remastered in JASS and done much better with all of the things I've learned over the years (I actually think there might be some bugs in the GUI version that I've fixed in this version). Simply copy everything custom in the map (except for the hero, car centre, etc.) You will need to change the hex codes as mentioned, and you will need to modify two of the three header functions.

When there aren't any units in the car with car keys that match the car, the car automatically unloads them all. Just to avoid any confusion, I'd like to state up-front that if you start a car with the Car Owner unit in the sample map, pick up several footmen, and then unload the Car Owner, the car will automatically unload anyone else and turn neutral. It seemed silly to allow the car to continue to work, so I made a simple conditional to kick everyone out.

Header Functions

UnloadAll

You should ignore this function. I use it in VehicleSingleUnload, but it can be used any time you want to order a unit to unload everything it has in it. For whatever reason, you -cannot- order the unit to use its unload all ability. Probably a bug in some respect, but this is a decent work around, I think.

GetItemForType

In order to map which vehicle gives which kind of key (if you want a motorcycle to have a different looking key than a truck), then modify to all of the if thens for each unit id to return a different item id. After all, the key itself does not say what exact car it goes to, but rather to be associated by "brand", like a real car.

IsAVehicle

As the name implies, this is an if then string to find out if a unit is a vehicle or not. I do this as I don't expect every mechanical classified unit to be a vehicle.

I've provided the code necessary to use IsAVehicle as a boolexpr, and I've already used it as a demonstration in the Initialization trigger, if you ever want to group a bunch of vehicle units together. It is also used in the conditionals so that the triggers only fire if it's a vehicle that does the necessary order.

If you don't want to use IsAVehicle as a boolexpr, you can remove the first if statement and move up the set unit_id statement to be the initial declaration of unit_id. Very simple stuff, just twists GetTriggerUnit() when it doesn't fit the trigger call to be GetFilterUnit(), which will be defined if it's used as a boolexpr.

Vehicle Functions

All of the functions work like the GUI variant, except better and without waits. SingleUnload is needed when you click the icon of the unit in the stats sheet to empty the unit and when I use UnloadAll. FullUnload is needed when the vehicle specifically uses the Unload (Air Transports) ability, for unloading everyone in the vehicle.

GUI Explanation

The event here I use is for when a vehicle runs out of fuel, and this will be available in my map. BUT, if you plan on having a "Boarding" ability that kicks everyone out of the car, this trigger should be placed as well.

Code:
BoardVehicle
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Board Vehicle
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Equal to Car1
                (List goes on for how many different vehicle types you have)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Random integer number between 1 and 10) Greater than 3
            Then - Actions
                Unit Group - Pick every unit in (Units owned by (Owner of (Target unit of ability being cast)) matching (((Matching unit) is loaded into (Target unit of ability being cast)) Equal to True)) and do (Actions)
                    Loop - Actions
                        Unit - Order (Target unit of ability being cast) to Unload (Picked unit)
                        Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
                        Unit - Order (Target unit of ability being cast) to Load (Casting unit)
                        Game - Display to (Player group((Owner of (Casting unit)))) for 5.00 seconds the text: Boarding Attempt Successful!
            Else - Actions
                Game - Display to (Player group((Owner of (Casting unit)))) for 5.00 seconds the text: Boarding Attempt Failed!

(If the above doesn't work for some reason, put a .5 to 2 second wait between the unloading, the conversion, and the loading. On another note, and you should be able to figure this out, the random number implies that the Boarding has a 70% chance of working, and 30% chance of failing. If you feel like keeping the failing possibility, you can easily add a pause casting unit and put a stun special effect on the overhead part of the unit, so as to make it look like one has pounced and missed :D)

And next, I present my Vehicle system. It uses one "special" ability that isn't pre-created. Start Car is based off of a targeting ability, which can be a rigged Cripple or other skills that target. It is rigged to do absolutely nothing, and it is added to the item Car Keys, which of course you'll want to take away in Halo where if you're within 10-50 of a neutral vehicle it should convert to your side and automatically load you or something.

Oh, it uses mana for fuel (so make sure to give some to the unit) and it's Arcane Vault as the seller should be changed to Car Salesman. The idea is to break down the trigger as much as possible so it only applies to that one store, of course :)

Last of all, the Or conditions with the "unit-type is footman" is the long list of vehicles you apply. Basically, if you have ten cars in your map, make sure to check if the vehicle in question is equal to one of those unit-types.

Trigger Explanation:

VehicleKeys uses the custom value of the keys and the sold vehicle unit to store vehicle codes, so it's virtually impossible to start another person's car with your keys, since the code is 1/100000. Of course, if you WANT to make the car stealable, you can make it so that if the user of the keys is an enemy of the car it unloads everyone in the car first or keeps them (custody :D). Fake keys can easily be made by setting the custom value of your Fake Keys item to the custom value of the unit, making this all possible.

VehicleStartCar is the trigger that puts use to the custom values. It, namely, checks to see if any of your six pockets contains a key that matches the vehicle's code. It also, of course, makes sure that the unit can actually "turn on" (mana greater than 0) first.

VehicleLoad and VehicleLoad2 are simple. If you want to start the whole losing mana process via triggers (the much easier way as mana degeneration can usually make a mess and look ugly to an extent like my LoaP robot, whose mana jumps up a bit and then goes down some with his mana regeneration I don't want to remove).

VehicleLeaveCar and VehicleLeaveCar2 might just as well be called under VehicleUnload as they're just like the Load triggers, except they remove the car from the Cars unit group, which takes them off the gas degeneration (gaining a car is stopped effect).

VehicleLoseGas contains the real gold of forcing an unload. In order to keep the trigger to maintain two "Pick every unit" actions, there is a convenient "Skip remaining actions". So, if the car still has mana, it'll reduce it by the second and forget about unloading it. If it DOESN'T have mana, however, it'll remove the unit from Cars--no more degeneration of course, set its mana to 0% (just being safe), tell you it's out of gas, and then set everything up for the last action. Now think about this. All it has to do is be ordered to unload the unit. The VehicleLeaveCar trigger, which activates by order(unload), triggers because "Order Car to Unload ___" is the exact same as order(unload)! Basically, the car should unload its driver and then turn to neutral passive with no fuel and so it won't run via StartCar. I have another trigger available so that you can recharge the Car's gas, but that goes by a target unit "Gas Tank" of sorts that is purchased from the Gas Station vendor. I took it out of this--you should be able to figure this out if you want to recharge its mana somehow.
 

Attachments

  • FullCarSystem.w3x
    15.9 KB · Views: 780
  • FullCarSystem JASS Remastery.w3x
    26.9 KB · Views: 602
General chit-chat
Help Users
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top