Page 1 of 1

2 layer problems

Posted: Tue Aug 19, 2008 4:57 pm
by MandeRek
Okay, i wanted to add a layer to another lvl world/munged world.. The layer is base, in LAY.lvl.

It loaded like everyother layer. Now both layers seem to showup, only it seems that my cp-props of the original world have dissapeared; all units spawn somewhere very weird and occasionally, die!! Anyone got an idea how to add my objects to another world without messing it up? I tried replacing objects through lua, but i got stuck on 2 things:

- Couldn't find the name of the object to replace
- Didn't know how to do this through scripting

Any help would be VERY welcome since i REALLY need this.. thanks :)

Re: 2 layer problems

Posted: Tue Aug 19, 2008 10:03 pm
by [RDH]Zerted
I'm not sure how you can find all the objects in your map (maybe hex editing), but you may be able to disable all the other CPs. Just read the scripting system doc. Command posts have labels, capture regions, control regions, and spawn paths (among many other things). Use any of the CP event callbacks to get a reference to CP object, then use SetProperty() or other functions to kill it.

If you are able to print out the CP names, then you can just add those killing functions to your final map (You will have to play through it at least once with all the extra CP event handling to grab all the CP references).

Edit:
Oh, there is a easier way to get the CP names and other info. Assuming its a map where the CPs are in the lua (like Conquest), then use the v1.3 patch's Print Globals Nested command. Its a real pain to shift through its 37,749+ lines of game variables, but the CP names will be in there. Searching for "commandPosts" might help you find them faster. You are looking for something similar to this:
Hidden/Spoiler:
[code]0: Key, Value: conquest table: 03DD1A8C
1: Key, Value: AIGoalWeight 1
1: Key, Value: teamATT 1
1: Key, Value: multiplayerRules true
1: Key, Value: timeLimitWinningTeam 1
1: Key, Value: usingGameOptionsTimeLimit 0
1: Key, Value: textDEF game.modes.con2
1: Key, Value: teamDEF 2
1: Key, Value: textATT game.modes.con
1: Key, Value: AIGoals table: 03DD1B6C
2: Key, Value: 1 userdata: 053D871C
2: Key, Value: 2 userdata: 053D8758

1: Key, Value: disallowDefensiveVictory false
1: Key, Value: timeLimit 0
1: Key, Value: defeatTimer userdata: 0598B0B8
1: Key, Value: isComplete false
1: Key, Value: winningTeam 0
1: Key, Value: bleedTimer table: 03DD1B4C
2: Key, Value: 1 userdata: 0598B060
2: Key, Value: 2 userdata: 0598B08C

1: Key, Value: commandPosts table: 03DD1AAC
2: Key, Value: cp3 table: 03DD1A2C
3: Key, Value: name cp3

2: Key, Value: cp4 table: 03DD1A4C
3: Key, Value: name cp4

2: Key, Value: cp1 table: 03DD19EC
3: Key, Value: name cp1

2: Key, Value: cp5 table: 03DD1A6C
3: Key, Value: name cp5

2: Key, Value: cp2 table: 03DD1A0C
3: Key, Value: name cp2


1: Key, Value: totalBleedValue table: 03DD1B2C
2: Key, Value: 1 50
2: Key, Value: 2 50


0: Key, Value:[/code]

Re: 2 layer problems

Posted: Wed Aug 20, 2008 4:16 am
by MandeRek
Okay, that's for cps.. Now say i wanna replace a CP by scripting/lua, for another object out off a side..

Can someone give me a clear explanation how to do that?

Re: 2 layer problems

Posted: Wed Aug 20, 2008 9:52 am
by Teancum
Well, that's gonna be a lot more complex. You can use SetProperty for a lot of it, but I don't know that you can change the class from "controlzone" to something else using it. It's worth a shot.

Re: 2 layer problems

Posted: Wed Aug 20, 2008 9:54 am
by MandeRek
Teancum wrote:Well, that's gonna be a lot more complex. You can use SetProperty for a lot of it, but I don't know that you can change the class from "controlzone" to something else using it. It's worth a shot.
Isn't there a way to replace an odf from a same-named odf from another side?

I need to replace the odf, but in that side's odf there's also linked to other meshes ofcourse, i need to replace the whole thing..

There must be a way besides SetProperty lines..

Re: 2 layer problems

Posted: Wed Aug 20, 2008 10:13 am
by Teancum
Well, typically speaking whichever lvl gets loaded first will overwrite stuff in the second, but they have to be named the same.

So theoretically you could do:
ReadDataFile("DC://123/NEW/123.lvl")
ReadDataFile("DC://123/123.lvl")

And load your updated odfs in the top lvl.

Re: 2 layer problems

Posted: Wed Aug 20, 2008 10:22 am
by MandeRek
Teancum wrote:Well, typically speaking whichever lvl gets loaded first will overwrite stuff in the second, but they have to be named the same.

So theoretically you could do:
ReadDataFile("DC://123/NEW/123.lvl")
ReadDataFile("DC://123/123.lvl")

And load your updated odfs in the top lvl.
Does that count for position as well?! Okay, I'll definetaly give this a go, thanks for explaining..