Rescue HQ – The Tycoon Wiki
Advertisement

This is a small tutorial on how to create a SmartObject.

SmartObjects are objects used ingame that interact with Emergencies as well as with your people, for example a shower could be a SmartObject, or a Bed.

create a <filename>.fsx file named after your smartObject Library (more then one SmartObject are stored here)

Full Example

#load "EmergencyShared.fsx"
open EMT.Modding
open EmergencyShared

//Comment for your self.
Def.SmartObject.Add {
    ID = "Bed"
    Special = No
    Tags = []
    Profession = ""
    Unlock = None
    BuildDuration = Rt.seconds 10.0
    BuildCost = 800
    SellingPrice = 0.5, Gt.weeks 1.0
    MaintenanceCost = Gt.perDay 50.0
    Type = None
    Cells = [
        RequireSpace {
            Tags = ["BedRoom"]
            Block = [Rect (0,0) (1,2)]
            Free = []
        }
        Activity {
            Transform = -1, 0, XPos
            ID = "sleeping"
            Enter = XPos, Rt.seconds 1.0
            Exit = Rt.seconds 1.0
            Effects = []
                ++ Condition.whileTraitBelow "Rest" 0.9
                ++ Condition.whileTraitBelow "Exhaustion" 2.0
                ++ Effect.changeTrait "Rest" (Gt.perHour 0.5)
                ++ Effect.changeTrait "Exhaustion" (Gt.perHour 1.4)
                ++ Effect.changeTrait "Relaxation" (Rt.perSecond 0.4)
            Tags = ["IncreaseRest"; "Exhaustion"]
        }
    ]
}

Let me now explain you the what the lines actually mean

#load "Include.fsx"
open EMT.Modding

// default costs
let NeedObjectBuildCost = 50
let NeedObjectMaintenance = Gt.perDay 100.0

let VanityObjectBuildCost = 5
let VanityObjectMaintenance = Gt.perDay 1.0

let StorageObjectBuildCost = 500
let StorageObjectMaintenance = Gt.perDay 5.0
let defautlTrainingTime = 30.0

let RequireStreetAndHideWall (x, y, dir:Direction) =
    RequireMarker (x + int dir.X, y + int dir.Y, dir) "Street"
    @ HideWall (x, y, dir)

This is the headder that is needed to create a SmartObject and can be also changed (Simple SmartObject)

