Results 1 to 20 of 25

Thread: Major discovery: Traits for regions!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Major discovery: Traits for regions!

    You gotta love this: CA implemented traits for regions! There are some in vanilla that you can use for testing purposes, like R_Infected_Cholera. To test it, you can use this (put it into triggers or the campaign script, somebody needs to write a traits tutorial):

    Code:
    events.RegionTurnStart[#events.RegionTurnStart+1] =
    function (context)
    	
    	effect.trait("R_Infected_Cholera","region",1,100,context)
    end
    Now why is this great? Easy: Add a trait effect to the region trait, for example happy_industrialisation_lower, and you can now change region stats like you would with buildings. So... we can for example create scripted traits that change what happens when the player conquers a region - for example the resistance effect could be vastly increased, taxes could be lowered, recruitment disabled, anything goes! I'm very excited about this feature

    They even show up in the UI as a small pip, not sure yet how to change their appearance or give them a tooltip but I hope that's possible.
    Last edited by alpaca; April 04, 2009 at 12:53 PM.

    No thing is everything. Every thing is nothing.

  2. #2

    Default Re: Major discovery: Traits for regions!

    Sweet, nice work... this will fix half my battle... i'm still trying to figure out where the base effects of both religious unrest and foreign occupation happiness modifications are.

    At least now i know we may be able to change stuff with region traits. if we can't figure out how to change them through the pack files.

  3. #3
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by Cursisanafou View Post
    Sweet, nice work... this will fix half my battle... i'm still trying to figure out where the base effects of both religious unrest and foreign occupation happiness modifications are.

    At least now i know we may be able to change stuff with region traits. if we can't figure out how to change them through the pack files.
    Yeah I didn't find resistance, either, I think it may be hardcoded. Didn't look for religious unrest.

    No thing is everything. Every thing is nothing.

  4. #4

    Default Re: Major discovery: Traits for regions!

    Hmm, this is probably wrong but i have

    Code:
    local function OnRegionTurnStart(context)
        if conditions.IsHomeRegion("britain", context) then
            effect.trait("R_Infected_Cholera","region",1,100,context)
        end
    end
    in my scripting file in the main folder.... it shows a message that it gained the trait but doesn't actually show up like it did for you.

  5. #5

    Default Re: Major discovery: Traits for regions!

    Lots of scripting stuff, but for some reason I have a feeling we are missing a bunch of script files somewere.

    Or maybe I just cannot find them.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  6. #6
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by Cursisanafou View Post
    Hmm, this is probably wrong but i have

    Code:
    local function OnRegionTurnStart(context)
        if conditions.IsHomeRegion("britain", context) then
            effect.trait("R_Infected_Cholera","region",1,100,context)
        end
    end
    in my scripting file in the main folder.... it shows a message that it gained the trait but doesn't actually show up like it did for you.
    That's because you didn't give it an effect, you have to edit the trait level effects db so that it has one, then it'll display a pip. Unfortunately the tooltips for these pips don't seem to be implemented.

    No thing is everything. Every thing is nothing.

  7. #7

    Default Re: Major discovery: Traits for regions!

    oh ok thanks heh.

  8. #8

    Default Re: Major discovery: Traits for regions!

    Ya well there are alot of files, but as far as I can tell everything interface realted is there including the main menus, so we could change things like the display size of the faction selection boxes or add a scroll bar?

    There are endless options really because those Luac files contain all the events that run all the ui, so we would be able to make custom buttons and stuff, if what I have found is right, which I am pretty sure it is.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  9. #9

    Default Re: Major discovery: Traits for regions!

    That is not completely right, the files without extension in the same folder declare the button, text, etc, the luac files handle clicks on buttons., as in it tells the game to save a file or close a hud or panel when you hit the close button.

  10. #10

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by just View Post
    That is not completely right, the files without extension in the same folder declare the button, text, etc, the luac files handle clicks on buttons., as in it tells the game to save a file or close a hud or panel when you hit the close button.
    Correct but the panel closing is a general panel I assume, so new panels could be added and the luac tells the Game engine what to do.

    I mean it could work either way, but basicly I am drawing on my knowledge from World of Warcraft and the way they used lua to do things, plus how alot of tutorials are written for lua. Plus it would be bad if all the panels were hardcoded into the game, it would make more sense if there was say a panel class that can have lots of stuff on it, but all the actual game panels are created with the lua. It makes more sense in many ways that hardcoding, and since they seem to have down away with alot of the other hardcoding from years past, it makes no sense why they would take a step back.

    I mean this is all guessing now, until we can open the files no can no for sure, but I would put my money behind what I have said because it makes the most sense in modern game development.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  11. #11

    Default Re: Major discovery: Traits for regions!

    It's not hardcoded, it's just a different file format than luac. One guy made a mod to enable the royal family button, he did this by altering the visibility setting for that button, not in the luac but in the file without extension.

  12. #12

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by just View Post
    It's not hardcoded, it's just a different file format than luac. One guy made a mod to enable the royal family button, he did this by altering the visibility setting for that button, not in the luac but in the file without extension.
    Correct but that was an existing component, and he just flicked a switch basicly, what controls that switch is unknown.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  13. #13

    Default Re: Major discovery: Traits for regions!

    Yes all the buttons defined in non-extension "layout" files.

    These files define the layout of panel as well as the art assets to use. I only deciphered a few bits, but will hopefully have more in the future. The tooltip associated with an object on the panel is defined in here as well.

    I only have deciphered for certain the x,y and visibility bits as well as lua blocks written into binary which allow a button to do anything you can do with lua calls I suspect. But there is for sure more things to be editable. Right now I'm working on finding the start and end of button blocks so I can try to make my own custom button as a test.

    If you look in the layout file you can see tooltip text after the button object name and its x,y, and visibility bits. It will be in utf-16

  14. #14

    Default Re: Major discovery: Traits for regions!

    Its not unknown. All the objects get defined in the layout files and they are able to use basic functionality that must have been exported to the UI such as OnLeftMouseClick or RightMouseClick as well as Hovering over the button. I'm sure that all the base objects types are define somewhere that you are possible to use such as list panels, buttons, textboxes, and anything else they would need to design their ui.

  15. #15

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by GeorgiaPeanuts View Post
    Its not unknown. All the objects get defined in the layout files and they are able to use basic functionality that must have been exported to the UI such as OnLeftMouseClick or RightMouseClick as well as Hovering over the button. I'm sure that all the base objects types are define somewhere that you are possible to use such as list panels, buttons, textboxes, and anything else they would need to design their ui.
    I think you are missing my point, that panel already exsisted but was hidden, new components will take alot more work and require different things.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  16. #16
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Major discovery: Traits for regions!

    To those of you who are interested in creating regional traits I would recommend downloading Terra Incognita and copy large bits of my code or the whole script. The process isn't very straightforward and getting assigning traits to specific regions is a bit of a problem.

    Alas I fear right now that modding these will be a task for people who have a decent grasp of programming and can think their way around three corners and I don't want to spend the time writing a detailed documentation for it right now (I don't like writing documentation a lot). To others I unfortunately have to say: Don't try this at home.

    I will answer concise question about my code and about problems with implementing this stuff but don't expect me to baby-step you

    No thing is everything. Every thing is nothing.

  17. #17

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by alpaca View Post
    To those of you who are interested in creating regional traits I would recommend downloading Terra Incognita and copy large bits of my code or the whole script. The process isn't very straightforward and getting assigning traits to specific regions is a bit of a problem.

    Alas I fear right now that modding these will be a task for people who have a decent grasp of programming and can think their way around three corners and I don't want to spend the time writing a detailed documentation for it right now (I don't like writing documentation a lot). To others I unfortunately have to say: Don't try this at home.

    I will answer concise question about my code and about problems with implementing this stuff but don't expect me to baby-step you
    Come May, I would be happy to write documentation as long as I have some information to work with, but not intil may when I am done school.
    http://www.twcenter.net/forums/showthread.php?t=260572

    Game Scripter @ Reverie World Studios

  18. #18
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Major discovery: Traits for regions!

    Quote Originally Posted by harshman_chris View Post
    Come May, I would be happy to write documentation as long as I have some information to work with, but not intil may when I am done school.
    A fine offer, thanks. Send me a PM then or contact me via MSN and we can talk about the info you need. You'll still have to figure out most things by yourself though

    No thing is everything. Every thing is nothing.

  19. #19

    Default Re: Major discovery: Traits for regions!

    one major discovery im hoping for is how to edit the governments and their policies i mean constitutional monarchies get to choose their ministers i know it sounds unfair but i relaly want to find a way so i can add that feature to constitutional monarchy i hate having low star guys.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •