Help with Models
Posted: Wed May 25, 2016 1:45 pm
Vic,
I was wondering if you could answer several questions regarding models (and some event functions). Sorry, this will be fairly long, with lots of questions to clarify things.
I'm trying to figure out several aspects of them. I have managed to get models working in my mod, but to tell the truth, I am not exactly sure how. I started this process by working to convert NewDawn over to NewDawn2 (all vanilla) primarily by brining in all the pieces into NewDawn from 2. What I don't understand is that I did tried doing this incrementally. I started with just light tanks. I imported all the string lists and events, and then started up. This did not work. When I tried to create a light tank model, I got an error that was basically the same I got before, which was a subscript out of bounds while running MakeNewSFTypeModel. This message:
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at WindowsApplication1.DataClass.AddSFType()
at WindowsApplication1.ProcessingClass.MakeNewSFTypeModel(Int32 sftypenr)
at WindowsApplication1.SFDesignWindowClass.HandleMouseClick(Int32 x, Int32 y, Int32 b)
at WindowsApplication1.PlayScreenClass.HandleMouseClick(Int32 x, Int32 y, Int32 b)
at WindowsApplication1.Form1.Form1_Mousedown(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
What I don't understand is that once I entered ALL tank models, medium, heavy, tankdestroyer, etc., it worked. I can't see anything that would cause this. Other than perhaps the SFT maker doing something with all SFTypes of the same type, e.g., armor. This has me confounded. But, once I put all the types in, it works, and it also worked in my Divisions mod as well. What concerns me is that the incremental approach did not work at all, so I am not sure what went wrong, or what to fix. I have to say that at times, I also did find that in the editor some of the data under "Models 1", such as ModelItemType" or "ModelResearch" changed while I was editing. For example, I would edit something, like add another model, go back, and notice that the research panel had changed. This was all for NewDawn with no mods. They are all set correctly when I start a game and get this error.
1. Some general questions about how models are made. Some of these are because I haven't had that much experience playing with them, since I only just got it working.
a. When the model is created, is made from a base at the current Tech base. So, if I have "Medium Tank III", will the new SFT be created with the Medium Tank III stats? Which the creation event then modifies.
b. Does the new model also make a new Item that is tied back to this SFT? Which seems to be the only way it could be made since it shows up in the list of items to be produced. Is this Item probed with CheckSFTypeItem? If it is a new Item, is it possible to modify the Item properties (besides cost) in the editor, such as resource costs, and XpMod, MorMod, etc.?
c. Are models fixed by their tech type? Or are they upgradable? By this I mean from I -> II -> III -> IV. I see that one can upgrade a model via the research Tank Combat I-VIII, Tank Anti-Infantry I-VIII, and Tank Mobility I-VIII. Sorry, I just haven't gotten this far with models in a game yet. I suppose it should be possible to upgrade the produced unit in the field, but not the model. Basically, you should have to make a new one.
d. I presume all these different models of course apply to the 8 SFT limit in a unit.
2. In the creation event, which has the loop over TempVar0 FROM 0 TO TempVar7. Is TempVar7 the research level for the type that is specified in the "Models 1" panel? Thus, for Light Tank I, II, III, and IV, would it be 0, 1, 2, 3? I am trying to understand if this is the way levels via technology come in. Because I see that it runs through the possible modifications TempVar7 times. But, per question 1, is this on the stats for Light Tank II, I, III, or IV, depending on the tech level?
3. Events: How does one use the CheckSFTypeVar and ExecSFTypeVar events? Actually, what are the Vars? I presume these are all the variable defining the SFT. Such as all the dat on the Statistic 1 & 2 tabs, Fuel, and Combat Lanscape Mods pages. Can you provide a list? Or is it perhaps as simple as starting on Statistics 1 page to the left, and working down the pages? I am mostly interested in things that are unit attributes, like movement type, supply, carry capacity, recon, zoc, paradrop, number of attacks, and all the Combat LandScape Mods.
4. Is it possible to make the Std. base models unbuildable for a human player? Namely, force them to use models. Is it possible to create a model via an event? For example, say I wanted to create a light tank model for the player before the game started?
I was wondering if you could answer several questions regarding models (and some event functions). Sorry, this will be fairly long, with lots of questions to clarify things.
I'm trying to figure out several aspects of them. I have managed to get models working in my mod, but to tell the truth, I am not exactly sure how. I started this process by working to convert NewDawn over to NewDawn2 (all vanilla) primarily by brining in all the pieces into NewDawn from 2. What I don't understand is that I did tried doing this incrementally. I started with just light tanks. I imported all the string lists and events, and then started up. This did not work. When I tried to create a light tank model, I got an error that was basically the same I got before, which was a subscript out of bounds while running MakeNewSFTypeModel. This message:
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at WindowsApplication1.DataClass.AddSFType()
at WindowsApplication1.ProcessingClass.MakeNewSFTypeModel(Int32 sftypenr)
at WindowsApplication1.SFDesignWindowClass.HandleMouseClick(Int32 x, Int32 y, Int32 b)
at WindowsApplication1.PlayScreenClass.HandleMouseClick(Int32 x, Int32 y, Int32 b)
at WindowsApplication1.Form1.Form1_Mousedown(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
What I don't understand is that once I entered ALL tank models, medium, heavy, tankdestroyer, etc., it worked. I can't see anything that would cause this. Other than perhaps the SFT maker doing something with all SFTypes of the same type, e.g., armor. This has me confounded. But, once I put all the types in, it works, and it also worked in my Divisions mod as well. What concerns me is that the incremental approach did not work at all, so I am not sure what went wrong, or what to fix. I have to say that at times, I also did find that in the editor some of the data under "Models 1", such as ModelItemType" or "ModelResearch" changed while I was editing. For example, I would edit something, like add another model, go back, and notice that the research panel had changed. This was all for NewDawn with no mods. They are all set correctly when I start a game and get this error.
1. Some general questions about how models are made. Some of these are because I haven't had that much experience playing with them, since I only just got it working.
a. When the model is created, is made from a base at the current Tech base. So, if I have "Medium Tank III", will the new SFT be created with the Medium Tank III stats? Which the creation event then modifies.
b. Does the new model also make a new Item that is tied back to this SFT? Which seems to be the only way it could be made since it shows up in the list of items to be produced. Is this Item probed with CheckSFTypeItem? If it is a new Item, is it possible to modify the Item properties (besides cost) in the editor, such as resource costs, and XpMod, MorMod, etc.?
c. Are models fixed by their tech type? Or are they upgradable? By this I mean from I -> II -> III -> IV. I see that one can upgrade a model via the research Tank Combat I-VIII, Tank Anti-Infantry I-VIII, and Tank Mobility I-VIII. Sorry, I just haven't gotten this far with models in a game yet. I suppose it should be possible to upgrade the produced unit in the field, but not the model. Basically, you should have to make a new one.
d. I presume all these different models of course apply to the 8 SFT limit in a unit.
2. In the creation event, which has the loop over TempVar0 FROM 0 TO TempVar7. Is TempVar7 the research level for the type that is specified in the "Models 1" panel? Thus, for Light Tank I, II, III, and IV, would it be 0, 1, 2, 3? I am trying to understand if this is the way levels via technology come in. Because I see that it runs through the possible modifications TempVar7 times. But, per question 1, is this on the stats for Light Tank II, I, III, or IV, depending on the tech level?
3. Events: How does one use the CheckSFTypeVar and ExecSFTypeVar events? Actually, what are the Vars? I presume these are all the variable defining the SFT. Such as all the dat on the Statistic 1 & 2 tabs, Fuel, and Combat Lanscape Mods pages. Can you provide a list? Or is it perhaps as simple as starting on Statistics 1 page to the left, and working down the pages? I am mostly interested in things that are unit attributes, like movement type, supply, carry capacity, recon, zoc, paradrop, number of attacks, and all the Combat LandScape Mods.
4. Is it possible to make the Std. base models unbuildable for a human player? Namely, force them to use models. Is it possible to create a model via an event? For example, say I wanted to create a light tank model for the player before the game started?