Unsolved How to make an area what changes car/parts automatically?

Discussion in 'World Editor' started by DeWorD, Mar 23, 2023.

  1. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    152
    Hi all

    any way to make an area where u drive and suddendly it spawns u new car with exact parts?
     
  2. el_ferrito

    el_ferrito
    Expand Collapse

    Joined:
    Sep 30, 2020
    Messages:
    510
    You can use trigger zones to spawn vehicles. Buggered if I know how mind, but it is possible. Ask in the programming forum, someone is bound to know.
     
  3. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    152
    hmmm intresting thank you :)
     
  4. ltntai

    ltntai
    Expand Collapse

    Joined:
    Mar 18, 2017
    Messages:
    672
    Lua trigger like this changes the player car to your desired config, in this case to the Drag Roamer.
    screenshot_2023-03-27_16-50-20.png screenshot_2023-03-27_16-56-11.png screenshot_2023-03-27_16-56-13.png
    screenshot_2023-03-27_16-56-15.png screenshot_2023-03-27_16-56-18.png screenshot_2023-03-27_16-56-20.png
    screenshot_2023-03-27_16-56-31.png screenshot_2023-03-27_16-56-32.png screenshot_2023-03-27_16-56-38.png
    Known issues:
    If an AI vehicle drives in to the trigger, the player car turns to a drag roamer.
    If you step out of the vehicle (F) and roll into the trigger, the rollerdude turns into a drag roamer.

    Code is based on the hidden car lua from @DuneWulff's Wide Open map.
    Code:
    ----------------
    
    local function teleportPlayer(data)
        local vehicleName = data.subjectName
    
        if data.event == 'enter' then
            ui_message("A hidden vehicle is nearby!", 8, "", "publish")
        end
    end
    
    return teleportPlayer
    
    
    --------------------
    
    local function myFunc()
    core_vehicles.replaceVehicle("autobello", {config="oddball", color="0.6 0.45 0.35 1.3"})
    ui_message("You discovered the Oddball!", 8, "", "publish")
    end
    return myFunc
    
    
    --------------------
    
    local function myFunc()
    core_vehicles.replaceVehicle("van", {config="ambulance2"})
    ui_message("You discovered the Scrambulance!", 8, "", "publish")
    end
    return myFunc
    
    -------------------
     
    • Like Like x 2
  5. DeWorD

    DeWorD
    Expand Collapse

    Joined:
    Jan 20, 2017
    Messages:
    152
    big thanks i need to tinker with that a bit to undersand it, but helps :)
     
  6. 23Terrabytes

    23Terrabytes
    Expand Collapse

    Joined:
    Aug 1, 2022
    Messages:
    195
    Thanks for sharing. Ive been adding in hidden abandon cars throughout my map as a sort of scavenger hunt. Code like this might make it a bit more interesting.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice