Author Topic: Some scripting fun...  (Read 3877 times)

0 Members and 1 Guest are viewing this topic.

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Some scripting fun...
So...


Phear my scripting!

Short video.. http://video.tinypic.com/player.php?v=4p2ch7a

Personal containment field... :D

Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • FLAMES OF WAR
Re: Some scripting fun...
How did you do that?
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 
Re: Some scripting fun...
 :yes: ;7

  

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Some scripting fun...
That was originally supposed to be a reflection/deflection shield thingye.. To reflect hostile incoming stuff like ship was covered with impenetrable spherical mirror... er... forcefield... thing... Small mistake during the scripting with < and > caused the internal side of the sphere to reflect the shots (ie. collecting every shot) instead of the outer side (which would have reflected every shot).
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Re: Some scripting fun...
Awesome. It'd make a good idea for some sort of super shield. Both the intended effect and the un-intended effect.

Imagine how'd it look with Subach beams instead. I don't suppose it stops beams, does it?
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Some scripting fun...
Yeah.. it doesn't stop beams. Mainly because beams do not exist as individual objects in-game. With all other stuff i can simply choose whether i want it to be deflected or not
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline colecampbell666

  • I See Dead Pictures
  • 212
  • Evolution and ascension.
Re: Some scripting fun...
Me likey. :lol: :lol:
Gettin' back to dodgin' lasers.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Some scripting fun...
heh cool. some of the coolest things ive done with scripting were on accident, but that is totally awesome. is it possible to fly those shots inbto an enemy? or will the sf mara get caught in the field too  :lol:
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Some scripting fun...
That's a Ulysses! :p

 

Offline Cobra

  • 212
  • Snake on a Cain
    • Skype
    • Steam
    • Twitter
Re: Some scripting fun...
You know what I'm thinking? That would be great for a shield for the Lucifer, except the lasers reflect. :D
To consider the Earth as the only populated world in infinite space is as absurd as to assert that in an entire field of millet, only one grain will grow. - Metrodorus of Chios
I wept. Mysterious forces beyond my ken had reached into my beautiful mission and energized its pilots with inhuman bomb-firing abilities. I could only imagine the GTVA warriors giving a mighty KIAAIIIIIII shout as they worked their triggers, their biceps bulging with sinew after years of Ivan Drago-esque steroid therapy and weight training. - General Battuta

 

Offline Hades

  • FINISHING MODELS IS OVERRATED
  • 212
  • i wonder when my polycounts will exceed my iq
    • Skype
    • Steam
Re: Some scripting fun...
Yes i was just thinking that. :lol: ;)
[22:29] <sigtau> Hello, #hard-light?  I'm trying to tell a girl she looks really good for someone who doesn't exercise.  How do I word that non-offensively?
[22:29] <RangerKarl|AtWork> "you look like a big tasty muffin"
----
<batwota> wouldn’t that mean that it’s prepared to kiss your ass if you flank it :p
<batwota> wow
<batwota> KILL

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Some scripting fun...
... This was a bug, I'm sure he's fixed it so that the outside reflects, but not the inside... right?

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Some scripting fun...
That was originally supposed to be a reflection/deflection shield thingye.. To reflect hostile incoming stuff like ship was covered with impenetrable spherical mirror... er... forcefield... thing... Small mistake during the scripting with < and > caused the internal side of the sphere to reflect the shots (ie. collecting every shot) instead of the outer side (which would have reflected every shot).

oh, you mean like in starfox when a ship does a barrel roll? :D
what ever could ths be for?
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Some scripting fun...
Weeell...  ;)


EDIT:
... This was a bug, I'm sure he's fixed it so that the outside reflects, but not the inside... right?

Yeah
« Last Edit: July 21, 2007, 11:33:56 am by Wanderer »
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: Some scripting fun...
Awesome idea! Can we play with it too? ;7

I wonder if ships can bounce off of it?

I have got to learn some scripting.

« Last Edit: July 21, 2007, 12:00:46 pm by Gregster2k »

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Some scripting fun...
Its mostly just math.. And ships can be made to bounce off too.. though it might some additional data (orientation data). One prob atm is that atleast turret shots which are bounced cant hit the parent ship but they cant hit the parent ship in normal FreeSpace anyway. However this can be changed too - at least for the standard primaries.

Mainly just usage of dot products and vector projection stuff..

Code: [Select]
#Global Hooks

