Campaign Editing

(previously 'DEVELOPER') Private forum for registered community members. To register, please visit www.prison-architect.com/register.

Moderator: NBJeff

Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Campaign Editing

Postby Mas Tnega » Fri Oct 05, 2012 5:34 pm

Due to my inability to figure out a way to get a new campaign into the game through a different subfolder, I made this... thing.

Download: http://devwiki.introversion.co.uk/pa/images/5/59/Mas_simplecampaignedit.zip (Wiki access required, obviously)

Usual deal for installation: inside the zip file is a data folder that goes/overwrites stuff in the data folder.

What happens is that instead of jumping straight into the Deathrow campaign, you're put in a very crude level select screen. Move Chris into the room numbered 1 to start the Deathrow campaign, move him into room 2 for an edited version of the murder scene, move him into room 3 and discover it doesn't do anything.
Nicotin
level1
level1
Posts: 28
Joined: Thu Sep 27, 2012 1:47 pm

Postby Nicotin » Fri Oct 05, 2012 9:00 pm

Good to see you working on a campaign.

Havn't thought about this method as level selector.
Really nice.
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Sat Oct 06, 2012 2:13 pm

Not sure if you messed up but my actor on the level select map is called Chris, The files on the wiki had Edward as the actor.

Code: Select all

    BEGIN "[i 22]"     
        Id.i                 22 
        Id.u                 28 
        Type                 Actor
      Pos.x                38.5096 
        Pos.y                43.1799 
      Name             Chris
      Sprite             LikenessChrisDelay
      PermitPlayerControl  true


Thus i had to change a few things.. but i also added the third level( well start of it)

Code: Select all

function BeginChapter()

   LevelSelect()
   
end

function LevelSelect()

   Game.SetMap      ( "levelselect" );
   
   Objective.Create            ( "Chris_in_room_one" )
   Objective.TargetZone         ( 28, 30, 32, 34 )
   Objective.RequireNamedObject   ( "Chris" )
   
   Trigger.Create               ( "BeginDeathrow" )
   Trigger.RequireObjective      ( "Chris_in_room_one" )
   
   Objective.Create            ( "Chris_in_room_two" )
   Objective.TargetZone         ( 37, 30, 41, 34 )
   Objective.RequireNamedObject   ( "Chris" )

   Trigger.Create               ( "DeathRow_HouseMurder_Alt" )
   Trigger.RequireObjective      ( "Chris_in_room_two" )

    Objective.Create                ( "Chris_in_room_three" )
    Objective.TargetZone            ( 46, 30, 50, 34 )
    Objective.RequireNamedObject    ( "Chris")
   
    Trigger.Create                  ( "Load_Test_Map" )
    Trigger.RequireObjective        ( "Chris_in_room_three" )

end


and my initial code for Load_Test_Map

Code: Select all

function Load_Test_Map()

    Game.SetMap                    ( "Test" );
   
    Advisor_cul_1()
   
   end
   
function Advisor_cul_1()
    Game.Pause                      ( 5 )
    Game.AdviserIncoming           ("Ceo")
    Game.AdviserSay                 ( "Ceo", "adviser_Cul_intro1" )
    Game.AdviserSay                 ( "Ceo", "adviser_Cul_intro2" )
end


paste this at the end of your language file

Code: Select all

# =============================================================================
# Cullyn test
# =============================================================================

adviser_Cul_intro1                              The time has come for you to design the new state prison.
adviser_Cul_intro2                              It wont be easy but you can handle it.


My next move would be to load the text/strings from somewhere other than the language file. The Reason being when we eventually get a neat way to trade campaigns, using the language file will be a hindrance rather than a help , so i will get that going first then get back to you.

edit:
well that was easy.. sorry folks first time working with LUA

just append

Code: Select all

--strings
adviser_Cul_intro1="The time has come for you to design the new state prison."
adviser_Cul_intro2="It wont be easy but you can handle it."


to the testmap.lua(or w/e you are going to call it)

then remove the " " from around the "adviser_Cul_intro1" and "adviser_Cul_intro2"
in

Code: Select all

    Game.AdviserSay                 ( "Ceo", "adviser_Cul_intro1" )
    Game.AdviserSay                 ( "Ceo", "adviser_Cul_intro2" )
[/code]
Last edited by cullyn on Sat Oct 06, 2012 2:51 pm, edited 2 times in total.
Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Postby Mas Tnega » Sat Oct 06, 2012 2:41 pm

cullyn wrote:Not sure if you messed up but my actor on the level select map is called Chris,
Chris being the actor in the level select map is what I intended.

The files on the wiki had Edward as the actor.
I didn't update the contents in the zip after I changed the calls/strings/etc from blah_edward_blah to blah_actor_blah, did I. Due care and attention wins again. It was originally Edward, but then I thought "No. There's a whole objects.spritebank to refer to. I'm using something else!"
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Sat Oct 06, 2012 3:57 pm

just a quick update before i go to bed.

Code: Select all

function Load_Test_Map()

    Game.SetMap                    ( "Test" );
   
    Advisor_cul_1()
   
   end
   
function Advisor_cul_1()
    Game.Pause                      ( 5 )
    Game.AdviserIncoming           ("Ceo")
    Game.AdviserSay                 ( "Ceo", cul_text_1 )
    Game.AdviserSay                 ( "Ceo", cul_text_2 )
   
    Objective_cul_1()
