Author Topic: Splitting Projectiles  (Read 4710 times)

Offline DKealt

  • Posts: 110
  • Cookies: 4
Splitting Projectiles
« on: August 21, 2008, 12:56:48 PM »
Hi Im desperately trying to get a few more canon actions working on the upcoming Stargate pack, and thru wanderring around some of the already existing tech out there i came across the splitting projectiles mod as part of foundation technologies.

If im right the multi target splitting projectiles would be perfect for the Horizon platform (A multi launching - multi targetting Nuke platform) and this could help.

Also it may be the answer to making the Drone weapons appear more cluster like after they have been fired.

The instructions with the FTech is pretty straight forward i think, but im not exactly most comfortable when it comes to scripting, so basically does anyone know how to implement this tech, an example script etc. would be perfect, or even if anyone knows if it is indeed possible to achieve what i would like via this method.

Any help would be much appreciated

DKealt

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #1 on: August 21, 2008, 01:19:30 PM »
The readme contains examples, including one for splitting I believe. Even 2 of them.
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 El

  • Master Hardpointer
  • Retired Administrator
  • Posts: 653
  • Cookies: 123
  • Former Vice Admin
Re: Splitting Projectiles
« Reply #2 on: August 21, 2008, 02:24:22 PM »
I think you will struggle to get the swarming effect your after however the Horizon effect is do able although it obviously doesn't use solid models.

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #3 on: August 22, 2008, 08:08:01 AM »
Yeh the solid models isnt a prob, i just figure that the horizon launches one projectile from it that splits, and as for the drone swarm, it is hard, very hard, i just want to reduce the current effect of one straight line of drones, that too be fair can look a bit disapointing.

As for the examples. iv seen them, read them and tried to apply them with no success, the readme is fantastic, im just not too sure if something, perhaps very simple to most scripters hasnt been mentioned that i need to do

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #4 on: August 22, 2008, 08:11:25 AM »
If you don't know something specific, then you can of course ask.
But I as the writer of the readme can't think of anything that I missed.
I used descriptive names on purpose.
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 DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #5 on: August 22, 2008, 08:27:30 AM »
Yeh of course, i think im just missing something thats spelled out right in front of me, here's the script iv tried to add to the bottom of the script...

Code: [Select]
sYieldName = ?Horizon?
try:

    import FoundationTech
    import ftb.Tech.TimedTorpedoes

    oFire = ftb.Tech.TimedTorpedoes.MIRVMultiTargetTorpedo(
    ?Horizon?, {
?spreadNumber?: 6,
?spreadDensity?: 6.5,
?warheadModule?: ?Tactical.Projectiles.Mark9Tactical?,
?shellLive?: 0,
    })
    FoundationTech.dOnFires[__name__] = oFire
    oYield = FoundationTech.oTechs[Horizon]
    FoundationTech.dYields[__name__] = oYield
except:
    pass

Please help me find whats wrong with it, it is a script worth using (P.s. i added the script to an identical script renamed Mark9TacticalA).

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #6 on: August 22, 2008, 08:39:01 AM »
I added code tags to your post, and I noticed that you didn't have any indendation.
Is this the case in the source file as well? If so, copy the above back into the projectile file and try again.
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 DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #7 on: August 22, 2008, 10:48:40 AM »
Still no joy so far... for reference this is the entire script...

Code: [Select]
import App
import LJTorpLib.LibTorp

sDamage = 100000

def Create(pTorp):
kCoreColor = App.TGColorA()
kCoreColor.SetRGBA(255.0 / 255.0, 255.0 / 255.0, 128.0 / 255.0, 1.000000)
kGlowColor = App.TGColorA()
kGlowColor.SetRGBA(255.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 1.000000)
kFlareColor = App.TGColorA()
kFlareColor.SetRGBA(255.0 / 255.0, 128.0 / 255.0, 0.0 / 255.0, 1.000000)

