Modes - Woot I did it all by my self
Moderator: Moderators
-
RepSharpshooter
- Gametoast Staff

- Posts: 1351
- Joined: Tue Jul 10, 2007 4:10 pm
Modes - Woot I did it all by my self
How does one go about creating new modes, unique from the existing ones? Is there a limit to the number of modes? I dabbled around in the LUA scripts, and failed to find something related to modes. Teancum talked about hex editing the mission lvl. How is that done? And is there a way to just munge a script or something? I'm very ignorant on this issue. I'm sure there's something there, but I've been looking, and I don't know where to look.
Last edited by RepSharpshooter on Thu Dec 27, 2007 11:18 pm, edited 1 time in total.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Modes
Creating all new modes requires rebuilding shell.lvl, which is not fun. However, if you want to add any modes from the Conversion Pack or the shipped game there's a few topics on it if you search.
-
RepSharpshooter
- Gametoast Staff

- Posts: 1351
- Joined: Tue Jul 10, 2007 4:10 pm
Re: Modes
http://www.gametoast.com/forums/viewtop ... ll#p214061
Nothing was really accomplished there, but this seems to go over it, I'll see what I can do (may not be much, but I am a C++ programmer, whatever that's worth (probably not worth much either
))
Nothing was really accomplished there, but this seems to go over it, I'll see what I can do (may not be much, but I am a C++ programmer, whatever that's worth (probably not worth much either
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Modes
Yeah, all that stuff is involved in building the shell. There's a few lua's you have to do a bunch of edits to, then icons and reqs. Plus it'll conflict with the convo pack shell. If I ever rebuild the convo pack shell I'll add however many modes you want.
-
RepSharpshooter
- Gametoast Staff

- Posts: 1351
- Joined: Tue Jul 10, 2007 4:10 pm
Re: Modes
Hidden/Spoiler:
addme:
Hidden/Spoiler:
EDIT did this:
Hidden/Spoiler:
EDIT: Changed ifs_missionselect_pcmulti.lua as follows:
Hidden/Spoiler:
Hidden/Spoiler:
It makes this.mode_checkbox which then checks against, uh something, still working on it. I need to find the part where it iterates through this and it is displayed.
This is what displays it? I think here it is checking if the key for the mode in the mission select list = the key in the check box. Then what does it do? I have no idea, displays it?
Hidden/Spoiler:
Hmm I may just end up using Zerted's shell, lol. I still want to know how this works though, I'm a lot farther into understanding how the game works. If I just sat back and went off the work of others, I wouldn't have learned anything useful to me later.
Edit: missionlist_ExpandModelist is used in missionselect_pcmulti when you select a map, it returns which modes it has. I'm going to print that out, and I'll see if the addme lua correctly added a "ffa" mode.
EDIT: Ok, so missionlist_ExpandModelist returned an array with 4 elements, hence 4 modes were detected from my addme lua. That's good. Here is a function that calls missionlist_ExpandModelist. Its name: ShowHideGameModes. So I think this is were things either work/don't work. I'm assuming my little mode_ffa was sent in ret from missionlist_ExpandModelist, (I DON'T KNOW CAUSE I DON'T KNOW HOW To print out elements of a table and the lua resources are too blah). So Assuming the mode_ffa went into that, it must be something here that is screwy.
Hidden/Spoiler:
EDIT: Ok blah = 3 and gibble is 4. blah SHOULD be 4 and gibble should be 5 I think.
Blah = number of modes in the mode list
gibble = number of elements returned from missionlist_ExpandModelist
So ExpandModelist isn't doing it's job, it's missing my ffa mode. I'll look around and see what's up.
EDIT: this is what printed out of that ^ function:
Gibble chuh: ret 1 modename.name.con
Gibble chuh: ret 2 modename.name.ctf
Gibble chuh: ret 3 modename.name.assault
Gibble chuh: ret 4 modename.name._all_modes_
That's why gibble is one more than blah. All modes is on the end
EDIT WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT
It worked
Addme lua needed to be mode_ffa_g not just mode_ffa xD
Hey you could use this as a strange tutorial if I clean it up.
Now, about localizing it, hopefully, I can just put it in my addon folder, and it'll read the local core keys.
EDIT: Localizing via addme script = fail. I don't know how else to localize it. Even with zerted's shell, how would I localize it? Can't you define hard coded strings in the LUA? I don't care if the germans can't read it
- authraw
- 1st Lieutenant

- Posts: 445
- Joined: Mon Jun 26, 2006 3:45 pm
Re: Modes - Woot I did it all by my self
With such descriptive variables as "gibble" and "blah", it's no wonder you were able to figure it out on your own. 
Way to go! Now I just need a nice big chunk of free time so I can try to follow what you did here and another chunk to decide whether or not it's really worth pursuing.
Way to go! Now I just need a nice big chunk of free time so I can try to follow what you did here and another chunk to decide whether or not it's really worth pursuing.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Modes - Woot I did it all by my self
It's best to localize without replacing core.lvl. I had a custom core.lvl, but never could get the sound settings right, causing it to be much harder on a sound card (mine would constantly give out that annoying sound you get when you push a card to hard).
As far as localizing it, there's an easier way. In ifs_missionselect_pcmulti.lua change
{
key = "mode_ffa", showstr = "modename.name.ffa",
descstr = "modename.description.ffa", subst = "[Diet Dr Pepper]",
icon = "mode_icon_Diet Dr. Pepper",
},
to
{
key = "mode_ffa", showstr = "Free For All (appears next to checkbox)",
descstr = "RepSharpShooter's description (appears at the bottom)", subst = "[Diet Dr Pepper]",
icon = "mode_icon_Diet Dr. Pepper",
},
The icons need to be added to shell.req so to have them appear. Other than that you've got it. Actually, there's some steps you don't even need. I mostly discouraged it due to the fact that I didn't know how good of a coder you were. If I remember right I just added to ifs_missionselect_pcmulti.lua and then added the new icon to the req. Any of the actual custom code for that mode goes in /data_###/common/scripts
As far as localizing it, there's an easier way. In ifs_missionselect_pcmulti.lua change
{
key = "mode_ffa", showstr = "modename.name.ffa",
descstr = "modename.description.ffa", subst = "[Diet Dr Pepper]",
icon = "mode_icon_Diet Dr. Pepper",
},
to
{
key = "mode_ffa", showstr = "Free For All (appears next to checkbox)",
descstr = "RepSharpShooter's description (appears at the bottom)", subst = "[Diet Dr Pepper]",
icon = "mode_icon_Diet Dr. Pepper",
},
The icons need to be added to shell.req so to have them appear. Other than that you've got it. Actually, there's some steps you don't even need. I mostly discouraged it due to the fact that I didn't know how good of a coder you were. If I remember right I just added to ifs_missionselect_pcmulti.lua and then added the new icon to the req. Any of the actual custom code for that mode goes in /data_###/common/scripts
-
RepSharpshooter
- Gametoast Staff

- Posts: 1351
- Joined: Tue Jul 10, 2007 4:10 pm
Re: Modes - Woot I did it all by my self
Now I thought I could do that, somehow, last time I tried to define a string like that, it didn't work, so I was weary about it, but I knew it could be done like that. Yeah there may be some steps I didn't need, because half the time I didn't even know what I was doing. It turned out my addme lua was wrong, and my mode could have worked a long time ago.
One thing though, I'd like to warn you about (Zerted probably already fixed it being the genius he is, but)
In ifs_missionselect_pcmulti, in function ifs_missionselect_pcMulti_fnAddModeBoxes(this), theres a couple lines of code:
Now the lazy coders put 6 in instead of a constant, or looking up how many previous modes there were. When I added a mode, I needed to change it to 7. I'd replace that number with table.getn(mode_list) to make it redundant no matter how many modes you add. Or you could just add this to the mode_list array, doesn't matter. When I left it at 6, it'd overwrite the XL key over my FFA (both being at location 6)
One thing though, I'd like to warn you about (Zerted probably already fixed it being the genius he is, but)
In ifs_missionselect_pcmulti, in function ifs_missionselect_pcMulti_fnAddModeBoxes(this), theres a couple lines of code:
Code: Select all
if( this == ifs_missionselect ) then
mode_list[6] =
{
key = "mode_xl", showstr = "modename.name.xl",
descstr = "modename.description.xl", subst = "xl",
icon = "mode_icon_XL",
}
end