How do I add a custom units and heroes into my mod? [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Well I started over and made the TCWdhmaul the the republic clone trooper as you did and in the battle nothing appeared for that unit, the heavy trooper was the first republic unit. Sorry what do you mean by post them? And i'm new to the gametoast forums so I dont know what you mean by hide tags and code tags sorry....

EDIT
I cant run the BF2_modtools because it says blink32.dll is missing from my computer. So another problem, great.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: How do I add a custom units and heroes into my mod?

Post by jedimoose32 »

By post I mean reply to this topic, and in that reply please include those things that I asked for.
Hide tags look like this:
Hidden/Spoiler:
YAY!
And you make them like this but without periods: [hide.]STUFF[/hide.]
The best way to keep a lot of text (such as your Lua file) tidy when pasting it into this text editor is to use code tags, which look like this:

Code: Select all

  local checkPlayerLives = function(playerPtr, numDeaths)
    if IsCharacterHuman(playerPtr) then
    end
  end
And you make them like this, again without periods: [code.]blahblahblah[/code.]
If you're posting a lot of code, put it inside of hide tags so that we aren't bombarded with a wall of text that fills our whole screen. e.g. [hide.][code.]your stuff[/code.][/hide.]

Edit: I really highly recommend you have a look around in the FAQ thread, because a lot of your questions are already answered there. But, you need to put BF2_ModTools in your Battlefront II\GameData\ folder and run it from there for it to work.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Jdi.req
Hidden/Spoiler:
ucft
{
REQN
{
"lvl"
"cis_hero_TCWdhmaul"
}
}

cis_hero_TCWdhmaul.req
Hidden/Spoiler:
ucft
{
REQN
{
"class"
"cis_hero_TCWdhmaul"
}
}
I'll work on the others.

EDIT
Now for the BF2_modtools thing it says please insert cd1 and I think that is because I swbf2 on steam.

EDIT2
Here is the ABCc_con.lua It's easier if you just download it: https://www.dropbox.com/s/5kwbyfetfboj3 ... n.lua?dl=0
Tell me if the link works, it might not right now, im really tired. I might just go to bed.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: How do I add a custom units and heroes into my mod?

Post by jedimoose32 »

I don't know how to use the BF2_ModTools application properly with Steam. Maybe you can't. Use Gametoast's search function to find that out, or check the... :D FAQ thread.

There's nothing wrong with your Lua, and nothing wrong with your two .req files as far as I can tell. So really at this point we would need to figure out how to get your BF2_ModTools working so that you can generate an error log for us to check. As I said, I don't know how that works with Steam, but maybe someone else does.

Here's another thing you can check. If you go to Battlefront II\GameData\Addon\GSD\data\_LVL_PC\SIDE\, is there a jdi.lvl in there? If so, how big is it?
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How do I add a custom units and heroes into my mod?

Post by AnthonyBF2 »

Get the BF2ModTools_NoDVD from the faq. It does not need a disk.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Yeah, and it is 1kb I there supposed to be a tur.lvl in there as well? because there is.

EDIT
And here is the Bfront2.txt: https://www.dropbox.com/s/ogkxfu76rdprk ... 2.log?dl=0
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How do I add a custom units and heroes into my mod?

Post by AnthonyBF2 »

You could try using pastebin.com to present long/simple text files.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

I will next time, its really late for me right now.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How do I add a custom units and heroes into my mod?

Post by AnthonyBF2 »

Looked at your log, No level 3 issues. Nothing else important I don't think... if mod does not work now it is magic... :cpu:
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Really? That sucks. I just don't see why it isn't working.....

EDIT
Wait is my is the odf in data_ABC, sides, jdi supposed to be empty? Because it is. The problem could be that folder is empty.

EDIT2
OMG I GOT IT! I refilled the odf folder, munged again, and now maul is the republic trooper! I can do the same and make him the cis hero right? And when I want him to be the hero I go down to SetheroClass and delete "darthmaul" and type "TCWdhmaul" right? EDIT: I had it working for one map and to test it out I tried the exact same stuff on another and it didn't work. I honestly don't know why its doing this for only me.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: How do I add a custom units and heroes into my mod?

Post by jedimoose32 »

Congratulations! :runaway:

As mentioned in my video... yes, the odf folder needs to have .odf and.combo files (only melee units have .combo files so don't worry about them if you're just adding units with guns). Glad you got that figured out.

To answer your other question, yes, the principles discussed in my video apply to any side. In fact all you need to do if you want to make Darth Maul the CIS trooper is change the Republic trooper back to rep_inf_ep3_rifleman, and scroll down a bit and change the CIS trooper to cis_hero_TCWdhmaul.

It's also easy to make him the CIS hero if you want... just scroll down even further to where it says SetHeroClass(CIS, "some_unit_name") and replace some_unit_name, whatever it is, to cis_hero_TCWdhmaul.

Edit: I might be reading your post wrong but you cannot just change darthmaul to TCWdhmaul. Because the existing name is cis_inf_darthmaul, and yours has to say cis_hero_TCWdhmaul, because that is what your unit is called. You could theoretically name your unit cis_bagel_TCWdhmaul or cis_elephant_TCWdhmaul, as long as that is the name of the unit's .odf file, and that's what is referenced in the side's .req and his unit .req. You must be consistent with your references to that given name.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

So how would I make him a hero? And anyways, I tried doing it over on another map but it wasn't working again D: I really don't know what to do. I'll keep messing around with it though.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: How do I add a custom units and heroes into my mod?

Post by jedimoose32 »

I literally just told you how to make him the CIS hero...
jedimoose32 wrote: It's also easy to make him the CIS hero if you want... just scroll down even further to where it says SetHeroClass(CIS, "some_unit_name") and replace some_unit_name, whatever it is, to cis_hero_TCWdhmaul.
Last edited by jedimoose32 on Tue Mar 17, 2015 11:35 pm, edited 1 time in total.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Oh sorry, dang i'm still kind of tired. Yeah that is what I have been doing. And this Maul isn't working whether I replace the hero or a normal unit. I think I might just take a break from trying to get this maul to work and come back to it at another time. Instead I have a few other questions real quick. How do I change the default heroes and can I use a rep.lvl to change to units in my map? And I did name him cis_hero_TCWdhmaul EVERYWHERE. I like triple checked a few times even.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How do I add a custom units and heroes into my mod?

Post by AnthonyBF2 »

In assets\sides\ odf files u can get the names of heroes. You would call a hero from it's respective level.
cis_hero_jangofett exists only in cis assets so you must call him from cis.lvl.

Also about hero, and assigning teams and stuff you can look at assets\scripts\tat\tat2g_eli.lua
That level code deals with all of the heroes, and has some specific pools and things.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Thanks, I got the hero stuff down. I asked Nedarb7 on steam and he told me how to do it real quick. I would still like to know how to use a rep.lvl in my mod? Is that possible? So what I mean is I downloaded a rep.lvl with 212th troopers on it and would like to use it in my map for the time being.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How do I add a custom units and heroes into my mod?

Post by AnthonyBF2 »

You have to know the names of the characters / vehicles you wanna call from the level.
I have to think anyone who releases a .lvl file would put such notes in a document for the users.

Using it is easy, in the map code put ReadDataFile("dc:SIDE... blah blah and set it up in teams or as heroes.

When your mod is made, manually go to addon and inside _lvl_pc make SIDE folder, if it's not there and copy in the .lvl that the script is grabbing things from.
hunpeter12
Command Sergeant Major
Command Sergeant Major
Posts: 260
Joined: Mon Apr 18, 2011 2:53 pm
Projects :: Underground City The Complex [WIP]
Games I'm Playing :: SWBF2

Re: How do I add a custom units and heroes into my mod?

Post by hunpeter12 »

anthonybf2 wrote:You have to know the names of the characters / vehicles you wanna call from the level.
I have to think anyone who releases a .lvl file would put such notes in a document for the users.
I believe you can also get the class names from the .lvl file via Hex editing, but I have no experience in that.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How do I add a custom units and heroes into my mod?

Post by AnthonyBF2 »

What I've done which I think is pretty clever, is find a mod map with something I liked. Scanned the mission.lvl in hex editor and search for "luap" , until it lands on something like "modg_con" then just read down where it says ReadDataFile, there you can see the names of things being called from a modded side lvl file, and call them in your own script as long as the same .lvl file is manually copied in your addon side folder.
Sandtrooper956
Corporal
Corporal
Posts: 158
Joined: Thu Jul 31, 2014 3:58 pm
Projects :: Just some little things
Games I'm Playing :: SWBF2 and EAW
xbox live or psn: No gamertag set

Re: How do I add a custom units and heroes into my mod?

Post by Sandtrooper956 »

Okay, thanks both of you! I'll try these things out later.

EDIT
I got the custom Darth Maul working as my hero! Thanks everyone!
Post Reply