XML Help SGEAW, please

  • orrila
  • orrila's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
06 Dec 2016 12:49 #85232 by orrila
XML Help SGEAW, please was created by orrila
Hello Anyone who can help

I have been messing about in the XML files of SG EAW (not TPC), to fix a few things that were bugging me, and I thought for fun, why not make it so the Ori beam was a one-hit kill weapon for hataks (yes overpowered, just for fun). I've been trying, and it seems one or two places say it doesn't work, because weapons can only target and damage hardpoints.
I was wondering if anyone knew any way around this, I was trying to explore a few avenues but with little success:

1. the hypervelocity gun gets around this, but I couldn't figure out how. Someone said it makes all hitpoints take damage, but I couldnt find how that works.

2. the eclipse superlaser gets around this, I was trying to make it a normal weapon and give it to ori with ori beam effect, but couldn't figure out how to rip off super laser code to normal weapon code (rather than special ability).

3. I found the sheet of lua commands, and unitobject.Take_Damage(int x) should make the whole ship take damage rather than harpoint, but I have no way how to make the ori beam use that command (base game lua files are compiled, and nothing to do with weapon firing in the SG EAW or TPC lua files that I can see).

4. Using an area-of-effect blast, such as in the arcturus_maximus_primus mod, doesnt work, as hardpoints on the same ship dont take damage, rather ships around it. I could make a blast which hits a ship and kills one hardpoint, destrying all ships around it but leaving the ship with the destroyed hardpoint intact. This look silly. Also, the way this mod gets round the issue is by disabling all hardpoints so they arent targetable, but I dont want to have to do that as for most things hardpoints are great.

5. It seems the zann consortium space station weapon and capital ship weapon get past it by not targeting hardpoints, but hitting a random place on the ship, but I could see of no way to make the ori weapon not hit a hardpoint.



So yeah, any ideas of how I could do this?

Thanks

Orrila

Please Log in to join the conversation.

  • Locutus
  • Locutus's Avatar
  • Offline
  • Administrator
  • Administrator
  • [SGMG] Project Co-Lead, Lead Coder, 3D-Artist
More
06 Dec 2016 17:41 #85235 by Locutus
Replied by Locutus on topic XML Help SGEAW, please
Hello orrila,

what you are looking for is actually not that easy to implement without side-effects.
You've made some notable efforts, let me add my thoughts:)

orrila wrote: 1. the hypervelocity gun gets around this, but I couldn't figure out how. Someone said it makes all hitpoints take damage, but I couldnt find how that works.

In TPC I have modified the Ancient Defense Satellites to (semi) one-shot targets. The code below can kill an enemy ship with a single shot - but only as long as you don't select a specific hardpoint and select the ship in general. If a weapon like this is used by the AI this will result in a two-shot kill. The first shot will always target a hardpoint while the second shot kills the ship.
The important part here is that the projectile category is default.
<Projectile Name="Proj_Ancient_Superlaser_Strong">
		<Variant_Of_Existing_Type>Proj_Ancient_Superlaser</Variant_Of_Existing_Type>
		<Projectile_Category>DEFAULT</Projectile_Category>
		<Projectile_Damage>9999999.0</Projectile_Damage>
		<Projectile_Does_Shield_Damage>No</Projectile_Does_Shield_Damage>
		<Projectile_Does_Tactical_Health_Damage>Yes</Projectile_Does_Tactical_Health_Damage>
		<Projectile_Does_Hitpoint_Damage>Yes</Projectile_Does_Hitpoint_Damage>
		<Projectile_Damages_Random_Hard_Points>No</Projectile_Damages_Random_Hard_Points>
		<Projectile_Acceleration_Per_Frame>0.0</Projectile_Acceleration_Per_Frame>
  	</Projectile>

orrila wrote: 2. the eclipse superlaser gets around this, I was trying to make it a normal weapon and give it to ori with ori beam effect, but couldn't figure out how to rip off super laser code to normal weapon code (rather than special ability).

I don't think there is a way around this. However you could attach an Object Script to the unit forcing it to fire the ability. It would be similar to the auto-usage of abilities in FoC except you couldn't turn it off.

orrila wrote: 3. I found the sheet of lua commands, and unitobject.Take_Damage(int x) should make the whole ship take damage rather than harpoint, but I have no way how to make the ori beam use that command (base game lua files are compiled, and nothing to do with weapon firing in the SG EAW or TPC lua files that I can see).

If you install the EaW map editor/mod tools you'll see a new mod called "source". It contains nearly all of the lua scripts in a decompiled form.
You can use Take_Damage() on the target ship (it works great) but the tricky part would be to determine which ship has actually been hit by the Ori ship. You could play with Tactical_Unit_Destroyed_Event but I doubt it'll work. An alternative way would be to give the Ori ship another ability (such as tractor beam or ion shot) and use Is_Under_Effects_Of_Ability("x") and play with that. But I can't tell you how good it will look and how well it works.

orrila wrote: 4. Using an area-of-effect blast, [...]

You mentioned the cons by yourself. I agree, it wouldn't work well.

orrila wrote: 5. It seems the zann consortium space station weapon and capital ship weapon get past it by not targeting hardpoints, but hitting a random place on the ship, but I could see of no way to make the ori weapon not hit a hardpoint.

You might be onto something here. I never looked into it, but the Zann weapon uses a special hardpoint to fire. But I'm not sure whether this would work in EaW too, a few things simply require the expansion.

Please Log in to join the conversation.

  • orrila
  • orrila's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
