December 22, 2024, 05:07:59

Author Topic: Beam Weapons  (Read 14355 times)

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
Beam Weapons
« on: January 09, 2010, 23:45:53 »
Concerning beam weapons, or lasers, if you'd prefer to call them such. In Nexus, there are a wide array of such weapons, in a few different colours and thicknesses. I intend to use this thread as a personal resource, available to all, to document which lasers have which descriptions. I identify the lasers by the three numbers used in the Start/Travel/End categories in DeviceType in the tacticstypes.ini file.

50/51/52: Thin green laser. "Squirty" sound effect.
53/54/55: Thin green laser. "Squirty" sound effect.
56/57/58: Thin green laser. "Squirty" sound effect.
62/63/64: Golden laser, normal thickness
65/66/67: Yellow laser, normal thickness
74/75/76: Orange laser, normal thickness
77/78/79: Thin red laser.
80/81/82: Purplish laser, normal thickness
83/84/85: Purplish laser, normal thickness
89/90/91: Pale purple laser, very thick. Sound effect can only occur once every 2 seconds. (Siege Laser)
176/177/178: White laser, normal thickness

This post will be edited with more details as I test each type. I didn't see anything on the wiki that suggested this had already been done, so hopefully this helps serve as a resource for more than just myself.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #1 on: January 12, 2010, 03:25:30 »
There, those are all the laser weapon numbers I've found so far. If anyone finds more, feel free to post 'em up, and I'll add them to the list.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #2 on: January 12, 2010, 12:35:26 »
Keep in mind, however, that you don't have to rely on these laser effects. These numbers just refer to their corresponding EFX in universeengineefx.ini or universeenginemod_efx.ini, where you can also put your own type of laser FX ;)

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #3 on: January 12, 2010, 23:27:43 »
A good point. I'll have to read up on that, as defining my own would be a lot more suitable, I think, and I hope that this little bit of information comes in handy for anyone else who is just starting out with modding this game.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #4 on: January 19, 2010, 20:16:23 »
I had some issues with defining my own animations. Specifically, the game crashed if I paused it or when it tried to go to the post-mission screen. I had copied and pasted the full /engine/ folder from the Everything Change sample mod into my mod's directory, and within the mod_efx.ini file I had duplicated the first two Phaser efx (311 and 312) by copying and pasting them at the end of the file and giving them new numbers. One of the weapon systems, employed by two ships in the mission I was testing, used these two efx as its Start and Travel effects respectively.

Any idea what I did to cause this crash?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #5 on: February 05, 2010, 00:34:01 »
Ok, technically not beam weapons, but they are weapons none-the-less.

My first foray into weapons creation has yielded the light PPC and its bigger brother, the heavy PPC.
The lighter, tactical version fires three to five shots per burst while the meatier, hull wrecking heavy PPC is restricted to two to three shots a go. Both have a recharge period of five to ten seconds.





If anyone has any ideas on how to improve the code, then please let me know because it's a lot of work involved to increase the machines capacity.

Edit - 05/02/2010:

Updated to V1.1.
Now uses Arparso's refined machine script.
Weapons limit removed.
Much smaller size.
Better to look the fool by asking, then prove them right with ignorance.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #6 on: February 05, 2010, 03:44:50 »
A quick suggestion - in your first rule ("In") you can remove most of your selection logic. For example:

