Lua

From Prison Architect Wiki
Revision as of 19:28, 12 October 2012 by 82.9.130.25 (talk) (Created page with "''This page is about Lua, for the development of Mods, please see Modding.'' Lua controls how the game interacts. From creating grants to campaigns every part of ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page is about Lua, for the development of Mods, please see Modding.

Lua controls how the game interacts. From creating grants to campaigns every part of the game has some interaction with Lua.

Lua elements

Objective. elements

  • Objective.Create ( "name" )
  • Objective.TargetZone ( x, y, x, y )
  • Objective.RequireNamedObject ( "name" )
  • Objective.RequireObjects ( "item", quantity )
  • Objective.RequireObjectOn ( "name" );
  • Objective.RequireFlag ( "flag", true, 90 )
  • Objective.RequireMaterials ( "item", quantity )
  • Objective.Invert ()
  • Objective.SetFlags ( true, false )
  • Objective.RequireRoom ( "room type", false )
  • Objective.RequireBuilding ( true )

Game. elements

  • Game.AdviserIncoming ( "Adviser" )
  • Game.AdviserSay ( "Adviser", "text or location of text" )
  • Game.AdviserSayBatch ( "Adviser", "location" )
           This is used from the language file and will say many strings as long as they are string_name_1 and string_name_2 etc.
  • Game.CamMove ( x, y, x, y, speed, true )
  • Game.CamZoom ( rate, speed, false )
  • Game.CamMoveAndZoom ( x, y, x, y, rate, speed, true )
  • Game.Pause ( time in seconds )
           This will pause the UI for the time in seconds.
  • Game.Show ( "item" )
           The item can be either a game system ( "Utilities" ) or a image ( "CompanyLogo" )
  • Game.Hide ( "item" )
  • Game.Unlock ( "type", "name" )
           Type can be a game system or objects etc ( "material", "BrickWall" ) etc.
  • Game.Lock ( "System", "Electricity" )
  • Game.PowerOff ( "item_name" )
  • Game.PowerOn ( "item_name" )
  • Game.FadeUp ( time, true )
  • Game.FadeToBlack ( time, true )
  • Game.SaveMap ( "name" )
  • Game.GameOver ()
  • Game.Spawn ( "Unit", "name", x, y )
  • Game.Delivery ( "unit", quantity, "name" )
  • Game.SetMap ( "name" )
  • Game.Sound ( "_folder", "name" )
  • Game.Polaroid ( "name", "location", 65, 68, 10, 4 )
  • Game.SendEntityToPos ( "name", destination_x, destination_y, face_left_or_right, face_up_or_down, movement_speed )
           face_left_or_right: positive to face right, negative to face left after reaching destination.
           face_up_or_down: positive to face down, negative to face up after reaching destination.
           face_up_or_down overrides face_left_or_right.
  • Game.GiveEquipment ( "name", "equipment" )
  • Game.StopSound ( "object", "event" ) - refer to sounds.txt
  • Game.SaveMap ( "map_name" )
  • Game.Damage ( "victim", damage, "aggressor" )
           100 is lethal. victim and aggressor may match.
           e.g. Edward is dealt 100 damage by himself in the chair.
  • Game.FadeToColour ( red, green, blue, alpha, fading_time, fade_from_existing_fade_flag )
           rgba attributes are supposed to have values between 0 and 1.
  • Game.SpawnDecal ( x_position, y_position, scale, decal_X, decal_Y, decal_size_X, decal_size_Y )
           decal_X and decal_Y refer to where the top left corner is for the desired decal in effects.bmp.
           decal_size refers to how much should be pulled from effects.bmp, going left, then down.
           They're all measured in multiples of 32 pixels.
           Why are they back to front? Why do I have to have to use a negative X value to pull out the curse words the right way around? I honestly don't get it.
  • Game.CamTrack ( "name", zoom_level )
           Places camera where named entity is. Doesn't follow it.
  • Game.SetFlag ( "object_name", "flag_name", flag_value )
           e.g. ( "Edward", "Shackled", true )

Trigger. elements

  • Trigger.Create ( "name" )
  • Trigger.RequireObjective ( "objective name" )