#1 29-09-2011 21:34

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

GTASA - Replacing buildings in CLEO mission scripts

Hi everyone,

just wondered if it is possible to swap building models as a result of completed missions. I've studied the original mission "Deconstruction" where the game does just that, and have messed with 03B6: replace_model_at, but so far only managed to crash my game .

I've added my new building objects to the .ide files of the appropriate region with object numbers 19001 and 19002. No ipl entry. Any ideas what I'm missing here? Any help would be greatly appreciated.

Cheers
Lester

Offline

#2 30-09-2011 00:29

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTASA - Replacing buildings in CLEO mission scripts

1.Correct ID for new objects are 18631 - 18635.
2.Why you did not write objects into ipl? How you will use these objects?

Offline

#3 30-09-2011 10:05

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

Re: GTASA - Replacing buildings in CLEO mission scripts

Thanks for the quick reply! Will try the new ID range you mentioned.

EDIT: Just realized the new buildings probably shouldn't be in an ipl, because then they would always be displayed.

Also when I look at the IPL, the original building doesn't seem to be present in there. I'm messing with sw_apartments02 and sw_apartments07 which are the two halves of the savehouse in Blueberry. (I want to replace both with new models.) They are declared in countryE.ide, so I have added my new replacement buildings also in there. However, in countryE.ipl there is no trace of the original buildings. Only the LOD objects (LODsw_apartments01 & LODsw_apartments07) are declared.

EDIT: Tried IDs 18631 18632 for the two new buildings. Still crashing.

Last edited by lesterdfunct (01-10-2011 14:13)

Offline

#4 30-09-2011 15:17

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTASA - Replacing buildings in CLEO mission scripts

Just realized the new buildings propbably shouldn't be in an ipl

Maybe. But how coordinates of objects placing are defined? This function is done by ipl-files mostly.
18631-18635 must work - I used it. You did mistake somewhere. Did you add collision files into gta3.img?

Offline

#5 30-09-2011 17:44

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

Re: GTASA - Replacing buildings in CLEO mission scripts

Den_spb wrote:

Just realized the new buildings propbably shouldn't be in an ipl

Maybe. But how coordinates of objects placing are defined? This function is done by ipl-files mostly.
18631-18635 must work - I used it. You did mistake somewhere. Did you add collision files into gta3.img?

I'm using:

03B6: replace_model_at 201.094 -106.578 4.45312 radius 20.0 from 12938 to 18631
03B6: replace_model_at 166.617 -106.578 4.45312 radius 20.0 from 12940 to 18632

which sets the coordinates. The game uses radius 20.0 when replacing an object in the mission "Deconstruction", but I'd love to know what kind of radius that actually refers to. I've tried a couple of values up to 70.0, neither work.

I haven't touched collision files at all as my new building is just a renovated version of the old one.

Offline

#6 30-09-2011 18:00

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTASA - Replacing buildings in CLEO mission scripts

I haven't touched collision files at all as my new building is just a renovated version of the old one.

New model must have own collision, because you identified it in ide-file as new individual object. You should do collision-file for new object with the same name as dff-file and put collision model into any defined col-archive.

Last edited by Den_spb (30-09-2011 18:00)

Offline

#7 01-10-2011 14:10

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

Re: GTASA - Replacing buildings in CLEO mission scripts

Thanks for all your input so far! Really grateful to get some help with my mod-in-progress.

Do cols actually contain positioning data? When I add my new cols to the gta3.img WITHOUT adding my IDE and IPL, the col data immediately takes effect in the game. (Strange.) When I add my IDE and IPL to the game via gta.dat, it crashes upon starting a new game.

If I analyse this logically I get:
1) The dff and txd must be alright, because when I replace the original dff and txd with my new ones, everything works fine.

2) When I simply add the new cols to the gta3.img, they take effect. So they can't be too wrong either.

3) Whenever I try to actually add my building to the game, it crashes.

Here's my IDE:

objs
18631, bbinn02, bbinn, 299,0
end
tobj
end
path
end
2dfx
end
anim
end
txdp
end

Here's my IPL:

inst
18631, bbinn02, 0, 501.09375, -106.578125, 4.453125, 0, 0, 0, 1, -1
end
cull
end
path
end
grge
end
enex
end
pick
end
jump
end
tcyc
end
auzo
end
mult
end

I've tried all kinds of object numbers, neither work. Any help would be greatly appreciated.

Last edited by lesterdfunct (01-10-2011 14:15)

Offline

#8 01-10-2011 20:02

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTASA - Replacing buildings in CLEO mission scripts

Collision is reason of mistakes, probably.
How you understood that collision is works? Did you change one of standard collision-models by new model, as you did it with dff and txd?
Important note: it's acceptably to add only one new col-archive into gta3.img. It's necessary to put all added collision models into this col-archive or into one of standard col-archives. If you add 2 and more col-archives, game will crash.

Offline

#9 02-10-2011 09:59

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

Re: GTASA - Replacing buildings in CLEO mission scripts

Thanks for mentioning the col archive limit! Didn't know about that.

I made the col from my changed dff model. Can't remember how I made that exactly (I started that mod years ago, gave up, and now thanks to the discovery of the possibilities of CLEO, I try to complete it). But when I open that col archive in CollEditor, it displays the building like an untextured dff, although horizontally mirrored. When I just added that col to the img archive, the game started fine and the collision data for that building felt like mirrored. That's why I thought it would probably be technically OK.

I just looked into the col file again and saw the collision object still had the name of the old dff. Big mistake! Changed that. When I add my new building to the game via IDE and IPL, it finally works now! So I guess now the dff txd and col files are OK.

EDIT: Heureka, it finally works! smile I took the collision files from the original buildings, renamed them and used them for my new model, and now everything just works the way it should. Thanks a ton for your help! I'll post a link as soon as the mod is ready for release.

Last edited by lesterdfunct (02-10-2011 13:52)

Offline

#10 02-10-2011 12:48

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTASA - Replacing buildings in CLEO mission scripts

You can create object by script, then delete object and create object with other model.

Offline

#11 02-10-2011 13:54

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

Re: GTASA - Replacing buildings in CLEO mission scripts

Cool, I'll try this method as well. Does this mean that theoretically every model from the game could be either deleted or swapped by a script?

I've got the replace_model opcode working as well in the meantime. (See EDIT above.)

EDIT: I've just discovered that the replace_model opcode doesn't store the change permanently. If I fly somewhere and return I see the old model. sad Damn, that would have been too easy.

Is it possible at all to make permanent changes to the map as a result of a mission and/or CLEO script?

Last edited by lesterdfunct (03-10-2011 10:30)

Offline

#12 03-10-2011 15:22

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTASA - Replacing buildings in CLEO mission scripts

It's possible to edit only dynamic objects by script. Dynamic objects include: 1.breakable and moveable objects from object.dat. 2.any objects, which were created by script.

Offline

#13 03-10-2011 22:50

lesterdfunct
From: Planet Ortega
Registered: 26-09-2011
Posts: 10

Re: GTASA - Replacing buildings in CLEO mission scripts

Damn, I feared that would be the case.

Maybe I could make the building dynamic from the beginning by changing the original in ide and ipl and making the script check what state the building is in. If the player enters the zone around the building at a certain distance, the script draws LOD and full model depending on the state of the mission.

Would make the mod force players to start a new game though, I think?. Can't give up now anyway, I will try it.

Cheers & thanks
Lester

Offline

Board footer

Powered by FluxBB