March 28, 2017, 12:43:45 PM

Author Topic: Got questions about Mod Development? Ask here!  (Read 6706 times)

gcook725

  • Sr. Member
  • ****
  • Posts: 262
  • Check out Glassworks!
    • View Profile
Got questions about Mod Development? Ask here!
« on: October 06, 2015, 09:52:03 AM »
I've been messing around with modding since it was first implemented in the indev branch, so I might be able to help you out!

I also have a pinned discussion thread on Steam, so you might check there to see if your question has already been answered!

Check out my first mod: Glassworks!
It has windows!
Also, check out my Twitter!

dragoduval

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #1 on: October 12, 2015, 10:29:30 AM »
Trying to add more option in the outfit making (Forgot the name of the file), i made 4 new option in it. A any sword which make the gnome use any 1H sword available, an any axes and an any hammer (Same as the sword one) and an option for making them get any 2H ranged weapon (Crossbow or blunderbuss). Sadly when i get in-game it don't show on the screen when i make a new uniform, any idea why ?.


Also i made an enemy Civilization whit squad made only of skeleton, and inside of the squads there's an option where we decide if we want the squad to spawn one of each class or simply one class. If i choose only one of the class, does that make them act like goblin who spawn a few every once in a while ?


Also sorry if i don't get the answer really fast, got to come at my public library for it O.o
"Remember, a dead goblin is an happy goblin." Mayor Mathieu Duval

gcook725

  • Sr. Member
  • ****
  • Posts: 262
  • Check out Glassworks!
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #2 on: October 17, 2015, 08:40:38 PM »
Trying to add more option in the outfit making (Forgot the name of the file), i made 4 new option in it. A any sword which make the gnome use any 1H sword available, an any axes and an any hammer (Same as the sword one) and an option for making them get any 2H ranged weapon (Crossbow or blunderbuss). Sadly when i get in-game it don't show on the screen when i make a new uniform, any idea why ?.


Also i made an enemy Civilization whit squad made only of skeleton, and inside of the squads there's an option where we decide if we want the squad to spawn one of each class or simply one class. If i choose only one of the class, does that make them act like goblin who spawn a few every once in a while ?


Also sorry if i don't get the answer really fast, got to come at my public library for it O.o

Sorry for the delay in an answer, real life has been rough. Anyways, did you make sure to load up the mod in a new kingdom? That would be the most likely culprit since I doubt its a syntax error of some sort since Gnomoria generally crashes on load if that is the case.

As for your second question: The faction type you set for the enemy civilization will dictate how they spawn. For example, setting the type to Wild Animal should spawn those enemies in the same manner as bears and the like while setting the type to Mants will make them spawn when there is a certain amount of food.

Check out my first mod: Glassworks!
It has windows!
Also, check out my Twitter!

dragoduval

  • Jr. Member
  • **
  • Posts: 78
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #3 on: October 21, 2015, 12:47:53 PM »
Ha thanks, ill have to change the skeleton race :D.

Yea i did, but now that i think about it, i did not look at the outfit creation once i loaded my mod. Ill have to look oce im back home :D.

Also where do we edit names ? I mean if i add a new category, where can i add it a name ? Is it even possible ?
"Remember, a dead goblin is an happy goblin." Mayor Mathieu Duval

Mike9

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #4 on: October 25, 2015, 07:48:31 AM »
Can someone explain what the offset does in the sprites.xml file.

The explanation says "Local offset from cell position".

It doesn't explain what cell, what location, or even what it does.

Does it centre the sprite? and what do the numbers mean how come some start 0 and others start at -8.

I am so confused.

gcook725

  • Sr. Member
  • ****
  • Posts: 262
  • Check out Glassworks!
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #5 on: October 25, 2015, 12:07:34 PM »
Can someone explain what the offset does in the sprites.xml file.

The explanation says "Local offset from cell position".

It doesn't explain what cell, what location, or even what it does.

Does it centre the sprite? and what do the numbers mean how come some start 0 and others start at -8.

I am so confused.

The offset repositions the sprite based on the point of origin for that sprite (which is the top left corner). it is formatted in (x,y) so that the first number is the X-coordinate and the second number is the Y-coordinate. The number is how many pixels away from the point of origin to offset the sprite. Because the point of origin is the TOP LEFT of the sprite for Gnomoria, the Y-coordinate increases downward and the X-coordinate increases rightward. To move the sprite upward, you'd need a negative Y-coordinate. To move leftward you'd need a negative X-coordinate. The included image should hopefully help visualize this.

Check out my first mod: Glassworks!
It has windows!
Also, check out my Twitter!

Mike9

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #6 on: October 25, 2015, 02:00:34 PM »
Can someone explain what the offset does in the sprites.xml file.

The explanation says "Local offset from cell position".

It doesn't explain what cell, what location, or even what it does.

Does it centre the sprite? and what do the numbers mean how come some start 0 and others start at -8.

I am so confused.

The offset repositions the sprite based on the point of origin for that sprite (which is the top left corner). it is formatted in (x,y) so that the first number is the X-coordinate and the second number is the Y-coordinate. The number is how many pixels away from the point of origin to offset the sprite. Because the point of origin is the TOP LEFT of the sprite for Gnomoria, the Y-coordinate increases downward and the X-coordinate increases rightward. To move the sprite upward, you'd need a negative Y-coordinate. To move leftward you'd need a negative X-coordinate. The included image should hopefully help visualize this.


I think I understand so what your basically saying is it moves the sprite using the origin declared in <SourceRectangle> and moves from the TOP LEFT corner using x and y axis.


Why use the command at all? Is it simply so that if your not happy with the position of sprite on the screen you can move/adjust it or is there any other reasons.




