Magnet Issue

Creating new content for Trespasser!

Moderators: TresCom Support Team, TresCom Board Managers, TresCom Developers

Post Reply
User avatar
tatu
-=TresCom Website Manager=-
-=TresCom Website Manager=-
Posts: 5088
Joined: Fri Jun 24, 2005 9:40 pm
Antispam: No
Location: Sweden
Contact:

Magnet Issue

Post by tatu »

I need some help. For some reason, on many project, I have issue where magnets break after a while. Magnets for lockers, doors, bars, all break and stops working completely. Magnets for guns still work. Even when reimporting and replacing they are kept broken. Is there any way to avoid this and fix this?
Active project: Trespasser: Isla Sorna
Status:
BE-PH1: Released
PH2-IT: Pre-released
PL-SUM: In production

"...there used to be more benches, but InGen's workers removed them during the evacuation in the name of framerate."
User avatar
TheIdiot
T-Rex
T-Rex
Posts: 4345
Joined: Thu Feb 20, 2014 9:13 pm
Location: Canada, eh?

Re: Magnet Issue

Post by TheIdiot »

tatu wrote:I need some help. For some reason, on many project, I have issue where magnets break after a while. Magnets for lockers, doors, bars, all break and stops working completely. Magnets for guns still work. Even when reimporting and replacing they are kept broken. Is there any way to avoid this and fix this?
I think this usually occurs when you delete instances that came before the magnets. For some reason, TresEd re-orders instances whenever they are deleted and this will break magnets, though typically this only occurs with instanced magnets. Your best bet is to import the master object with magnet all over again.
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Magnet Issue

Post by machf »

Aside from that... DON'T use instanced magnets for hinges on doors, lockers, etc. They aren't mant to be used in that way and will break. You should use individual magnets instead, tailored to each door. Same for sliding ones. Anything that uses bool XFree/YFree/ZFree/XTFree/YTFree/ZTFree can't be instanced orit will break. That's something I have to add to the Trespasser Script Reference.
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
Draconisaurus
T-Rex Killer
T-Rex Killer
Posts: 14045
Joined: Mon Dec 06, 2004 5:21 pm
Antispam: No
Location: Isla Sorna
Contact:

Re: Magnet Issue

Post by Draconisaurus »

*cracks knuckles* Oooookay so... TI was mostly right. machf is right if you want to go the absolutely-no-chance-of-errors way. Here is my suggestion:

As TI said, magnets become broken because of TresEd instance reordering (and, machf, of course door magnets are meant to be instanced...). What happens is that, if an instance of a door clone gets thrown back (by TresEd upon level saving, after objs are deleted) to an instance number lower than the magnet in question, its clones (-01 and higher) will no longer respect said magnet.

How to fix this?..
TI wrote:Your best bet is to import the master object with magnet all over again.
Without overthinking it, I would say this would only work if said object/magnet were thusly given a lower instance number. I can't imagine how importing would cause that.. *scratches head*

...

