Car Help

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
Hey guys,

What I'm trying to do is make a system where a player unit can own a car. What I need from the system is to only allow the player's car to move when a unit owned by the player who has the car keys in their inventory is loaded into the car.

Here's what I got in terms of buying the car:

Trigger 1:
Code:
Buying a Car
    Events
        Player - Player 1 (Red) Selects a unit
    Conditions
        (Triggering unit) Equal to Salesman (Male 2) 0019 <gen>
        CarOwned Equal to False
    Actions
        Unit Group - Pick every unit in (Units within 256.00 of (Position of (Triggering unit))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Player 1 (Red)
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                CarDialogCreated Equal to False
                            Then - Actions
                                Dialog - Change the title of BuyingCarDialog to Do you Wish to Buy ...
                                Dialog - Create a dialog button for BuyingCarDialog labelled Yes, here's 200 gol...
                                Set BuyingCarDialogButtons[1] = (Last created dialog Button)
                                Dialog - Create a dialog button for BuyingCarDialog labelled I don't have that s...
                                Set BuyingCarDialogButtons[2] = (Last created dialog Button)
                                Dialog - Show BuyingCarDialog for Player 1 (Red)
                                Set CarDialogCreated = True
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                CarDialogCreated Equal to True
                            Then - Actions
                                Dialog - Show BuyingCarDialog for Player 1 (Red)
                            Else - Actions
                        Trigger - Turn on Buying a Car Dialog Button Clicked <gen>
                    Else - Actions

Trigger 2:
Code:
Buying a Car Dialog Button Clicked
    Events
        Dialog - A dialog button is clicked for BuyingCarDialog
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Player 1 (Red) Current gold) Less than 200
            Then - Actions
                Game - Display to (All players) the text: You don't have enou...
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Clicked dialog button) Equal to BuyingCarDialogButtons[1]
                (Player 1 (Red) Current gold) Greater than or equal to 200
            Then - Actions
                Dialog - Hide BuyingCarDialog for Player 1 (Red)
                Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) - 200)
                Special Effect - Destroy SpecialEffect[1]
                Hero - Create Car Keys and give it to PlayerUnit
                Set CarKeys = (Last created item)
                Set CarKeyHolder = PlayerUnit
                Set CarKeyIDNo = (Random integer number between 100000 and 999999)
                Item - Set the custom value of CarKeys to CarKeyIDNo
                Multiboard - Set the text for Multiboard item in column 2, row 6 to (String(CarKeyIDNo))
                Set CarOwned = True
                Set CarInteger = (CarInteger + 1)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 1
                    Then - Actions
                        Unit - Change ownership of Car 0001 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of Car 0001 <gen> to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 2
                    Then - Actions
                        Unit - Change ownership of Car 0002 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 3
                    Then - Actions
                        Unit - Change ownership of Car 0003 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 4
                    Then - Actions
                        Unit - Change ownership of Car 0004 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 5
                    Then - Actions
                        Unit - Change ownership of Car 0005 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 6
                    Then - Actions
                        Unit - Change ownership of Car 0006 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 7
                    Then - Actions
                        Unit - Change ownership of Car 0007 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 8
                    Then - Actions
                        Unit - Change ownership of Car 0008 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 9
                    Then - Actions
                        Unit - Change ownership of Car 0009 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 10
                    Then - Actions
                        Unit - Change ownership of Car 0010 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 11
                    Then - Actions
                        Unit - Change ownership of Car 0018 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 12
                    Then - Actions
                        Unit - Change ownership of Car 0017 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 13
                    Then - Actions
                        Unit - Change ownership of Car 0016 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 14
                    Then - Actions
                        Unit - Change ownership of Car 0015 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 15
                    Then - Actions
                        Unit - Change ownership of Car 0014 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 16
                    Then - Actions
                        Unit - Change ownership of Car 0013 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 17
                    Then - Actions
                        Unit - Change ownership of Car 0012 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        CarInteger Equal to 18
                    Then - Actions
                        Unit - Change ownership of Car 0011 <gen> to Player 1 (Red) and Change color
                        Unit - Set the custom value of (Last created unit) to CarKeyIDNo
                        Set PlayerCar = (Last created unit)
                    Else - Actions
                Unit - Pause PlayerCar
                Trigger - Run Car Info <gen> (checking conditions)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Clicked dialog button) Equal to BuyingCarDialogButtons[2]
            Then - Actions
                Dialog - Hide BuyingCarDialog for Player 1 (Red)
                Game - Display to (All players) the text: |ccffffcc00Salesman...
            Else - Actions


