Page 1 of 1

BUG: fireEffect and multiple shots

Posted: Mon Mar 17, 2008 12:26 am
by P122
After swiping some code for test purposes from the forums:

Code: Select all

 <ItemType UNID="&itFlak;" 
         name=            "Flak Cannon Battery" 
         level=            "6" 
         value=            "7000" 
         mass=            "2500" 
         frequency=         "rare" 
         modifiers=         "MajorItem; Military" 
         showReference=      "true" 
 
         description=      "Autotracking FlaK Battery." 
         > 
         <Effect> 
            <Image imageID="&rsMissiles;" imageX="0" imageY="32" imageWidth="16" imageHeight="16" imageFrameCount="12" imageTicksPerFrame="3"/> 
         </Effect> 
      <Weapon 
            type=            "missile" 
                                                omnidirectional= "true"
            multitarget = "true"
            directional = "true"
            damage=            "kinetic:1d3+1; momentum2; emp1" 
            fireRate=         "20" 
            missileSpeed=      "35" 
            lifetime=         "20-40" 
            powerUse=         "50" 
            fireEffect=         "&efMediumCannonFlash;" 
            recoil=         "2" 
            sound=            "&snRecoillessCannon;" 
            > 
            <Image imageID="&rsMissiles;" imageX="0" imageY="0" imageWidth="20" imageHeight="20" imageFrameCount="0" imageTicksPerFrame="0"/> 
            <Fragment 
               count=         "4-8" 
               type=         "missile" 
               lifetime=      "1-8" 
               damage=         "blast:1d6+2; WMD1" 
               missileSpeed=   "50-60" 
               > 
                  <Image imageID="&rsMissiles;" imageX="3" imageY="0" imageWidth="16" imageHeight="16" imageFrameCount="0" imageTicksPerFrame="0"/> 
       
               <!-- Second fragemnt goes HERE, just before the end fragment tag--> 
                   
                  <Fragment 
                     count=         "1" 
                     type=         "area" 
                     damage=         "kinetic:1d4+2; EMP1" 
                     missileSpeed=   "0" 
                     expansionSpeed=   "100" 
                     lifetime=      "1-4" 
                     > 
                     <Effect> 
                        <Shockwave> 
                           <Image imageID=            "&rsShockwave1;" 
                                 imageX=            "0" 
                                 imageY=            "0" 
                                 imageWidth=         "512" 
                                 imageHeight=      "128" 
                                 imageFrameCount=   "1" 
                                 imageTicksPerFrame=   "1"/> 
                        </Shockwave> 
                     </Effect> 
                  </Fragment>          
               </Fragment>             
 
    <!-- Removing one Shot-entry should work. --> 
           <Configuration aimTolerance="5">
            <Shot posAngle="20" posRadius="0" angle="0"/>
            <Shot posAngle="-20" posRadius="0" angle="0"/>
          </Configuration>
 
      </Weapon> 
   </ItemType>
Transcendence parsed it all right, but once you switched to the weapon, and fired it, the firing animation showed, the screen froze and a few moments later Microsoft asks me if I want to send a report or close the application.

After talking to digdug on IRC he pointed out after a few trials that the problem seems to be fireEffect in combination with the Fragments and the Configuration. My earlier tries had shown that the fireEffect with a single firing weapon (normal, or even configuration="alternate") works, too, but as soon as there are more than one simultanious firing cannons the error above occurs.

DigDug's 'fixed' code is as follows:

Code: Select all

