Battlezone Universe

Battlezone Universe => Battlezone 2 => Maps and Modding => Topic started by: TheJamsh on May 03, 2009, 08:51:58 AM

Title: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 08:51:58 AM
Right... im trying to modify bzshell_multi_mpi3.cfg (or whichever one it is), to allow me to choose a CPU recycler variant. seeing as ive made AIP's for one.

However, i cant get it to work. using a similar method to the AIP's and the human recycler (but changing the svar to 12), still doesn't give me any recycler variants. I cant use buttons either.

How can i do it? Is someone seriously telling me there isn't the ability to do this?
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 11:10:22 AM
I'm not sure, but having seen the MPI sourcecode I dont see anything from there that would prevent it.
Post the code you have now, perhaps you did a booboo :)
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 11:18:12 AM
No the codes fine, it uses the same thing as the AIP and Human recycler code (copy and paste with some edits).

The boxxes are automatically filled with netcommands.cpp, but this one isnt. In instant mode it uses something else.

Does anyone know if its possible any other way? I dont REALLY want to have to tell people to use the console to spec my variant on the CPU...
Title: Re: Need a hand with this shell file...
Post by: mrtwosheds on May 03, 2009, 11:51:30 AM
Any AI recycler/or constructor will build any units you tell it to with an aip, the list of units in the odf is irrelevant to the AI, and does not limit what it can build. So unless you have actually altered the cpu recycler itself you do not need to change it.
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 11:56:50 AM
Well, this is the code for the AI-recy:
m_CPURecycler = GetObjectByTeamSlot(m_CPUTeamNumber, DLL_TEAM_SLOT_RECYCLER);
if(m_CPURecycler == 0)
{
char startRecyODF[64];
const char *Contents = GetVarItemStr("network.session.svar12");
if((Contents != NULL) && (Contents[0] != '\0'))
strncpy_s(startRecyODF, Contents, sizeof(startRecyODF)-1);
else
strcpy_s(startRecyODF, "*vrecycpu");

startRecyODF[0] = (char)m_CPUTeamRace;
if(!DoesODFExist(startRecyODF))
{
strcpy_s(startRecyODF, "*vrecycpu");
}

m_CPURecycler = BuildStartingVehicle(m_CPUTeamNumber, m_CPUTeamRace, startRecyODF, "*vrecy", "RecyclerEnemy");
}
pRecyclerHandles[m_CPUTeamNumber] = m_CPURecycler;
pTeamIsSetUp[m_CPUTeamNumber] = true;


and this for the AIPs:
if(!CheckedSVar3)
{
CheckedSVar3 = true;
const char *Contents = GetVarItemStr("network.session.svar3");
if((Contents == NULL) || (Contents[0] == '\0'))
{
// Use the default 1.3 naming scheme if not specified.
strcpy_s(CustomAIPNameBase, "stock13_");
}
else
{
strcpy_s(CustomAIPNameBase, Contents);
}
}

if((Type<0) || (Type >= MAX_AIP_TYPE))
Type = AIPType3; // Default

// Try to keep AI from getting hung up if user rushes them - NM 7/15/05
if(((Type > AIPType3) && (m_CPUCommBunkerCount == 0)) && (m_LastCPUPlan <= AIPType3))
return;

char AIPFile[256];
sprintf_s(AIPFile, "%s%c%c%c.aip", CustomAIPNameBase,
(char)m_CPUTeamRace, (char)m_HumanTeamRace, AIPTypeExtensions[Type]);
SetPlan(AIPFile, m_CPUTeamNumber);


I dont see any reall difference between how the code gets and uses the information. It clearly does work with svar12 ...


Quote from: mrtwosheds on May 03, 2009, 11:51:30 AM
Any AI recycler/or constructor will build any units you tell it to with an aip, the list of units in the odf is irrelevant to the AI, and does not limit what it can build. So unless you have actually altered the cpu recycler itself you do not need to change it.

Thats not completelly true, set up scout1 to scout10 and let the AI build all of them. In 1.2 after a number of scouts came from the recy the rest got produced by the factory.
Plus there can be other reasons why you would want to specify a custom recy. In that case you need 'something', why not use the existing vars than instead of creating a new netvar ..
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 01:00:40 PM
Constructors in particular dont seem to follow that rule anymore. They wont build an item if it isnt in the build tree.

Not only that, but i HAVE modified the original recycler (building).

Im not programmer, but i can see a huge difference. listboxes are filled with possible aip's via AUTOREG files. There is NO [header] in an autoreg file for svar12 (e.g. MPIRecyclerCPU or something)