end
function Objective_cul_1()
    Game.AdviserSay                 ( "Ceo", cul_text_3 )
    Game.AdviserSay                 ( "Ceo", cul_text_4 )

    Objective.Create            ( HoldingCell_Building )
    Objective.TargetZone         ( 65, 53, 74, 62 )
   Objective.RequireBuilding      ( false, true )
    Game.AdviserSay                 ( "Ceo", cul_text_5 )
    Objective.Create            ( HoldingCell_Door )
   Objective.TargetZone         ( 69, 53, 70, 53 )
   Objective.RequireObjects      ( "JailDoorLarge", 1 )
   
    end
   
-- strings text
    cul_text_1="The time has come for you to design the new state prison"
    cul_text_2="It wont be easy, but you can handle it"
    cul_text_3="First things first, We need a Holding cell."
    cul_text_4="Without it we can not function as a prison."
    cul_text_5="Do not forget the door."
-- strings objectives
    HoldingCell_Building="Build the foundation for your holding cell."
    HoldingCell_Door="Dont forget the door."


This is just a quick display of things to come, There are issues, like the objective text all having objective_ as a prefix. If someone knows some better way to store the stings out side of the language file id love to hear about it.
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Tue Oct 09, 2012 1:45 am

just want to put some more code out there so more people can see it

Code: Select all

    Trigger.Create                 ( "Objective_cul_2" );
   Trigger.RequireObjective        ( HoldingCell_Building )


Nice and simple way to move the script forward

some notes about it

Trigger.Create
designates where the trigger sends the script, in this case function Objective_cul_2

Trigger.RequireObjective
will trigger once the HoldingCell_Building Objective is complete.

you can have more than one requirement and they can be things other than objectives. Ill slowly work on my script to have the first few steps in building a prison as an example script for all to use.
Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Postby Mas Tnega » Tue Oct 09, 2012 2:23 am

Only thing I've learned recently is that writing a grant into a campaign script is a great way to make it crash.

Specifically, it shows you something like this screenshot with weird text.
Nicotin
level1
level1
Posts: 28
Joined: Thu Sep 27, 2012 1:47 pm

Postby Nicotin » Tue Oct 09, 2012 11:43 am

Same vice versa
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Tue Oct 09, 2012 2:06 pm

Would you folks like me to post the code of my current level open on the forums so you can read it. Ill package it up so you can play it.. but i think discussing code would be beneficial to the community at this early stage.

Edit: unzip and paste the campaign folder inside the data folder.

http://culcraft.com/testcampaign.zip
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Thu Oct 11, 2012 4:35 pm

Here are the game. functions I have found. Ive also tried to describe on how to use them. Some are not fully explained as i am not 100% sure on the functionality.

Code: Select all

Game.AdviserIncoming        ( "Adviser" )
Game.AdviserSay             ( "Adviser", "text or location of text" )
Game.AdviserSayBatch        ( "Adviser", "location" )  this one 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                   ( "build menu" )
Game.Hide                   ( "build menu" )
Game.Unlock                 ( "type", "name" ) type can be a game system or objects etc.
Game.Lock                   ( "System", "Electricity" ) This can be ( "material", "BrickWall" ) etc
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 )
Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Postby Mas Tnega » Thu Oct 11, 2012 5:56 pm

I can throw you a few more. They're not ordered or anything.

Code: Select all

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 )


I don't think what you have for Game.Show and Game.Hide are accurate, given they're used for "GameLogo" (guess what that is), "CompanyLogo" (again, take a guess) and "Flashback" (the black and white effect).
Last edited by Mas Tnega on Fri Oct 12, 2012 2:31 am, edited 1 time in total.
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Fri Oct 12, 2012 2:13 am

I think they can show more than logos

Code: Select all

Game.Show               ( "Utilities" )


in this case they are showing a game system.

Code: Select all

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 )


and

Code: Select all

Trigger.Create               ( "name" )
   Trigger.RequireObjective      ( "objective name" )
Jack5500
level2
level2
Posts: 76
Joined: Tue Mar 25, 2008 9:27 pm
Location: Germany
Contact:

Postby Jack5500 » Fri Oct 12, 2012 8:37 am

Can you guys make a static link for your campaign. (i.e. Dropbox)
That way we could add it to our Mod Manager
cullyn
level1
level1
Posts: 14
Joined: Tue Oct 02, 2012 10:32 am

Postby cullyn » Fri Oct 12, 2012 10:15 am

My link above is to my own host. Also its an experiment on how PA's campaigns work. I do not want it included in any mod manager as its a learning exercise, not a playable campaign.
Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Postby Mas Tnega » Fri Oct 12, 2012 1:34 pm

More or less the same deal with what I've put out so far. The level select map/script is proof of concept. It's all so hastily put together that I hadn't done anything about the discarded bricks holding a door open, the junk or the random assorted crap strewn across the road and delivery area and the camera doesn't even position itself in a sensible way. If nothing else, I'd rather at least wait until there's an actual serious fan-made campaign. Chris will almost certainly render the level select map redundant when there are more official campaigns to choose from.

What exactly is it that the mod manager does anyway? Is there some kind of behaviour I should keep in mind like how it deals with all the different [language].txt files?

Return to “Community Members”

Who is online

Users browsing this forum: No registered users and 10 guests