Author Topic: MVAM Infinite: How to get world location of separated ships?  (Read 982 times)

Offline FekLeyr Targ

  • DS9FX Team
  • Posts: 490
  • Cookies: 537
Hello everyone,

currently I'm working on an MVAM capable ship.
The separation sequence works fine already.
But I have a hard time with the reintegration one.

I'd like to get the XYZ world location of the separated sections as suggested in the plugin:

Quote
############# 1) Get the XYZ world location of the seperated ships before they start moving. Use the "PreSeperate" def
#############    below to get these values. The following bits of code can get you started:
#############    Get a ship by name: pShip1 = App.ShipClass_GetObject (pSet, "MvamPrometheusSaucer")
#############    Print location: print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY(), etc
############# 2) Get the world location of the seperated ships AFTER they've done the cutscene. Use the "PostSeperate" def
#############    below to get these XYZ values.

I have pasted and altered that code into these two defs.
The result was a syntax error causing Quickbattle to not work properly.

I'm neither a programmer nor a scripter.
In fact I failed in Computer Science at University.

This is how the mentioned defs look like:

Code: [Select]
#pShip is the seperated ship just before the seperation cutscene
def PreSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
#pGame = App.Game_GetCurrentGame()
#pEpisode = pGame.GetCurrentEpisode()
#pMission = pEpisode.GetCurrentMission()
#pSet = pShip.GetContainingSet()

return 0

#pShip is the seperated ship just after the seperation cutscene
def PostSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
#pGame = App.Game_GetCurrentGame()
#pEpisode = pGame.GetCurrentEpisode()
#pMission = pEpisode.GetCurrentMission()
#pSet = pShip.GetContainingSet()

return 0
So if any of you experienced scripters could explain to me how to do that properly, I would be very thankful.
TaH pagh, Tah be.

Offline Blackrook32

  • BC Files Admin
  • Vice Administrator
  • Posts: 561
  • Cookies: 1077
    • Blackrook32's YouTube Channel
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #1 on: May 12, 2023, 12:46:52 PM »
Hello everyone,

currently I'm working on an MVAM capable ship.
The separation sequence works fine already.
But I have a hard time with the reintegration one.

I'd like to get the XYZ world location of the separated sections as suggested in the plugin:

I have pasted and altered that code into these two defs.
The result was a syntax error causing Quickbattle to not work properly.

I'm neither a programmer nor a scripter.
In fact I failed in Computer Science at University.

This is how the mentioned defs look like:

Code: [Select]
#pShip is the seperated ship just before the seperation cutscene
def PreSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
#pGame = App.Game_GetCurrentGame()
#pEpisode = pGame.GetCurrentEpisode()
#pMission = pEpisode.GetCurrentMission()
#pSet = pShip.GetContainingSet()

return 0

#pShip is the seperated ship just after the seperation cutscene
def PostSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
#pGame = App.Game_GetCurrentGame()
#pEpisode = pGame.GetCurrentEpisode()
#pMission = pEpisode.GetCurrentMission()
#pSet = pShip.GetContainingSet()

return 0
So if any of you experienced scripters could explain to me how to do that properly, I would be very thankful.

Out if curiosity; what baseline script are you using? Is this it from a working script from a actual release? How is the reintegration sequence not satisfactory? The reason I ask, because a MVAM plugin is very "case-intensive".

I suggest running the script and getting a counsel report. Post the entire report here. I'm just guessing right now, but it sounds like a accidental typo to me.


" Fortune Favors the Bold "

Offline FekLeyr Targ

  • DS9FX Team
  • Posts: 490
  • Cookies: 537
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #2 on: May 12, 2023, 07:17:30 PM »
Out if curiosity; what baseline script are you using? Is this it from a working script from a actual release? How is the reintegration sequence not satisfactory? The reason I ask, because a MVAM plugin is very "case-intensive".

I suggest running the script and getting a counsel report. Post the entire report here. I'm just guessing right now, but it sounds like a accidental typo to me.

I've modified a pre-existing MVAM plugin for my ship.
In the reintegration sequence, either the sections end up too far or clip into each other deeply.
That was when I was estimating the values.

Which is why I'd like to do this more precise approach.

I've attached the report as TXT-file.

And this is how I've modified the defs:
Code: [Select]
#pShip is the seperated ship just before the seperation cutscene
def PreSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pSet = pShip.GetContainingSet()
pShip1 = App.ShipClass_GetObject (pSet, "D6AxanarBoom")
print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY()
pShip2 = App.ShipClass_GetObject (pSet, "D6AxanarEngineering")
print 'X=', pShip2.GetWorldLocation().GetX(), 'Y=', pShip2.GetWorldLocation().GetY()
return 0

#pShip is the seperated ship just after the seperation cutscene
def PostSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pSet = pShip.GetContainingSet()
pShip1 = App.ShipClass_GetObject (pSet, "D6AxanarBoom")
print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY()
pShip2 = App.ShipClass_GetObject (pSet, "D6AxanarEngineering")
print 'X=', pShip2.GetWorldLocation().GetX(), 'Y=', pShip2.GetWorldLocation().GetY()
return 0
TaH pagh, Tah be.

Offline Blackrook32

  • BC Files Admin
  • Vice Administrator
  • Posts: 561
  • Cookies: 1077
    • Blackrook32's YouTube Channel
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #3 on: May 12, 2023, 08:59:05 PM »
@FekLeyr Targ

Ok, after reading your report, I suggest you get a working copy of a MVAM plugin from your "Autoload" folder. One you know that works. Re-write the copied plugin, and add in your modified ship models. Do NOT alter anything beside the ship models you want to use. Rename to your preference, then Run that in your.

