Author Topic: Confused about executing scripts.  (Read 3389 times)

0 Members and 1 Guest are viewing this topic.

Confused about executing scripts.
I've been trying to get Wanders auto-gun convergence to work.  I've created the scripting.tbl and put the code in there.  What else am I missing?  :confused:
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Confused about executing scripts.
Recent head branch build`(NOT 3.6.9 build)?

Properly named weapons (dummy weapon and a real one)?
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: Confused about executing scripts.
I grabbed the build from the lastest builds thread.  Whats a dummy weapon?
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Confused about executing scripts.
Well the script actually runs every single frame of the game (like all lua scripts unless otherwise defined)

It sort of waits for appearance of weapon named 'Corona', which is used in the script as dummy weapon.. That is as soon as game detects any weapon of that particular class, it removes that weapon from game (setting the remaining lifetime of the weapon to 0 s) it tries to search for the shooter of that weapon and then assigns target according to that and calculates new vectors for the weapon. After this the script generates a new weapon of 'Halo' class which is 'pointed' at the newly calculated convergence point.

So the 'Corona' is a dummy weapon. That is in that script the 'Corona' is used only for triggering the rest of the script.
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: Confused about executing scripts.
Ok how do you implement different types of existing weapons with Corona then?
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Confused about executing scripts.
Huh? What do you mean?

You just create a new weapon (dummy) that has the same performance as the weapon you want to fire (real weapon). Then make sure the new weapon has all the interface anims, muzzleflashes and all such set for it and also that it has no shockwave and no impact explosion. Search for the script i posted and change the name 'Corona' to the name of your new dummy weapon, and the 'Halo' with the weapon you really want to fire.

Script could probably be reworked into working when ship class fires instead of just using defined weapons though - with small 'cost' in weapon range.
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: Confused about executing scripts.
so for meson i would copy and paste your code, rename Corona to something like meson_dummy
then for tachyon i would repaste it again, rename Cornoa to tach_dummy?
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Confused about executing scripts.
Ah.. Well i the gun convergence script was a show off thing sort of 'But I can only show you the door. You're the one that has to walk through it.' to demonstrate what you can do with scripting... and of course to get more people 'to walk through the door' i.e., start experimenting on Lua scripts. It can be modified to work with multiple weapon classes too without copy pasteing it two times (by writing a bit longer script).

But (havent tested) it should work if you copy the actual convergence section (outlined below) and use the first one for Mesons and the second one for Tachyons.

Code: [Select]
if missiontime > 0.5 then
   ...
   <lots of stuff>
   ...
end
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: Confused about executing scripts.
Ahhh i think I see where

Code: [Select]
if stringWeaponClass == "Corona" and numberWeaponLife > 0.2 then

will be

Code: [Select]
if stringWeaponClass == "Meson_dummy" or stringWeaponClass == "tachyon_dummy" or ...... and numberWeaponLife > 0.2 then

and

Code: [Select]
mn.createWeapon(tb.WeaponClasses["Halo"],orientationWeapon,vectorWeaponPosition,newshooter,-1)

with
Code: [Select]
if stringWeaponClass == "Meson_dummy" then
      mn.createWeapon(tb.WeaponClasses["Meson_real"],orientationWeapon,vectorWeaponPosition,newshooter,-1)
else if if stringWeaponClass == "tachyon_dummy" then
      mn.createWeapon(tb.WeaponClasses["tachyon_real"],orientationWeapon,vectorWeaponPosition,newshooter,-1)
....
else
      mn.createWeapon(tb.WeaponClasses["default_real"],orientationWeapon,vectorWeaponPosition,newshooter,-1)

Correct? I don't see anything else pretaining to the actual weapon, rest seems to be about vectors.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Confused about executing scripts.
Yeah.. Just make sure you get the booleans right though.
Do not meddle in the affairs of coders for they are soggy and hard to light