EDIT: Wait, that looks like mpinstant.dll. Thats useless to me... And i already am using an existing var (svar12), not making a new one. That would never work
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 01:49:41 PM
Quote from: TheJamsh on May 03, 2009, 01:00:40 PM
EDIT: Wait, that looks like mpinstant.dll. Thats useless to me...

Quote from: TheJamsh on May 03, 2009, 08:51:58 AM
Right... im trying to modify bzshell_multi_mpi3.cfg

.. er.. you do realise that those files basicly go hand in hand ?

and:
[IACPURecyclerList]
ODFName = "ivrecycpu"
Description = "Default CPU Recycler"


try that ....

edit: perhaps you could also try somethings like: "CPURecyclerListMPI", for humans the IA versions come with a 'human' tag but for the MP recy's it just talks about 'recylist[gametype]', no human or AI specified but it only seems to work for the humans.

If you can give me your mpi3.cfg file I could check somethings out myself, I have to figure this out anyway. Beter to combine knowledge than both of us having to go through the same tests etc ..
Title: Re: Need a hand with this shell file...
Post by: mrtwosheds on May 03, 2009, 02:45:28 PM
QuoteConstructors in particular dont seem to follow that rule anymore. They wont build an item if it isnt in the build tree.
Mine do. There is only 1 dvcons, it does not have an entry for dbreed, but the cpu team manages to build one anyway.
both factory and recy build a whole range of units not listed in their build trees.
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 03:13:55 PM
Deleted it... lol.

That entry in autoreg doesnt work. ive tried it many times. the IA one really is for IA only, and instant action uses its own variable to get the CPU recycler.

Two sheds is right... they do seem to be building now. Well i guess we can wave goodbye to the enemy recycler in my mode having its gun turrets tapped on.

BTW, the mpinstant.dll only reads information from the shell AFTER you start the game. Its the hardcoded part of BZ2 that fills in the boxes with autoreg data, not the mpinstant.dll
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 03:40:45 PM
Quote from: TheJamsh on May 03, 2009, 03:13:55 PM
BTW, the mpinstant.dll only reads information from the shell AFTER you start the game. Its the hardcoded part of BZ2 that fills in the boxes with autoreg data, not the mpinstant.dll

I know, what I mean is that if you would be able to feed the svar12 to the dll through the shell I do not see any reason it would not work ...
I will try to set up a basic test regarding this tonight and see if I fail at it as well. I really want to be able to get this option into the shell.
(My concept for this is that the name of the recy should switch different AIPs as well, meaning if you pick ivrecycpu_rs1 the dll will load the AIP you chose but at the end _rs1, so for instance if you take the insane AIPs than for the default recy it should load "insaneii0" and for the modded recy "insane_rs1ii0")
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 04:43:34 PM
No need, sorted the aip out, works with all variants now.