I'm thinking you may have accidentally added a typo, when attempting to alter the reinterpretation precepts.


" Fortune Favors the Bold "

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2186
  • Cookies: 1706
  • Life is life
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #4 on: May 13, 2023, 10:30:03 AM »
I've modified a pre-existing MVAM plugin for my ship.
In the reintegration sequence, either the sections end up too far or clip into each other deeply.
That was when I was estimating the values.

Which is why I'd like to do this more precise approach.

I've attached the report as TXT-file.

And this is how I've modified the defs:
Code: [Select]
#pShip is the seperated ship just before the seperation cutscene
def PreSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pSet = pShip.GetContainingSet()
pShip1 = App.ShipClass_GetObject (pSet, "D6AxanarBoom")
print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY()
pShip2 = App.ShipClass_GetObject (pSet, "D6AxanarEngineering")
print 'X=', pShip2.GetWorldLocation().GetX(), 'Y=', pShip2.GetWorldLocation().GetY()
return 0

#pShip is the seperated ship just after the seperation cutscene
def PostSeperate(pAction, pShip):
#these are the base values... very useful. they are commented out since I dont need them right now
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
pMission = pEpisode.GetCurrentMission()
pSet = pShip.GetContainingSet()
pShip1 = App.ShipClass_GetObject (pSet, "D6AxanarBoom")
print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY()
pShip2 = App.ShipClass_GetObject (pSet, "D6AxanarEngineering")
print 'X=', pShip2.GetWorldLocation().GetX(), 'Y=', pShip2.GetWorldLocation().GetY()
return 0

Can I see the original plugin?
Out if curiosity; what baseline script are you using? Is this it from a working script from a actual release? How is the reintegration sequence not satisfactory? The reason I ask, because a MVAM plugin is very "case-intensive".

I suggest running the script and getting a counsel report. Post the entire report here. I'm just guessing right now, but it sounds like a accidental typo to me.


You meant to say python is case sensitive :)


Acta, non verba.
aka USS Sovereign

Offline Blackrook32

  • BC Files Admin
  • Vice Administrator
  • Posts: 561
  • Cookies: 1077
    • Blackrook32's YouTube Channel
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #5 on: May 13, 2023, 11:25:30 AM »
@Mario

Yeah, lol, Dent judge me on the lingo, the end game is "results". :P

I'm working on twelve mods at once. I think a little "brain fog" is permissible, No? :D


" Fortune Favors the Bold "

Offline FekLeyr Targ

  • DS9FX Team
  • Posts: 490
  • Cookies: 537
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #6 on: May 13, 2023, 03:25:00 PM »
Ok, I found out what was going:
I'm using Notepad++ to tweak scripts.
For some reason, instead of creating proper indentations, pressing the tab-key created four spaces.
So it was a typo which caused the syntax error.


However, a new error has cropped up regarding the print command:
Code: [Select]
  File ".\Scripts\Custom\Autoload\Mvam\D6AxanarMvam.py", line 300, in PreSeperate
    print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY()
AttributeError: 'None' object has no attribute 'GetWorldLocation'

I've attached the console dump as well as the full plugin as requested.

(Note to self: Check settings in Notepad++ and make sure indentations are set correctly.
TaH pagh, Tah be.

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2186
  • Cookies: 1706
  • Life is life
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #7 on: May 13, 2023, 05:13:40 PM »
Ok, I found out what was going:
I'm using Notepad++ to tweak scripts.
For some reason, instead of creating proper indentations, pressing the tab-key created four spaces.
So it was a typo which caused the syntax error.


However, a new error has cropped up regarding the print command:
Code: [Select]
  File ".\Scripts\Custom\Autoload\Mvam\D6AxanarMvam.py", line 300, in PreSeperate
    print 'X=', pShip1.GetWorldLocation().GetX(), 'Y=', pShip1.GetWorldLocation().GetY()
AttributeError: 'None' object has no attribute 'GetWorldLocation'

I've attached the console dump as well as the full plugin as requested.

(Note to self: Check settings in Notepad++ and make sure indentations are set correctly.

First thing's first:
1. PyCharm (there's a community edition)
2. VS Code with python plugin at least

Now as for the error this means that the ship was not found. None indicates return of null, nothing, nadda. Maybe the name is wrong or a typo in the name. I'd focus on line

Code: [Select]
pShip1 = App.ShipClass_GetObject (pSet, "D6AxanarBoom")

@Mario

Yeah, lol, Dent judge me on the lingo, the end game is "results". :P

I'm working on twelve mods at once. I think a little "brain fog" is permissible, No? :D

I'm not judging. If you know what you're doing you could write an MVAM inside MVAM in that little plugin.
Acta, non verba.
aka USS Sovereign

Offline FekLeyr Targ

  • DS9FX Team
  • Posts: 490
  • Cookies: 537
Re: MVAM Infinite: How to get world location of separated ships?
« Reply #8 on: May 13, 2023, 07:08:15 PM »
First thing's first:
1. PyCharm (there's a community edition)
2. VS Code with python plugin at least

Now as for the error this means that the ship was not found. None indicates return of null, nothing, nadda. Maybe the name is wrong or a typo in the name. I'd focus on line

Code: [Select]
pShip1 = App.ShipClass_GetObject (pSet, "D6AxanarBoom")

I'm not judging. If you know what you're doing you could write an MVAM inside MVAM in that little plugin.

Thanks for the tip regarding the tools.
PyCharm is pretty cool.

I figured out what was going on.
BC couldn't find the Boom section because it was player controlled.
So I replaced "D6AxanarBoom" with "Player" and voilá: I got the values I wanted.
And the reintegration sequence looks fine now. :-)

Thank you very much for your assistance guys. :-)
TaH pagh, Tah be.