$Simulation:

[

-- Reflection calculations

vectorFrontDirection = ba.createVector(0,0,1)
booleanReflection = 1
floatMissionTime = mn.getMissionTime()

if floatMissionTime > 0.5 then

   objectPlayer = hv.Player

   --Do not continue if player does not exist
   if objectPlayer:isValid() then

      --Continue only if trigger is set
      if booleanReflection == 1 then

         --Iterate through all the weapons
         for k=1,#mn.Weapons do
            objectWeapon = mn.Weapons[k]
            stringWeaponTeam = objectWeapon.Team.Name

            --Do this to all but friendly weapons
            --Could be expanded or to set to deflect only certain weapons etc.
            if stringWeaponTeam ~= "Friendly" then

               --Calculate distance between weapon and ship's centerpoint
               vectorWeaponPosition = objectWeapon.Position
               vectorPlayerPosition = objectPlayer.Position
               floatWeaponDistance = vectorPlayerPosition:getDistance(vectorWeaponPosition)

               --Continue only if weapon is close enough to the ship
               if floatWeaponDistance < 35 then

                  --Create reflection normal and calculate impact angle
                  vectorImpactNormal = vectorWeaponPosition - vectorPlayerPosition
                  vectorWeaponDirection = objectWeapon.Physics.Velocity
                  floatImpactAngle = vectorImpactNormal:getDotProduct(vectorWeaponDirection) / (vectorImpactNormal:getMagnitude() * vectorWeaponDirection:getMagnitude())

                  --Continue only if impact angle is proper
                  -- < causes the deflective shield (outer side deflects), angle is <90 degs
                  -- > causes the 'doomsphere'/containment field (inner side deflects), angle is >90 degs
                  if floatImpactAngle < 0 then

                     --Some vector math

                     ---Calculate vector projection along the reflection normal for the 'impact vector' and then multiply it by 2 to get proper reflection 'lenght'
                     floatReflectionModifier = 2 * vectorWeaponDirection:getDotProduct(vectorImpactNormal) / vectorImpactNormal:getDotProduct(vectorImpactNormal)

                     ---Create the proper reflection vector
                     vectorReflection = floatReflectionModifier * vectorImpactNormal

                     ---101 vector math...
                     vectorWeaponNewDirection = vectorWeaponDirection - vectorReflection

                     ---Set weapon flight direction and orientation according to the reflection vector.
                     orientationNewWeapon = vectorWeaponNewDirection:getOrientation()
                     objectWeapon.Orientation = orientationNewWeapon
                     floatWeaponVelocity = objectWeapon.Physics:getSpeed()
                     objectWeapon.Physics.Velocity = floatWeaponVelocity * vectorWeaponNewDirection / vectorWeaponNewDirection:getMagnitude()
                  end
               end
            end
         end
      end
   end
end

]

#End
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: Some scripting fun...
So I need a CVS build or something to use this? Or will it work with THREE dot SIX dot NINE?

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Some scripting fun...
Ah.. no it doesn't work with 3.6.9 builds (or any of the 3.6 builds for that matter)... Practically all scripting is done with HEAD branch builds ATM.

You should be able to use for example http://www.hard-light.net/forums/index.php/topic,44659.0.html C05202007 (HEAD) build - just read the note below the download link. Those builds should eventually become 3.7 builds.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: Some scripting fun...
Sweetness.

Thanks. :)


EDIT:
Weird, it doesn't seem to work against Tornado missiles? :confused:
« Last Edit: July 21, 2007, 12:52:08 pm by Snail »

 

Offline Getter Robo G

  • 211
  • Elite Super Robot Pilot
Re: Some scripting fun...
In some trek games beams are models...

If you make a small tube pof controlled by teh beam data (ie generated as segments like a really fast gatlign gun?) but invisible and wrapped in a regular beam segment background would that work??? teh reflected segemnts should drag teh backgroudn with it no? *runs*...

I'm not high, but I should be!  :lol:
"Don't think of it as being out-numbered, think of it as having a WIDE target selection!"

"I am the one and ONLY Star Dragon..."
Proof for the noobs:  Member Search

[I'm Just an idea guy, NOT: a modeler, texturer, or coder... Word of advice, "Watch out for the ducks!"]

Robotech II - Continuing...
FS2 Trek - Snails move faster than me...
Star Blazers: Journey to Iscandar...
FS GUNDAM - The Myth lives on... :)