The problem isnt getting svar12 into the .dll, it looks for svar12 in the maps thing. The problem i've got is that if the shell file doesn't have recognised stuff in it it'll just AV. There is no current shell set of variables for the recycler... Its hard to explain.
Title: Re: Need a hand with this shell file...
Post by: mrtwosheds on May 03, 2009, 05:01:19 PM
QuoteWell i guess we can wave goodbye to the enemy recycler in my mode having its gun turrets tapped on.
I just made the cpu recycler recycler always be the one with turrets on it. Human players can choose not to have them on theirs if they want to.
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 05:56:06 PM
Yeh but being for a TA5 addon pack (which i might change the name off seeing as no-ones overly enthusiastic on the idea) i dont want to mess with stock assets unless its campaign fixes.
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 06:28:26 PM
(http://members.ziggo.nl/red_spot/Nieuw%20-%20Bitmapafbeelding.jpg)

I really need to clean up the shell stuf used before I will show it .. and it only allows you to pick between 2 preset recyclers, but it can be done from the shell without altering dll's.

Really need to start making dinner now (20:30 already) but after that I will clean up the stuff used and show you how you can do it.
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 08:33:34 PM
Just incase you would still like to include the choise of different CPU recyclers ...

(http://members.ziggo.nl/red_spot/cpu%20recy.jpg)

I added this to the mpi3 file:
CreateControl("EditCPURecy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Position(20, 180);
Size(100, 9);
BorderSize(3);
BevelSize(3);
Style("Rollover", "OUTLINE");
Cursor("Highlight");
Font("TINY");
Text("CPU Recycler");
NotifyParent("Button::Press","EditRecy");
}

OnEvent("EditRecy")
{
Exec("bzshell_multi_redsrecy.cfg");
FadeIn("|RedsRecy");
}


The bzshell_multi_redsrecy.cfg file:
CreateControl("RedsRecy", "STATIC")
{
Geometry("PARENTWIDTH", "PARENTHEIGHT");
ColorGroup("BACKGROUND");
Style("MODAL");

CreateControl("CPURecy", "STATIC")
{
Geom("HCENTRE", "VCENTRE");
ColorGroup("MAGENTA");
Pos(0, 0);
Size(200, 50);
BorderSize(10);
BevelSize(5);
TabSize(150, 10);
Style("OUTLINE", "TABROOT");
Title("CPU Recycler");
TitleFont("MEDIUM");

CreateControl("VanillaRecy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(10, 25);
Size(80, 10);
BorderSize(5);
BevelSize(5);
Style("ROLLOVER", "OUTLINE");
Font("SMALL");
Text("Vanilla");
NotifyParent("Button::Press", "Vanilla");
}

OnEvent("Vanilla")
{
Cmd("network.session.svar12 ivrecycpu");
FadeOut("|RedsRecy");
}

CreateControl("RedsRecy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("RIGHT", "TOP");
Pos(-10, 25);
Size(80, 10);
BorderSize(5);
BevelSize(5);
Style("ROLLOVER", "OUTLINE");
Font("SMALL");
Text("Reds Recy");
NotifyParent("Button::Press", "Reds");
}

OnEvent("Reds")
{
Cmd("network.session.svar12 ivrecycpu_rs1");
FadeOut("|RedsRecy");
}
}
}



After 40 or so crashes I figured I needed an other aproach as I wasnt getting anywhere so I started thinking if there where any other "strings" that can be edited from the shell and realised there is, the teamname option. So I made a crude copy of that and tweaked it a bit.
It was probably easier to alter the MPI.dll but now I do know it is (sort of) possible, still not as I would like to see it but still a lot beter than only the maps .inf file ....
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 08:54:34 PM
Ah well done red_spot!

I knew there must be a way around it. didnt think using CMD would work. Youre a genius! Thankyou kindly!
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 10:05:32 PM
You're welcome. I wanted to know it myself anyway, now I know it a bit sooner than planned :)
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 10:12:23 PM
Here it is in all its glory, and working. look close enough you can see another little extra in there too :P

(http://i239.photobucket.com/albums/ff29/thejamsh/successfulshell.jpg)
Title: Re: Need a hand with this shell file...
Post by: Nielk1 on May 03, 2009, 10:18:59 PM
I already have 2 recs planned to be in with MRVP's installer. Maybe we need 2 more?

MRVP's Recs
SRV
NRV

Should we add:
TJRV and RSRV?

I ask because MRVP is rather heavy on shell modifications lately. It does its best to stay out of the way and instead create a tool bar style system, but I would have to patch it for every shell editing always on mod that comes out unless we work more together.

I wonder if the other guy who had the cool magnetic thrower buildings is making a rec.

Jamsh's and my philosophy for add on configuration are different, so I think I may be helping him split his 'addon pack' into 'Always On' and 'Toggle as Mod' pieces.

Neat shell edits, could use you all helping me out :D
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 10:21:16 PM
Where and what is RSRV?

Oh wait... Red Spot. Hah got it.
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 10:33:19 PM
Quote from: TheJamsh on May 03, 2009, 10:12:23 PM
Here it is in all its glory, and working. look close enough you can see another little extra in there too :P

code!! ;)


Nielk1,

I really dont mind helping out or sharing resources but the way I'm setting things up its all heavilly mod-based and by itself already conflicts with vanilla so I doubt we could combine our assets, but any 'concept' I may come up with is free for use.
My work will heavilly rely on a combination of AIPs, dll, and AI-impoving tweaks, in a way it will stay vanilla, in an other way it will drasticly change it ... hopefully for the beter (as in make the AI 'seem' smarter and more competitive)
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 10:40:30 PM
Not quite :P

I was referring to the new AIP difficulty "Merciless". Hopefully itll even keep vets on their toes.
Title: Re: Need a hand with this shell file...
Post by: Steeveeo on May 03, 2009, 10:42:27 PM
...merciless...O_O
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 10:47:15 PM
Quote from: TheJamsh on May 03, 2009, 10:40:30 PM
Not quite :P

I was referring to the new AIP difficulty "Merciless". Hopefully itll even keep vets on their toes.

So now I need 6 atanks instead of 5 ? :P (j/k)

But how did you set up that recycler selection? Or am I mistaken that it seems like you have a 3-option choise in your shell? (I couldnt get the recy-switch to work without a pop-up menu, the 'cmd' didnt work if I didnt sort of left the shell (by pop-up))
Title: Re: Need a hand with this shell file...
Post by: TheJamsh on May 03, 2009, 10:49:54 PM
it still involves using two files. The following was added to mpi3:


//////////////////////////////////////////////////////////////
CreateControl("CPURecy", "Window")
{
ColorGroup("MAGENTA");
Geometry("LEFT", "TOP");
Pos(5, 180);
Size(260, 45);
BorderSize(10);
BevelSize(5);
TabSize(140, 10);
Style("INERT", "RIGHTTAB", "OUTLINE");
Title("CPU Recycler");
TitleFont("SMALL");

CreateControl("DefaultCPURecy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(0, 0);
Size(250, 5);
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "OUTLINE");
Font("TINY");
JustifyText("LEFT");
Text("Default CPU Recycler");
NotifyParent("Button::Press", "DefaultCPURecy");
}

OnEvent("DefaultCPURecy")
{
Cmd("network.session.svar12 ivrecycpu");
Exec("CPURecySet.cfg");
FadeIn("|CPURecySet");
}

CreateControl("TJCPURecy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(0, 20);
Size(250, 5);
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "OUTLINE");
Font("TINY");
JustifyText("LEFT");
Text("TheJamsh Variant");
NotifyParent("Button::Press", "TJCPURecy");
}

OnEvent("TJCPURecy")
{
Cmd("network.session.svar12 ivrecy_tj");
Exec("CPURecySet.cfg");
FadeIn("|CPURecySet");
}

CreateControl("TJDFCPURecy", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
Pos(0, 40);
Size(250, 5);
BorderSize(3);
BevelSize(3);
Style("ROLLOVER", "OUTLINE");
Font("TINY");
JustifyText("LEFT");
Text("TheJamsh Defensive Variant");
NotifyParent("Button::Press", "TJDFCPURecy");
}

OnEvent("TJDFCPURecy")
{
Cmd("network.session.svar12 ivrecydf_tj");
Exec("CPURecySet.cfg");
FadeIn("|CPURecySet");
}

}
///////////////////////////////////////////////////////////