gcook725

  • Sr. Member
  • ****
  • Posts: 262
  • Check out Glassworks!
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #7 on: October 26, 2015, 10:09:57 AM »
I think I understand so what your basically saying is it moves the sprite using the origin declared in <SourceRectangle> and moves from the TOP LEFT corner using x and y axis.


Why use the command at all? Is it simply so that if your not happy with the position of sprite on the screen you can move/adjust it or is there any other reasons.

It helps to reduce the number of sprites you need. For example, its is used for halfwalls by moving the floor sprite up a few pixels. It is also helpful in positioning sprites when building workshops.

Also because of the isometric nature of the game, sometimes you'll need to reposition sprites. The sprites you make are in squares, but are positioned in diamonds in game. You'll realize the usefulness of it when you mess around with a LOT of sprites. It is kinda hard to explain all the uses for <Offset>.

Check out my first mod: Glassworks!
It has windows!
Also, check out my Twitter!

Mike9

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #8 on: October 26, 2015, 12:32:10 PM »

It helps to reduce the number of sprites you need. For example, its is used for halfwalls by moving the floor sprite up a few pixels. It is also helpful in positioning sprites when building workshops.

Also because of the isometric nature of the game, sometimes you'll need to reposition sprites. The sprites you make are in squares, but are positioned in diamonds in game. You'll realize the usefulness of it when you mess around with a LOT of sprites. It is kinda hard to explain all the uses for <Offset>.

Thank you that information helps alot cheers.
« Last Edit: October 26, 2015, 01:32:12 PM by Mike9 »

gcook725

  • Sr. Member
  • ****
  • Posts: 262
  • Check out Glassworks!
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #9 on: October 26, 2015, 11:48:36 PM »
Thank you that information helps alot cheers.

No problem. Have fun modding!

Check out my first mod: Glassworks!
It has windows!
Also, check out my Twitter!

Tacyn

  • Full Member
  • ***
  • Posts: 223
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #10 on: November 24, 2015, 01:52:18 AM »
I'm trying to add another workshop with the same functionality as the smelter, while keeping the original smelter.
I've copied the tag in workshopsettings identifying the smelter.
However, if the new workshop has some craftableitem-tag  it crashes.

Anyone know if this is actually possible or does the smelter have to stay unique?

Roboute

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #11 on: November 26, 2015, 08:12:00 AM »
I'm getting the below error, can anyone tell me what actually is the problem and how I can find out which sprite is the culprit?

////////////////////////////////////////////////////////////////
    Date: 26-11-2015 17:06:53
Assembly: gnomoria.exe
 Version: 1.0.0.0
   World: world02
 Message: Nesting more than one SpriteBatch.Begin when using a SpriteBatch with SpriteSortMode.Immediate is not allowed.
////////////////////////////////////////////////////////////////
   bij Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
   bij Game.GUI.Controls.Renderer.Begin(BlendingMode mode)
   bij Game.GUI.Controls.Manager.EndDraw(Rectangle rect)
   bij Game.GUI.Controls.Manager.EndDraw()
   bij Game.GnomanEmpire.Draw(GameTime gameTime)
   bij Microsoft.Xna.Framework.Game.DrawFrame()
   bij Microsoft.Xna.Framework.Game.Tick()
   bij Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
   bij Microsoft.Xna.Framework.GameHost.OnIdle()
   bij Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
   bij Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
   bij System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
   bij System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   bij System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   bij System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   bij System.Windows.Forms.Application.Run(Form mainForm)
   bij Microsoft.Xna.Framework.WindowsGameHost.Run()
   bij Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   bij A.cebc1c67c4a164a49b1c279b0006957be.c49a93168dc3d77742f5742786a5b60b9(String[] c51864dddd6353b79e1a34e131a62f09a)
////////////////////////////////////////////////////////////////

espoire

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #12 on: December 02, 2015, 05:26:33 AM »
Anyone know if this is actually possible or does the smelter have to stay unique?

Pretty sure the smelter is the only workshop that can work like itself. I wish that weren't the case, but it seems to be so.

espoire

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #13 on: December 02, 2015, 05:30:14 AM »
I'm getting the below error, can anyone tell me what actually is the problem and how I can find out which sprite is the culprit?

...

You're right, it's very probably a bad sprite. Anything wrong with a sprite definition will cause this, but my most common cause was misuse of the <SpritePath> tag.

The only way to test it is to disable your sprites one-by-one until it doesn't crash anymore. Usually it's whatever you added most-recently if you're testing between every change. If not, change your new items/workshops/whatever sprites to a known working sprite, like the Apple sprite or something. As soon as it doesn't crash again, you know whichever one you just changed was the broken one.

Namiraja

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Got questions about Mod Development? Ask here!
« Reply #14 on: January 15, 2016, 08:36:39 AM »
Hi,
I just started to look at the new modding. I've still got some problems in understanding what's possible with mods right now (like what exactly needs a change in mechanics and won't therefore not be possible).

At first, I thought maybe I can copy the well and make it produce something, like a normal workshop. I don't think it's possible, is it? (I want the workshop to be on water or at least block movement).
Second, is it possible to make new designations and tiles and make them depend on each other? Like Pasture needs grass, Farm needs dirt, planting mushrooms need mud ... Looks like your only able to make new pastures/farms/etc. with the same conditions those have, right?

Other question: Is it possible to make other stuff that's working like prospector - but creating other stuff than slivers (weighted) or tinker workshop but developing different research path? There's this tag "ProspectorID" and "TinkerBenchID"  in workshop settings, and I was curious if you are able to add more than those two, e.g prospector and advanced prospector, second one with more creatable items/other weights or whatever.
Okay, just saw the smelter question, I guess it's the same here. Just leaving it here because of forum search.

Gonna look into this, maybe I'll find some answers myself. But I thought I'd save a lot of time with asking ;)