pTorp.CreateTorpedoModel(
"data/Textures/Tactical/TorpedoCore.tga",
kCoreColor,
0.04,
0.05,
"data/Textures/Tactical/TorpedoGlow.tga",
kGlowColor,
0.2,
0.04,
0.025,
"data/Textures/Tactical/TorpedoFlares.tga",
kFlareColor,
0,
0.01,
0.01)


#pTorp.SetDamage( GetDamage(pTorp) )
pTorp.SetDamageRadiusFactor(5.0)
pTorp.SetGuidanceLifetime( GetGuidanceLifetime() )
pTorp.SetMaxAngularAccel( GetMaxAngularAccel() )

import Multiplayer.SpeciesToTorp
pTorp.SetNetType (Multiplayer.SpeciesToTorp.PHOTON)


        LJTorpLib.LibTorp.AddCreationHandler(pTorp, __name__ + ".AttachSmoke")
return(0)

def AttachSmoke(self, pEvent = None):

    pTorpedo = App.Torpedo_Cast(pEvent.GetDestination())
    if not pTorpedo:
        return (1)

    LJTorpLib.LibTorp.SetupSmokeTrail(pTorpedo)

    SetDamage(pTorpedo)

    return (0)

def SetDamage(self, pEvent = None):
    global sDamage

    pTorpedo = self
    if not pTorpedo:
        return (1)

    pTargetId = pTorpedo.GetTargetID()

    pSet = pTorpedo.GetContainingSet()

    lObjects = pSet.GetClassObjectList(App.CT_OBJECT)
    for sObject in lObjects:
sOBjectID = sObject.GetObjID()

if (sOBjectID == pTargetId):
import Foundation
import string
                if sObject.GetScript():
                        pShip = string.split(sObject.GetScript(), '.')[-1]

if Foundation.shipList.has_key(pShip):
pFoundationShip = Foundation.shipList[pShip]
if pFoundationShip and hasattr(pFoundationShip, "fTorpedoID"):
pTorpedoeID = pFoundationShip.fTorpedoID
if (pTorpedoeID == "Not-Target"):
Rand = App.g_kSystemWrapper.GetRandomNumber(100)

if (Rand <= 10):
pTorpedo.SetDamage(int(sDamage))

else:
pTorpedo.SetDamage(0.01)
                                else:
                                        pTorpedo.SetDamage(int(sDamage))

def GetLaunchSpeed():
return(20.0)

def GetLaunchSound():
return("MissileFire")

def GetPowerCost():
return(30.0)

def GetName():
return("Mark 9 Tactical")

def GetDamage():
        global sDamage
return int(sDamage)

def GetGuidanceLifetime():
return 8.0

def GetMaxAngularAccel():
return 2.0

sYieldName = ?Horizon?
try:

    import FoundationTech
    import ftb.Tech.TimedTorpedoes

    oFire = ftb.Tech.TimedTorpedoes.MIRVMultiTargetTorpedo(
    ?Horizon?, {
?spreadNumber?: 6,
?spreadDensity?: 6.5,
?warheadModule?: ?Tactical.Projectiles.Mark9TacticalA?,
?shellLive?: 0,
    })
    FoundationTech.dOnFires[__name__] = oFire
    oYield = FoundationTech.oTechs[Horizon]
    FoundationTech.dYields[__name__] = oYield
except:
    pass

Ive also tried adding the script to an simple torp script with no success, the one thing that confusses me is the naming of the tech, i put horizon as i assume that the name need not be specific, and also im unsure as to where to insert this name as it only specifies one place in the readme.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #8 on: August 22, 2008, 01:02:39 PM »
In this case the yieldname isn't needed, since you define a new torpedo tech instead of referencing (through the name) it.

But what exactly is the problem here?
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 DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #9 on: August 22, 2008, 02:18:13 PM »
Simply the torpdeo/missile script doesnt load, as if the script file is missing.

If i try and fire the missile with the splitting tech the game crashes. Something with the below code is wrong and the game crashes,