My question is: how do I make a system that only allow the player's car to move when a unit owned by the player who has the car keys in their inventory is loaded into the car?
 

Whoareyou.

New Member
Reaction score
24
Trigger:
  • Events
    • Unit - A unit Is loaded into a transport
    • (Item carried by (Triggering unit) in slot 1) Equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 2) Equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 3) Equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 4) Equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 5) Equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 6) Equal to Car Keys &lt;gen&gt;
    • Actions
      • Do nothing


Or

Trigger:
  • Events
    • Unit - A unit Is loaded into a transport
    • Conditions
    • (Item carried by (Triggering unit) in slot 1) Not equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 2) Not equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 3) Not equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 4) Not equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 5) Not equal to Car Keys &lt;gen&gt;
    • (Item carried by (Triggering unit) in slot 6) Not equal to Car Keys &lt;gen&gt;
    • Actions
      • Unit - Human &lt;gen&gt; to Stop
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
I tried that, but that set of actions doesn't quite do what I want to do.

What I need is a trigger (or set of triggers) which says that unless the player's unit which has the car keys is in the car, the car cannot move at all.
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
How do i create an ability with no effect? Because then I'll change the ownership of the car and load the car key holder into the car after the car key holder has cast the ability on the car.
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
You could base the ability off of Channel, and change it's target type to Unit Target. Everything else can be changed so the ability has no effect.

EDIT:
You could use these triggers to get the effect you initially wanted:
Trigger:
  • Trigger 1
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Your Car Unit)) and do (Actions)
        • Loop - Actions
          • Set Boolean = False
          • Set TempUnit = (Picked unit)
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • For each (Integer A) from 1 to 6, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item carried by (Picked unit) in slot (Integer A))) Equal to Your Key Item
                      • ((Picked unit) is loaded into TempUnit) Equal to True
                    • Then - Actions
                      • Set Boolean = True
                    • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Boolean Equal to True
            • Then - Actions
              • Actions that allow movement of car
            • Else - Actions
              • Actions that prevent movement of car

Trigger:
  • Trigger 2
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
    • Actions
      • Unit Group - Add (Loading unit) to UnitGroup
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
Something Like This?: Ability.jpg
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
You have the right idea, the problem is that healing wave is hard coded so that it cannot be used on units at full health. You could base that ability off of Chain Lightning, and do relatively the same thing, or you could base it off of Channel.
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
Here's what I got for loading the unit in:

Trigger:
Code:
Unit Loads
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Ability being cast) Equal to Load (Custom)
                (Target unit of ability being cast) Equal to PlayerCar
            Then - Actions
                Cinematic - Disable user control for Player Group - Player 1 (Red)
                Unit - Change ownership of PlayerCar to Player 1 (Red) and Retain color
                Unit - Move CarKeyHolder instantly to (Position of PlayerCar)
                Unit - Order PlayerCar to Load CarKeyHolder
                Cinematic - Enable user control for (All players)
                Selection - Add PlayerCar to selection for Player 1 (Red)
            Else - Actions

Also See the image attached. I'm yet to make the unload trigger, but I'm working on that now.

Ability.jpg
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
Sorry to Double Post, but how do I get my car to unload all the units remaining in its cargo through triggers?

(P.S. 200th Post :D)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top