<ItemType UNID="&itFlak;" 
         name=            "Flak Cannon Battery" 
         level=            "6" 
         value=            "7000" 
         mass=            "2500" 
         frequency=         "rare" 
         modifiers=         "MajorItem; Military" 
         showReference=      "true" 
 
         description=      "Autotracking FlaK Battery." 
         > 
        
            <Weapon 
            type=            "missile" 
                                                omnidirectional= "true"
            multitarget = "true"
        configuration = "wall"
            damage=            "kinetic:1d3+1; momentum2; emp1" 
            fireRate=         "20" 
            missileSpeed=      "35" 
            lifetime=         "20-40" 
            powerUse=         "50" 
        
            recoil=         "2" 
            sound=            "&snRecoillessCannon;" 
            > 
 
           
 
           <Effect>
                                <Image imageID="&rsMissiles;" imageX="0" imageY="0" imageWidth="16" imageHeight="16" imageFrameCount="0" imageTicksPerFrame="0"/>
                        </Effect>
 
            <Fragment 
               count=         "4-8" 
               type=         "missile" 
               lifetime=      "1-8" 
               damage=         "blast:1d6+2; WMD1" 
               missileSpeed=   "50-60" 
               > 
                  <Image imageID="&rsMissiles;" imageX="3" imageY="0" imageWidth="16" imageHeight="16" imageFrameCount="0" imageTicksPerFrame="0"/> 
       
               <!-- Second fragemnt goes HERE, just before the end fragment tag--> 
                   
                  <Fragment 
                     count=         "1" 
                     type=         "area" 
                     damage=         "kinetic:1d4+2; EMP1" 
                     missileSpeed=   "0" 
                     expansionSpeed=   "100" 
                     lifetime=      "1-4" 
                     > 
                     <Effect> 
                        <Shockwave> 
                           <Image imageID=            "&rsShockwave1;" 
                                 imageX=            "0" 
                                 imageY=            "0" 
                                 imageWidth=         "512" 
                                 imageHeight=      "128" 
                                 imageFrameCount=   "1" 
                                 imageTicksPerFrame=   "1"/> 
                        </Shockwave> 
                     </Effect> 
                  </Fragment>          
               </Fragment>             
 
   
 
      </Weapon> 
   </ItemType>

Hope that made sense :)

EDIT: Altered the topic to fit better.

Posted: Mon Mar 17, 2008 3:03 am
by Charon Mass of Goo
A few problems with that.

First being:

lifetime= "20-40"

If you want that random effect, I suggest you use 1d20+20. It works better.

2 being

Directional= "true"
is not a modifier


your Fragment count, again use "1d4+4" it works better.

Fragment liftime use "1d8"
and missle speed use "1d10+50"

those will give you more random effects. the Area Fragment Lifetime use "1d4"
ExpansionSpeed, the higher it is, the faster it will go. For a flak cannon, I suggest something like 25. I have intimate knowledge of Fragmenting. Trust me.

Posted: Mon Mar 17, 2008 3:10 am
by Betelgeuse
charon anything that can take a random value can take a range like 20-40

Posted: Mon Mar 17, 2008 5:01 am
by george moromisato
Good find!

There is a bug with multiple shots and the fireEffect--I will fix that for the next release.

Also, I think you should take out the line:

directional="true"

That line only applies if the image that you're using for your missile has multiple directions.

Posted: Mon Mar 17, 2008 1:26 pm
by digdug
yes, my code works, but only because i removed the fireeffect.

(also I get rid of that effect tag outside the weapon tag)

Posted: Mon Mar 17, 2008 2:33 pm
by P122
The code is a mess, because it was my playing field to try to figure out which tag and attribute goes where. Do not pay much attention to the actual coded intent. :) There is none. (Apart of filling the screen with as many little explosions as possible)
Charon Mass of Goo wrote: lifetime= "20-40"
If you want that random effect, I suggest you use 1d20+20. It works better.
your Fragment count, again use "1d4+4" it works better.
Fragment liftime use "1d8"
and missle speed use "1d10+50"
"1d4"
Well, technically 1d20+20 is not the same as 20-40, as 1d20+20 produces numbers ranging from 21 to 41, while 20-40, well..it is sort of obvious. Similar to the other dicerolling values you proposed. Granted, the difference is minimal, but obviously the actual range is easier controled by specifiying the actual range I want my numbers to take.

Really, the only values the dicerolling is hugely helpful is for bell-curves when using 3d6, for example, which will give a value of 10 the highest probability, while 3 or 18 are almost never going to happen. Other than that, it just obfuscates what you are trying to do at worst, or is a matter of taste and style at best, IMO. ;>



The post is just to document the fireEffect bug, however, and that has been accomplished. :)

Posted: Tue Mar 18, 2008 3:16 am
by Charon Mass of Goo
Betelgeuse wrote:charon anything that can take a random value can take a range like 20-40
Not everything. FireRate doesn't take 20-40 (as it just gives you the differance [-20, but since there is no such firerate that is below 1, it gives you a fire rate of 1] of the two numbers, it did for me), but I find that it (Sort of) works with Dice rolling.

Posted: Thu Mar 20, 2008 4:13 am
by Coffee Chicken
i had a problem like this where there was a missile weapon that used a configuration to shoot multiple missiles. when it fired it crashed the game with the 'send report' message.

Posted: Thu Mar 20, 2008 11:52 am
by digdug
if you have a fireeffect in your weapon, you just encountered this bug.

If not, the problem is somewhere else, post your code in shipyard or on IRC, maybe someone will be kind enough (me, for example) to help you debugging the code. :)