CreateControl("CPURecyDescButton", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("LEFT", "TOP");
JustifyText("CENTER");
Position(153, 242);
Size(100, 9);
BorderSize(3);
BevelSize(3);
Font("TINY");
Text("CPU Recycler Info");
Style("ROLLOVER", "OUTLINE");
Cursor("Highlight");
NotifyParent("Button::Press", "CPURecyDescButton");
}

OnEvent("CPURecyDescButton")
{
Exec("CPURecyDesc.cfg");
FadeIn("|CPURecyDesc");
}


AND this is the little pop-up box. I tested and it does work.


// ================
// BATTLEZONE SHELL
// ================

//
// CREATE THE CPU RECYCLER SET DIALOG. CREATED BY THEJAMSH.
//

CreateControl("CPURecySet", "WINDOW")
{
// inherit root window's dimensions
Geometry("PARENTWIDTH", "PARENTHEIGHT");

ColorGroup("BACKGROUND");

Style("MODAL");

CreateControl("RecySet", "WINDOW")
{

Geometry("RIGHT", "VCENTER");
ColorGroup("MAGENTA");
Position(-65, 0);
Size(180, 50);
BorderSize(10);
BevelSize(5);
Style("INERT", "OUTLINE");

CreateControl("CloseCPURecySet", "BUTTON")
{
ColorGroup("BLACKBLUE");
Geometry("HCENTRE", "TOP");
Position(0, 35);
Size(40, 10);
BorderSize(3);
BevelSize(3);
Style("ROLLOVER");
Cursor("Highlight");
Font("SMALL");
Text("OK");
NotifyParent("Button::Press","CloseCPURecySet");
}

CreateControl("RecSetCPU", "BUTTON")
{
ColorGroup("LISTBOX");
Geom("TOP", "HCENTRE");
Pos(0, 10);
Size(160, 10);
BorderSize(5);
BevelSize(3);
Style("INERT", "NOSELECTION");
Cursor("Highlight");
Font("SMALL");
Text("Recycler Set!");
}

OnEvent("CloseCPURecySet")
{
FadeOut("|CPURecySet");
}


}
}
Title: Re: Need a hand with this shell file...
Post by: Red Spot on May 03, 2009, 10:56:37 PM
Thanks, than or I made some mistake in an earlier attempt or the confirmation pop-up is enough to 'refresh' the shell (or something like that) Anyway, a good example of why combining effort works :)