Def.SmartObject.Add {
    ID = "ShowerBed"                                                                      ///Name your SmartObject
    Special = No                                                                         ///more later
    Tags = []                                                                           ///Used internal
    Profession = ""                                                                    ///Can be for example Police and is used to show what department "use that"
    Unlock = Some {                                                                   ///You can set here the goals that has to be reached to unlock the object, Reputations or Missions for example 'Goal.HaveUnlocked "SFL_UnlockFD"'
        RequiredReputation = 500
        Goals = []                                                                  ///In that example we just set a reputation of 500 to unlock the item
    }
    BuildDuration = Rt.seconds 15.0                                               ///The time that the station actually need to be build
    BuildCost = 1000                                                             ///The price of the item
    SellingPrice = 0.5, Gt.weeks 1.0                                            ///The selling price should drop if you longer own the item
    MaintenanceCost = Gt.perDay 50.0                                           ///The costs that you pay per day for the item
    Type = None                                                               ///For a simple object we dont need to set any type

(Vehicle SmartObject)

Def.SmartObject.Add {
    ID = "UFO"                                                                            ///Name your SmartObject
    Special = No                                                                         ///more later
    Tags = [USAVehicle]                                                                 ///Used internal
    Profession = "FireFighter"                                                         ///Can be for example FireFighterand is used to show what department "use that"
    Unlock = Some {                                                                   ///You can set here the goals that has to be reached to unlock the object, Reputations or Missions for example 'Goal.HaveUnlocked "SFL_UnlockFD"'
        RequiredReputation = 1000
        Goals = [Goal.HaveUnlocked "SFL_UnlockFD"]                                  ///In that example we just set a reputation of 1000 to unlock the item and have to finish the Mission "SF Firedepartment"
    }
    BuildDuration = Rt.seconds 60.0                                               ///The time that the station actually need to be build
    BuildCost = 100000                                                           ///The price of the item
    SellingPrice = 5.0, Gt.weeks 1.0                                            ///The selling price should drop if you longer own the item
    MaintenanceCost = Gt.perDay 500.0                                          ///The costs that you pay per day for the item
    Type = SmartObjectType.Vehicle {                                          ///A UFO is not a simple object so we need to set some more values, we declare it here as a vehicle
        Emergency = {                                                        ///In case of a emergency 
            LeaveTime  = Rt.seconds 0.1                                     ///The time that the vehicle need to leave the station - look the UFO is fast as hell!
            ComeBackTime = Rt.seconds 0.1                                  ///The time that the vehicle need to return
            Contributions = [                                             ///Here we can set the items that a UFO carry, these must have the same name that the item
                Contribution.Asset "MagicStick" Condition.Always         ///We carry a item called MagicStick here ;-) it is always available
            ]
            ItemSlots = 6                                                                                         ///The count of items that we can carry with our vehicle
            //ItemAccessPoint = ItemAccessPoint (2, 2, XNeg) (Rt.seconds 1.0) (Rt.seconds 1.0)                   ///In your vehicle 3D Model you set the access points for the items
            Seats = [                                                                                       
                AccessPoint (2, 0, XNeg) "Sit" (XNeg, Rt.seconds 0.5) (Rt.seconds 0.5)                          ///You can set the spots where your people access the vehicle 
            ]
        }
        Maintenance = {                                                                                       ///The costs of maintrance are set here, you have a Max DMG and can set the times and costs
            MaxDamage = 100.0
            DamageMultiplier = [
                Above 6, 1.5
                Above 3, 1.0
                Above 0, 0.5
            ] 
            BreakDownChance = [                                                                            ///The chance that your item break down if it is damaged
                Above 0.5, 0.5
                Above 0.2, 0.1
                Above 0.0, 0.03
            ]
            RepairActivities = [                                                                         ///To repair the vehicle you also have to set the positions, animation (by ID) as well as time 
                {
                    Transform = -1, 1, XPos
                    ID = "Repair1"
                    Enter = XPos, Rt.seconds 0.5
                    Exit = Rt.seconds 0.5
                }
            ]
        }
    }                                                             

After setting the base layout for our objects lets start with "where can you build it" (SimpleObject)

    Cells = [                                        ///this is the main wrapper
        RequireSpace {                              ///Wrapper around the tags
            Tags = ["BedRoom","Bathroom"]          ///The rooms where you can build the objects
            Block = [Rect (0,0) (1,2)]            ///The tiles the object blocks
            Free = []                            ///If there are any free tiles
        }

(Vehicle/On Wall)

 Cells = [
        RequireSpace {
            Tags = ["Garage"]
            Block = [Rect (0, 0) (2, 5)]
            Free = [Rect (0, 0) (2, 6)]
        }
        RequireStreetAndHideWall (-1, 0, ZNeg)                ///Some objects should have a garage door or should be at a wall you can set this like this
        RequireStreetAndHideWall (0, 0, ZNeg) 
        RequireStreetAndHideWall (1, 0, ZNeg)
        RequireStreetAndHideWall (2, 0, ZNeg)
    ]


At last our BedShower can has a activity sleeping and shower ;-) this cleans our people while they get new energy

Activity {
            Transform = -1, 0, XPos                                           ///Should the object be transformed
            ID = "cleansleeping"                                             ///A ID for the activity
            Enter = XPos, Rt.seconds 1.0                                    ///Where you access the object for the ability                          
            Exit = Rt.seconds 1.0                                          ///The time for exit :-)!
            Effects = []                                                  ///The buffs or nerfs your people get while using the object
                ++ Condition.whileTraitBelow "Rest" 0.9
                ++ Condition.whileTraitBelow "Exhaustion" 2.0
                ++ Effect.changeTrait "Rest" (Gt.perHour 0.5)
                ++ Effect.changeTrait "Exhaustion" (Gt.perHour 1.4)
                ++ Effect.changeTrait "Relaxation" (Rt.perSecond 0.4)
            Ta
Advertisement