SelectShips(WeaponsCheck,S.race=#race_Player|Not(S.race=#race_Player));

... is a needlessly complicated way to select all ships in the scene. Better just use:

Select(WeaponsCheck, s.ship);

That achieves the same result while being much cleaner and requiring less processing time (although that's purely theoretical - your original SeletShips()-command shouldn't have any impact on performance). Actually, you won't need that line either, since all your care about are the devices and not the ships. You don't need to select all ships in the scene in order to collect all the PPC weapons on them - just select the weapons straightaway:

Select(M.PPCL, s.device & s.devType = #weap_Light_PPC);

Another optimization hint: don't use prefixes, where you don't need them. If you store your selection in M.PPCL, this selection will be available to the whole mission script and all its machines and rules, comparable to a global variable in programming languages. Generally, you don't want that. What if a completely separate part of your mission script uses the same name for a completely different selection? You may get unexpected conflicts all over the place and will have a hard time debugging them. In short: use prefixes only where you need them:
- use no prefix for variables, that all the rules in your machine need to access
- use E. for variables, that only matter for the current rule and can be thrown away after the rule's execution
- use M. for variables you want to share with the whole mission script

So a proper select-statement could be:

Select(PPCL, s.device & s.devType = #weap_Light_PPC);

---------------------------------------------------

Enough about coding style, now the interesting bits: the biggest drawback of your script is the lack of flexibility. Adding new burst weapon types or expanding the current limit of 40 weapons per weapon type will require a lot of copy&paste, which is a pain in the ass, basically. If you change a small part of your script (e.g. to fix a bug) you'll need to copy&paste that fix to several dozen locations. That procedure itself takes a lot of time and may even introduce new bugs along the way, if you forget something or make any error while copying.

You're using a huge amount of explicit variables keeping track of the current burst length, targetted ships, etc. ... that works, but is also the reason for the problem mentioned above. I've rewritten your script to fix that issue with the use of arrays, which allow for an unlimited number of burst fire weapons in the scene and make adding new weapon types much easier. Basically I'm using three lists:

BurstWeapons contains all burst fire weapons, light or heavy PPCs or whatever you want
RemainingBurstShots contains the remaining shots in the current burst - if it's 0, a new burst is about to begin
BurstTargets contains the last target of each weapon before being disabled

All three lists are linked by the weapon's index in the BurstWeapons-list, which you can get using IndexOf(). A weapon at index 3 in BurstWeapons will have its remaining burst shots stored at index 3 in RemainingBurstShots while its target is also saved at index 3 in BurstTargets.

Just take a look at the provided script to see how it works in detail.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #7 on: February 05, 2010, 09:15:33 »
Thanks Arparso, that's certainly a lot easier then my behemoth, lol.

First off, just a quick note for those who d/l the new version. There's just a little typo in the 'DisableBurstWeapon' rule. The Timer command ends in a comma, not a semi:colon. So you'll just need to make a liitle edit before you run it.

And the first time I ran it, I did get an error where the mission editor got upset about an 'e.dev:device' not being valid, though I've not been able to reproduce it again. So hopefully it was just an odd quirk.

My first efforts did involve using temporary variables (such as the E.******), but after about ten or so weapons things started to go wrong. My thought here was that sometimes a variable was being overwritten by a new firing event before the old one could be fully processed.  Hence the use of permanant variables to keep track of things.

Time to get my studying head on, quite a few bits in there that I've hardly even seen, let alone used  :D

Once again, thank you. :thumbsup:
Better to look the fool by asking, then prove them right with ignorance.

Offline nasharas

  • Recruit
  • *
  • Posts: 15
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #8 on: February 05, 2010, 09:22:11 »
ok, I'm a noob here, but what a hell I have to do to make it work? I already included this file in my mission script, and called that machine, replaced weapons with my own, but still no work, my weapons shoot as they originally supposed... btw, mission was created by nexus skirmisher...please help, cos I really love the idea of burst firing...

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #9 on: February 05, 2010, 11:02:09 »
What I actually don't like about this burst weapon approach is the disabling of the weapon. This prevents the user from cancelling the weapon fire or changing the target while the weapon is "recharging". I don't have any idea on how to do it better, though, given Nexus' scripting limitations...

Quote
First off, just a quick note for those who d/l the new version. There's just a little typo in the 'DisableBurstWeapon' rule. The Timer command ends in a comma, not a semi:colon. So you'll just need to make a liitle edit before you run it.
Thanks, fixed that and another error in the LongRangeArrived rule and re-uploaded the script. I also changed some of the conditions to just check, if the device is part of the BurstWeapons-list instead of checking for each burst fire devicetype individually... makes expanding the script to apply to more weapon types easier, since you have to change fewer lines now.

Quote
And the first time I ran it, I did get an error where the mission editor got upset about an 'e.dev:device' not being valid, though I've not been able to reproduce it again. So hopefully it was just an odd quirk.
That sounds strange. I obviously haven't had time to extensively test the script, so I can't guarantee, there'll be absolutely no error.

Quote
My first efforts did involve using temporary variables (such as the E.******), but after about ten or so weapons things started to go wrong. My thought here was that sometimes a variable was being overwritten by a new firing event before the old one could be fully processed.  Hence the use of permanant variables to keep track of things.
Event variables shouldn't be accidently overwritten - they only exist during that specific rule's execution. Even if you call that rule multiple times (like for several weapons), each call should use their own set of event variables. Of course, that's only my assumption based on past experiences and observation - I don't know about the inner workings of Nexus' script support, so there could be some sort of bug causing variables to leak into spaces they don't belong to.

Quote
ok, I'm a noob here, but what a hell I have to do to make it work? I already included this file in my mission script, and called that machine, replaced weapons with my own, but still no work, my weapons shoot as they originally supposed... btw, mission was created by nexus skirmisher...please help, cos I really love the idea of burst firing...
It's more of a modder's ressource and thus isn't as easily installed as an actual mod. I'll try to give a short guide:

(you'll need both Old Dragon's ppc.zip and my updated PPC.rar for this)
1. copy dev_weapons_new.ini to the mod's universetextstexts-folder
2. copy the contents of efx.ini to the mod's universeenginemod_efx.ini file
3. copy the contents of tacticstypes.ini to the mod's universetacticstacticstypes.ini (don't overwrite anything, just insert somewhere)
4. your mod may already have a DEVICETYPE 41 or DEVICETYPE 42, so change these two numbers of both inserted devicetypes to something, that's not being used already (e.g. for the Nexus Skirmisher mod, 360 and 361 work)
5. copy my ppc.mach to the mod's universemod_missions-folder
6. create a mission using the Skirmisher including a ship, that has the #weap_Light_PPC or #weap_Heavy_PPC onboard
7. open your mission file and include GetMachine("PPC"):ChangeState(Default, 0); in the SceneInit-RULE
8. include #include "PPC.mach" below the SceneInit-RULE

Repeat steps 6 to 8 for additional missions.

Offline nasharas

  • Recruit
  • *
  • Posts: 15
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #10 on: February 05, 2010, 11:22:00 »
so this is for old dargon's new weapon, but if I want to apply this burst effect to my own weapon? let's say I'm using b5:col mod and I choose #weap_EA_Hyp_Med_PulseCannon_B instead of
#weap_Light_PPC and  #weap_EA_Hyp_Hvy_PlasmaCannon instead of #weap_Heavy_PPC. It should work? I guess that parameters of these guns must be changed also?...

Update: It works that way... and I've got another question :D Is it possible to make that all shots from one burst would hit the same point on target ship, not scatter to a different points?

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #11 on: February 05, 2010, 11:59:50 »
Quote
so this is for old dargon's new weapon, but if I want to apply this burst effect to my own weapon? let's say I'm using b5:col mod and I choose #weap_EA_Hyp_Med_PulseCannon_B instead of #weap_Light_PPC and #weap_EA_Hyp_Hvy_PlasmaCannon instead of #weap_Heavy_PPC. It should work? I guess that parameters of these guns must be changed also?...
Yeah, you've got to change the parts of the script refering to #weap_Light_PPC and #weap_Heavy_PPC to suit your mod's needs. You'll also want to adjust the fire rate of the weapon to shoot more rapidly, thus making it look like an actual burst.

Quote
Update: It works that way... and I've got another question :D Is it possible to make that all shots from one burst would hit the same point on target ship, not scatter to a different points?
No, that's not possible using scripting, as far as I know. However, you can create a weapon efx, that would look just like that, but it would also technically count as a single shot.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #12 on: February 05, 2010, 14:56:15 »
Updated my original file to include Arparsos latest version so it's all in one convenient d/l in my first post.

The only time I've had a 'concentrated' burst is when I've specifically targeted a single device. Then the LPPC fire is concentrated.
Fire rate is controlled by the 'EnergyIn' line in the TacticsTypes.ini entry.
Better to look the fool by asking, then prove them right with ignorance.