06 Dec 2016 19:18 - 06 Dec 2016 19:23 #85236 by orrila
Replied by orrila on topic XML Help SGEAW, please
Hi Locutus,
Thanks so much the in-depth reply, here is what I found when I tried things:

1. I tried to implement that code (set category to DEFAULT), but there were 2 problems:
this line was nowhere to be found in any other file (inc FOC XML's), you sure it exists as a tag? :
<Projectile_Does_Tactical_Health_Damage>Yes</Projectile_Does_Tactical_Health_Damage>
And this wasn't in any of the EAW files (I don't know what this does, I saw some stuff about frames when looking at eclipse super laser code):
<Projectile_Acceleration_Per_Frame>0.0</Projectile_Acceleration_Per_Frame>
Also, I have always taken the following line to mean that it will damage the hard points you aim at if yes, and damage randoms ones if no, is that correct?
<Projectile_Damages_Random_Hard_Points>No</Projectile_Damages_Random_Hard_Points>

also why is
<Projectile_Does_Shield_Damage>No</Projectile_Does_Shield_Damage>
no? or does it not matter?


2, 3 & 5:
I have been perusing the lua files, but at the moment they don't mean a lot to me. The trouble is at the moment, I have no idea what the context is of writing the lua files, e.g. how do I make sure the code runs when it needs to, where do I put it in relation to all the other lua, etc.
I am giving the tutorial made by Imperial a read (which looks great, thanks or writing it!), but currently it is still above my head. (it isn't that I haven't done programming before, I've done some C for my degree course, and have done a bit of tweaking with lua for the garrysmod addon "Carters Addon Pack", I just am lacking context for how the engine works and interfaces with the lua I think [there also aren't loads of examples doing what I want to do]).

So, I will be looking into that and may get somewhere, if I do I will post it here.
(as for the method when I do learn more, I think what you said is best, apply an effect when hit by an Ori beam once, and then use Take_Damage. I am surprised there is not some function which gets the current target of the AI or the player. If such a function doesn't exist, how does the code know which ship the player is aiming at?)


(If anyone else who sees this thinks of an easy way to fix that I haven't found, please post here.)

Also, Locutus, I have just looked at the modding tool collection link in your signature, and I would like to thank you for that, it is incredibly useful (currently using notepad++ for everything, which seems to work great atm). Also very useful to now have all the source files (I installed map editor before, but didn't use it much so uninstalled, but never realized it had source code).

Thanks

Orrila
Last edit: 06 Dec 2016 19:23 by orrila.

Please Log in to join the conversation.

  • Locutus
  • Locutus's Avatar
  • Offline
  • Administrator
  • Administrator
  • [SGMG] Project Co-Lead, Lead Coder, 3D-Artist
More
06 Dec 2016 20:06 #85237 by Locutus
Replied by Locutus on topic XML Help SGEAW, please

orrila wrote: this line was nowhere to be found in any other file (inc FOC XML's), you sure it exists as a tag? :

Not really, I can't remember where I copied it from. You can try to leave it out and see if you notice any difference.

orrila wrote: And this wasn't in any of the EAW files (I don't know what this does, I saw some stuff about frames when looking at eclipse super laser code):

I think that's a legacy line that I forgot to delete when I copied the code from the ecplise. Not sure what it does either.

orrila wrote: I have been perusing the lua files, but at the moment they don't mean a lot to me.

Yeah, you need to learn a few eaw-specific stuff to get it working.
In your case, you want to attach a script to a unit. You can do that by adding the name of script to the unit (without the .lua ending):
<Lua_Script>ObjectScript_Name</Lua_Script>. Then, you create a script with the specified name and place it at ...\Data\Scripts\ObjectScripts. I can't get you into the details now, I think Imperials tutorial is indeed a good place to start. For reference, you can also take a look at the object scripts of TPC - we use them a lot for special abilities.

orrila wrote: I am surprised there is not some function which gets the current target of the AI or the player.

You'd be surprised how many thing you can't do. You often have to work with crude workarounds...

orrila wrote: Also, Locutus,  I have just looked at the modding tool collection link in your signature, and I would like to thank you for that, it is incredibly useful

Thank you! Glad some people find it useful:)

Please Log in to join the conversation.

More
11 Dec 2016 16:30 #85267 by Imperial
Replied by Imperial on topic XML Help SGEAW, please

I am giving the tutorial made by Imperial a read (which looks great, thanks or writing it!)

You are welcome, thanks for liking it, Im really happy anyone is able to appreciate it ^^

and have done a bit of tweaking with lua for the garrysmod addon "Carters Addon Pack"

Cool I love Carters Addon Pack!

I just am lacking context for how the engine works and interfaces with the lua I think [there also aren't loads of examples doing what I want to do]

You may want to have a look at ultimate eaw's repository how lua is used to influence the game:
ultimate-empire-at-war.com/svn/trunk/Data/Scripts/
Going to add this hint to my tutorial as well.

Or look in the script directory of our mod in .\Stargate\Data\Scripts\GameObject, which contains more of my code. I use it quite different to the vanilla game creators.

but never realized it had source code

I didn't noticed it as well when I started modding some years ago.

Also, I have always taken the following line to mean that it will damage the hard points you aim at if yes, and damage randoms ones if no, is that correct?

I guess so.

And why is <Projectile_Does_Shield_Damage>No</Projectile_Does_Shield_Damage>, or does it not matter?

If no the particle can evade the shields and do direct damage to the Hull/Hardpoints, if yes it does damage to the shields instead.

<Projectile_Acceleration_Per_Frame>0.0</Projectile_Acceleration_Per_Frame>

I guess this is just another value for projectile speed.

Please Log in to join the conversation.

Time to create page: 0.112 seconds