Im finding it really frustrating as i just cant figure out where its gone wrong

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #10 on: August 22, 2008, 02:25:29 PM »
Have you tried importing the projectile (in the console) and see what happens?
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 DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #11 on: August 22, 2008, 02:45:03 PM »
Ive got a really basic level of knowledge when it comes to scripting im afraid, including console usage.

I thought there maybe something very apparent in the script that was wrong and that's why it didnt work,

Im just getting really stuck for ideas on getting it working now

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #12 on: August 22, 2008, 03:22:56 PM »
Like I said, just do this in the console:
Code: [Select]
import Tactical.Projectiles.Mark9Tactical Assuming that's the name of course.
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 DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #13 on: August 23, 2008, 09:50:27 AM »
Yay a step in the right direction, the console informed me of a Syntax error, basically all the ' symbols needed changing to ".

Now everything loads fine in the console "TimedTorpedoes Loaded"

But now when the missiles fire they just fire as they did before and they dont split, here's how the code looks now...

Code: [Select]
sYieldName = "Horizon"
try:

    import FoundationTech
    import ftb.Tech.TimedTorpedoes

    oFire = ftb.Tech.TimedTorpedoes.MIRVMultiTargetTorpedo({"Horizon"
"spreadNumber": 6,
"spreadDensity": 6.5,
"warheadModule": "Tactical.Projectiles.Mark9TacticalA",
"shellLive": 0,
    })
    FoundationTech.dOnFires[__name__] = oFire
    oYield = FoundationTech.oTechs[Horizon]
    FoundationTech.dYields[__name__] = oYield
except:
    pass

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #14 on: August 23, 2008, 12:18:36 PM »
Oh and BTW, u mentioned before about not needing to use a name code, in this instance Horizon,

I havnt yet removed that part, would this still cause a problem?

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #15 on: August 23, 2008, 12:27:58 PM »
Finally!!!!

Crisis averted, i finally have a multi targetting Horizon platform!!!!

Thanks so much for ur consistent help guiding my newb skills through this!!!

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Splitting Projectiles
« Reply #16 on: August 23, 2008, 12:54:47 PM »
So what was it?
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 DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #17 on: August 23, 2008, 01:03:16 PM »
Basically after figuring out that i was using the wrong characters in the code i replaced them, forgetting that i had since tried to change/remove the need to have the "sYieldName" present, so all i needed to do was reinsert the original code that was less tampered with and edit the syntax on that version.

The effect is really satisfying now, if there are 6 targets it ends in 6 kills, unlike the prev. version where these 6 killer nukes would all fire on 1 target.

Thanks again, couldn't have made it happen without ur help!!!

Offline El

  • Master Hardpointer
  • Retired Administrator
  • Posts: 653
  • Cookies: 123
  • Former Vice Admin
Re: Splitting Projectiles
« Reply #18 on: August 23, 2008, 04:00:19 PM »
Just had a though for your swarm effect that may or may not work.
Use the same splitting technique you used for the horizon, so multiple projectiles fire at once, use a very low spread delay to make it seem like they are launching en mass.
Keep the spread density low since you want them to track very closely to each other.
Adjust the spread number until you get the right number of drones to give the swarm the right 'thickness'

Also, In the file for the split projectile, under 'Get Guidance Lifetime' try setting it to a high number, since we know Drones rarely if ever miss, you may need to tinker with the angular acceleration value as well.

Offline DKealt

  • Posts: 110
  • Cookies: 4
Re: Splitting Projectiles
« Reply #19 on: August 24, 2008, 09:08:17 PM »
Yeh iv hit a bit of a wall with that at the moment. I tend to be that because of the high angular acceleration value of the Drones, when they split they virtually converge back on each other and u just get 3 drones all in the same place, making it look like a very bright drone.

Im also unsure how to change the delay between the splitting? Do u know where to change that value as im not sure if that attribute is in the projectile file?