Author Topic: Make object non-collidable in system script  (Read 1055 times)

Offline Cube

  • Posts: 143
  • Cookies: 5
    • DJcube
Make object non-collidable in system script
« on: August 25, 2007, 01:17:01 PM »
Hi, just a quick question.

1.Is it possible to turn collisions off on one object in a system? (So ships can fly through it, but without turning all collisions off).

2. Would it also be possible for the object to cause damage to ships that fly through it?

If so, how?

Edit: Looks like I'll have a few more problems.

3. In the system script it has a number for the size of the planet. Is this number simply how many times bigger the object is? (So, if you imported a planet, make it 241 times bigger, then exported it; would it be the same size as the normal planet model with a size of 241?)

4. Is there a work-around for the limit of display for distance away from objects?

Offline WileyCoyote

  • The Other Ship Builder
  • Posts: 2346
  • Cookies: 1219
  • Awesome-sauce factory owner
Re: Make object non-collidable in system script
« Reply #1 on: August 25, 2007, 02:13:57 PM »
I had this idea too.  I had an idea if you had a non-collidable object in space, you can add detail to asteroid belts, nebulae, spacial anomalies, etc.  I would like to know this too.  :)
Please visit my Deviantart page at www.trekmodeler.deviantart.com.

My website is up! Download my ships here: http://www.michaelwileyart.com

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Make object non-collidable in system script
« Reply #2 on: August 25, 2007, 05:49:46 PM »
It's possible.

Say, you have a planet in variable pPlanet1 (the same works for otheres, such as ships and asteroid fields, remember, E5/6 with the Kessok/Cardassian conversation?), then you can make it not collidable through:
pPlanet1.SetCollisionsOn(0)

There is another way, through the ProximityManager (more on this in a moment):
pSet.GetProximityManager().RemoveObject(pPlanet1)
I think they mean the instance, since AddObject works that way (RemoveObject doesn't appear to be used).

Be sure to create the proximity manager, via pSet.SetProximityManagerActive(1) it's possible that this is already present in your system.


Number 2 will have to be done through a ProximityCheck, look through scripts/Maelstrom/Episode6/E6M3/E6M3.py and E6M5.py, for the function def CreateProximityCheck(pPosition).
You can also look in MissionLib.py, but I think you'll find that the above scripts will do what you want, but be sure to create your own Event Type (the ET_* value).

If you want to have a moving, uncollidable, damaging, object, then you can attach the thing returned by App.ProximityCheck_Create to said object through pMovingThing.AttachObject(pProximityCheck).

Then, in the function you registed the ET_* to (you did do that, right?) you get the object that the proximitycheck found through App.ShipClass_Cast(pEvent.GetDestination())
And if the result is not None, then you can do this:
pHull = pShip.GetHull()
pShip.DamageSystem(pHull, <<YourDamage>>)
Where <<YourDamage>> is a number between 0.0 and some maximum damage.
This assumes that the result of App.ShipClass_Cast(...) is stored in a variable called pShip

Also, be sure to put at the bottom of your trigger function pObject.CallNextHandler(pEvent) or any futher events may not be triggered.

If you have any specific problems for the above, then please ask, it's just currently a bit too late for me to provide examples for all, and those may not be entirely usefull to learn from anyway.


For your 3rd question, I would think that the first number is the scale (since planet nifs loaded as ships are rather small), so if your planet model has a size of 241 and you put in the number 100, then the resulting model would be 24100 "units" in size.

Last question, I think increasing the SetSphereRadius of the backdrop could do this, I suggest you search the BCS forums for this, since it originated there.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline Cube

  • Posts: 143
  • Cookies: 5
    • DJcube
Re: Make object non-collidable in system script
« Reply #3 on: August 25, 2007, 06:27:00 PM »
Thanks, I'll have an attempt at it tomorrow.

Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Make object non-collidable in system script
« Reply #4 on: August 27, 2007, 08:47:52 PM »
About question 3:
if you mean the first argument of the App.Planet_Create function, then it is the radius of the planet in game units.
For example, look at this, from Belaruz 4:
Code: [Select]
pBelaruzPlanet = App.Planet_Create(180.0, "data/models/environment/AquaPlanet.nif")The 180.0 there is it's radius. the conversion of game units to kilometers is something like  1km = 6 game units... tho to have sure, you can use this:
Code: [Select]
App.UtopiaModule_ConvertGameUnitsToKilometers(<<game units value>>)

App.UtopiaModule_ConvertKilometersToGameUnits(<<kilometer value>>)
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Make object non-collidable in system script
« Reply #5 on: August 28, 2007, 12:40:16 PM »
Still, doesn't it not scale the nif?
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Make object non-collidable in system script
« Reply #6 on: August 28, 2007, 05:16:13 PM »
Yeah probably. After all, what would the game do if you get that same line for example, and instead of 180.0 you put something like 5000.0 ?   The model should be quite bigger in game.
So I think it scales the model yes, but by the game units, not by a multiplier of some kind to the model's "real" size.
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download