There is an old method I once created, back in the JPDS days. Mass-clone a bunch of trnobjs or foliage (sort of mod-safe objs since they don't have magnets); save the level; delete the door instances which are not respecting their magnets; finally, save the level again.
What does this do? It throws the cloned door instances forward into instance slots which were occupied by the trnobjs/foliage-objs you cloned (while at the same time, if you care to know, throwing X number of trees/trnobjs back into the instance slots the door clones used to occupy, where X is the number of doors you deleted).

*whew* There that should clear things up.. :pirate:
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Magnet Issue

Post by machf »

Draconisaurus wrote: As TI said, magnets become broken because of TresEd instance reordering (and, machf, of course door magnets are meant to be instanced...). What happens is that, if an instance of a door clone gets thrown back (by TresEd upon level saving, after objs are deleted) to an instance number lower than the magnet in question, its clones (-01 and higher) will no longer respect said magnet.
No, that's a different problem altogether. Instanced magnets are fine with guns and static objects (when you mean to break them), but with hinges, they won't work properly. For example, if you apply a hinged magnet to a door with number -00, and then any higher instance of that door isn't facing the same way as the original does - the instanced magnet, however, will still be facing the same way as the -00 magnet. That doesn't seem like much of a problem and you won't notice at first, but only IF you're using hinges with the magnet's Z axis pointing upwards and set to "bool ZFree = true". No matter what direction an instanced door is facing, since its "free" axis (Z) will always be pointing upwards regardless, the "hinge" will work well. It also works fine when you have all axes free (like with the Barrett gun or the mounted .50 cal MG), because you can rotate it along all axes, no matter how they are oriented, duh!

But if instead you want something like a drawbridge, and you use, say "bool XFree = true" with the Z axis pointing upward, the Y axis along the length of the drawbridge (while lowered, I mean), and the X axis along its width (at the edge, of course), and then you instance a second drawbridge which isn't facing the same way but rather 90 degrees apart (like both drawbridges at the Geothermal Plant, for example), then, can you guess what will happen to the second drawbridge? Well, its magnet's X axis will be pointing now along its length, and the Y axis along its width. And so, the drawbridge will roll sideways instead of upwards.

Now take a sliding door. Here, instead of using "bool ZFree = true" you would use something like "bool XTFree = true" assuming again that the magnet is placed so that the Z axis points upwards, the Y axis points "through" the door, and the X axis points along the width of the door. Make an instanced copy of the door, facing at, let's say, a 90 degree angle compared to the original door. But the instanced magnet has still the same orientation as the original. Again, what happens? Now the Z axis is still pointing upwards, but the Y axis points along the width of the door and the X axis points "through" the door... with the result that, instead of sliding along the wall as intended, you now push the door and it will move away from the wall! Like those pushable secret walls in Wolfenstein 3D or something.

And that's why you don't use instanced magnets for hinges except the most basic types, and should use individually tailored magnets for any other ones instead. I think there may even be a note regarding that in the source code, or in one of the design documents, or somewhere, I'm not sure...
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
Draconisaurus
T-Rex Killer
T-Rex Killer
Posts: 14045
Joined: Mon Dec 06, 2004 5:21 pm
Antispam: No
Location: Isla Sorna
Contact:

Re: Magnet Issue

Post by Draconisaurus »

Guess that makes sense.. Really wonder if Lee can do anything about Tres's magnet misfortunes.
User avatar
TheIdiot
T-Rex
T-Rex
Posts: 4345
Joined: Thu Feb 20, 2014 9:13 pm
Location: Canada, eh?

Re: Magnet Issue

Post by TheIdiot »

Yeah, I think machf is on to a different problem, too. Never seen that happen before, but he has a very good point. Doors should have their own magnets in general, period, now that this knowledge has been shared. :wink:
There is an old method I once created, back in the JPDS days. Mass-clone a bunch of trnobjs or foliage (sort of mod-safe objs since they don't have magnets); save the level; delete the door instances which are not respecting their magnets; finally, save the level again.
What does this do? It throws the cloned door instances forward into instance slots which were occupied by the trnobjs/foliage-objs you cloned (while at the same time, if you care to know, throwing X number of trees/trnobjs back into the instance slots the door clones used to occupy, where X is the number of doors you deleted).
I would worry about this causing even more problems, though. Couldn't this, theoretically, also result in other magnets now being thrown off during the second deletion process? And does this affect instanced gun magnets in any way?

My overall suggestion here: try to avoid using instanced magnets as much as possible if you know you are going to be deleting a lot of objects, especially older ones. Only begin using instanced magnets once the level is nearly finalized as this will prevent any odd bugs like this from happening. The door magnets that machf speaks of seem a bit safer since they are not instanced, but it also seems that they too can bug out.
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: Magnet Issue

Post by machf »

TheIdiot wrote:Yeah, I think machf is on to a different problem, too. Never seen that happen before, but he has a very good point. Doors should have their own magnets in general, period, now that this knowledge has been shared. :wink:
<snip>

My overall suggestion here: try to avoid using instanced magnets as much as possible if you know you are going to be deleting a lot of objects, especially older ones. Only begin using instanced magnets once the level is nearly finalized as this will prevent any odd bugs like this from happening.
The problem with that idea is that for instanced magnets, you have to apply one to the "master" object (the -00 one) FIRST, and THEN clone the object (door or whatever) as many times as you want, so that every instance will automatically get its own magnet in-game...
The door magnets that machf speaks of seem a bit safer since they are not instanced, but it also seems that they too can bug out.
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
tatu
-=TresCom Website Manager=-
-=TresCom Website Manager=-
Posts: 5088
Joined: Fri Jun 24, 2005 9:40 pm
Antispam: No
Location: Sweden
Contact:

Re: Magnet Issue

Post by tatu »

So basically you shouldn't rely on the magnet assigned to the master -00 object? And make a new magnet for every other objects -01, -02 etc for doors and such? Like building doors, gates, locker doors etc? What about stuff like pinbars? They break too, while the baseball bat doesn't (or I haven't experienced that yet).

Can't you just reimport everything into a new level and make sure all -01, -02 etc comes after the main mesh and magnet? At least for stuff like the pinbars?
Active project: Trespasser: Isla Sorna
Status:
BE-PH1: Released
PH2-IT: Pre-released
PL-SUM: In production

"...there used to be more benches, but InGen's workers removed them during the evacuation in the name of framerate."
User avatar
Draconisaurus
T-Rex Killer
T-Rex Killer
Posts: 14045
Joined: Mon Dec 06, 2004 5:21 pm
Antispam: No
Location: Isla Sorna
Contact:

Re: Magnet Issue

Post by Draconisaurus »

*too tired to make large post* Yeah, tatu, the easiest way to go in this case seems to be to just make individual magnets for each individual door. Simple method, can't imagine any crash potential with it.
User avatar
TheIdiot
T-Rex
T-Rex
Posts: 4345
Joined: Thu Feb 20, 2014 9:13 pm
Location: Canada, eh?

Re: Magnet Issue

Post by TheIdiot »

What about stuff like pinbars? They break too, while the baseball bat doesn't (or I haven't experienced that yet).
I've had the bat break before because it uses the same magnet system as the guns do. They're instanced slave & master magnets which can break when you delete things.
Post Reply