Replaceweapon doesn't replace

I want my 15 rapid-fire quantum torpedo launchers Uber-Defiant now! - Get help from modders. Share your work. Discuss modifications.
1, 2
posted on July 30th, 2013, 11:54 am
Bellow you may find two replaceweapon ODFs

The whole sequence belongs to a series of pods. Players supposed to get the pod as a starting unit with a replaceweapon which triggers in X time (in this case 10 mins).
The first ODF:

wpnname = "Era Advancement"
tooltip = "Era Advancement"
verbosetooltip = "This weapons replaces the Era pod with the refit pod."
buttonslot = 0
replacementmode = 2
replacementresetspecialenergy = 1
selectmode = 2
replacementinstantai = 1
replacementinstantplayer = 1
replacementinstantdelay = 600
transferstats = 1
replacement0Condition = "fed_pod0"
replacement0Class0 = "fed_pod0U"
replacement1Condition = "fed_pod1"
replacement1Class0 = "fed_pod1U"
replacement2Condition = "fed_pod2"
replacement2Class0 = "fed_pod2U"
replacement3Condition = "fed_pod3"
replacement3Class0 = "fed_pod3U"
replacement4Condition = "fed_pod4"
replacement4Class0 = "fed_pod4U"
replacement5Condition = "fed_pod5"
replacement5Class0 = "fed_pod5U"
replacement6Condition = "fed_pod6"
replacement6Class0 = "fed_pod6U"
replacement7Condition = "fed_pod7"
replacement7Class0 = "fed_pod7U"
replacement8Condition = "fed_pod8"
replacement8Class0 = "fed_pod8U"
replacement9Condition = "fed_pod9"
replacement9Class0 = "fed_pod9U"
replacement10Condition = "fed_po10"
replacement10Class0 = "fed_pod10U"
replacement11Condition = "fed_pod11"
replacement11Class0 = "fed_pod11U"
replacementignorefleetcap = 1
classlabel = "replaceweapon"
replacementKeepName = 0
special = 1
replacementmaintainorders = 1
replacementregisterasnew = 0
replacementcreationtype = 1
speakonattack = 0
attackspeech = 0



This weapon replaces the pod with a new one, one with a different replaceweapon. This one supposed to replace every ship and station in the Player's fleet with an upgraded version.

wpnname = "Station and Ship Upgrade Weapon"
tooltip = "Station and Ship Upgrade Weapon"
verbosetooltip = "This weapon refits stations and starships, and replaces the upgrading pod with the next Era pod"
buttonslot = 0
replacementmode = 2
replacementresetspecialenergy = 1
selectmode = 2
replacementinstantai = 1
replacementinstantplayer = 1
replacementinstantdelay = 1
transferstats = 1
replacement0Condition = "fed_pod0U"
replacement0Class0 = "fed_pod1"
replacement1Condition = "ffgalaxy"
replacement1Class0 = "fgalaxyrefit"


replacementignorefleetcap = 1
classlabel = "replaceweapon"
special = 1
replacementmaintainorders = 1
replacementregisterasnew = 0
replacementMaintainOrders = 1
replacementcreationtype = 1
speakonattack = 0
attackspeech = 0


But they don't do anything, at least nothing visible. It seems that not even the first replacement happens, but even if it does, then the second one won't happen because the starships are not replaced. All I managed to do is to make the first replaceweapon work, with replacementmode = 0 but of course that won't work because it spawns pods all over the place.
Any ideas?
posted on July 30th, 2013, 3:41 pm
Here's a tip; make the pod look like a ship. This would be for testing purposes, and will be removed when your done.

By having it as a ship, you can tell if its replacing it.

Also, don't try and replace too many things at once. That can cause problems when something fucks up, as you'll have to go through every line to see whats wrong.

Finally, you code looks right, so it must be something having to do with the ship/pod in question. Don't assume this right away, however, as there could be a tiny bit of code that I didn't see, such as a misspelling, that could be the problem.

Good luck.
posted on July 30th, 2013, 4:44 pm
Without knowing what type of implementation you are aiming for, it's difficult to know what you want to do.

Is it that you're trying to make this weapon replace every ship/station? What are these pods, and what are they supposed to do?

From a completely naiive standpoint, without knowing how you want to implement this (as there are several ways), you will probably have to use a limited time extraweapon that fires on all your ships and stations and gives them an auto replaceweapon. From your current design, it doesn't appear as if there's any way for your weapon to know which ship it is supposed to target.
posted on July 30th, 2013, 5:05 pm
I would need it for my mod to advance from one era to another, replacing the outdated ships with their refitted counterpart. The basic idea was that the first pod serves only as a counter, to count back till it's time to step to the next Era. Then it would have been replaced for one second with an "Upgrade pod" which would have had a replaceweapon which was supposed to replace all the ships with their upgraded variants, and it would have converted the Upgrade pod itself into a counter pod for the next era.
I investigated deeper and I realized it shouldn't work. If I understand the code correctly, the replaceweapon examines only those ships which have the weapon equipped. So if the Constitution has the replaceweapon but the Excelsior doesn't, the weapon replaces the Connies only, even if it has the appropriate strings for the Excelsior too.
The "replacementXCondition = " part is should be translated then to "which ODF has this weapon included?" and "replacementXClass = " would tell with what it should replace the ODF defined in the Condition part.

If I'm right, I just have to add the weapon to the ships, and only one question left: Can I define required techs for a replaceweapon?
If yes, then the "Upgrade pod" would serve as such, and as soon as the counter pod is replaced with it, the replaceweapon would trigger, refitting the ships and replacing the Upgrade pod with a new counter pod. Theoretically.
posted on July 30th, 2013, 5:18 pm
It's not possible to make autofiring replaceweapons limited by the techtree - you have to use an extraweapon of some kind to give your targets a replaceweapon that will auto fire :)
posted on July 31st, 2013, 5:57 am
Whoa... what? How do you give a weapon to a targetr if it's not defined within the ODF already?
posted on July 31st, 2013, 3:00 pm
Yes, uniordnance - unibeam/unitorpedo - are capable of using extraweapons :)
posted on July 31st, 2013, 3:20 pm
So, to use extraWeapon I need another weapon which hits the ships and stations first. But I can't remember any weapon which could autofire and hit every single gameobject on the map to give them extraweapon... Plus, it shouldn't even hit every objects, onl specific ones.
posted on July 31st, 2013, 3:31 pm
Your pod replacer weapon drops a uball, which autofires at every ship designated by valid targets, which grants an extra weapon, which causes the target to replace itself :)
posted on August 19th, 2013, 6:12 am
Ok, it's coming together nicely. The uball is created, it has a cannonimp weapon with a unibeam ordnance which would grant a replaceweapon extraweapon to friendly and neutral ships. But the weapon doesn't autofire. The replaceweapon separately works fine if I add it to the ship's ODF command.
How do you make a weapon to fire automatically? Or should I just define max autonomy for the uball? if I remember correctly you could do that in the stock Armada II.
posted on August 19th, 2013, 7:46 am
k_merse: How do you make a weapon to fire automatically?
if i remember correctly, when a u_ball comes into being it should automatically try to fire its weapon at all valid targets, although you need to make sure that it has sufficient special energy to work.
posted on August 20th, 2013, 11:00 am
I don't think it would be the problem. The weapon had no special energy cost. I tired to add it but it still didn't work.
Of course I never made a weapon from scratch, so the code may be wrong.

This is the u_ball:
basename = "fakira"
possibleCraftNames = "ENT-Pre-TOS upgrader"
verbosetooltip = "This is nothing"
supplycost = 0
classlabel = "u_ball_obj"
unitname = "Upgrade Pod"
tooltip = "Upgrade Pod"
race = "unitedfederation"
weapon1 = "fedW_extraweapon1"
weaponhardpoints1 = "hp01"
possiblecraftnames = "ENT-Pre-TOS upgrader"
lifeTimer = 20

Its weapon:
classlabel = "cannonimp"
wpnname = "Gives extra weapon"
tooltip = "Gives extra weapon"
verbosetooltip = "Gives extra weapon"
ordname = "fedW_extraweapon1o"
shotdelay0 = 0.01
hitchance = 1
impulsetohitmodifier = 0
stoptohitmodifier = 0
tohitimpulsemodifier = 0
tohitstopmodifier = 0
range = 400000
baseTargets = 999
targetLoop = 1
hitMode = 5
hitCloaked = 1
hitInvalid = 1
extraWeapon = "fedW_podU_Ent_Pre-TOS"
showEffectIcon = 0
validTargets = 0
"fentconst.odf" 1
"fentmining.odf" 1

I can't see anything I'm missing from that code but it still doesn't want to fire it and give extraweapon to the ships. The replaceweapon works fine. If I put it directly into the ship's ODF, it works. The u_ball is created, because the Akira model appears. So the missing link is the weapon which should hit the vessels and give them the replaceweapon.
And Armada II gives next to no information about issues like this one.
posted on August 20th, 2013, 4:21 pm
Your valid target exceptions need to be offset by at least one space - otherwise they count as a new line and are not linked to the valid target command :) .

If that doesn't work, try setting your shotdelay0 time to a bigger value. Say, 0.1. Small shotdelays can slip past the engine for some classes.
posted on August 20th, 2013, 9:18 pm
Good to know about these things. But unfortunately they didn't change the outcome, the weapon doesn't fire. I made the ordnance so it should look like a phaser beam, but it doesn't appear either.
Could it be something with the hitmode?
posted on August 20th, 2013, 9:37 pm
Depends on who is spawning your uball - if the uball is being spawned by team 0, you've got a problem.

Hitmode looks fine if set up by a uball spawned by the Player.


A major error though: the extraWeapon command is an ORDNANCE command, not a WEAPON command :lol:


Btw, it is a good idea to check through your ODFs and make sure that the commands you are using are referenced by the class in question. You've got several fake/wrong commands in these odfs, and I think I've noticed this in the past with ODF samples you've uploaded. I.e.:

supplycost (doesn't exist)
possibleCraftNames (Craft command)
1, 2
Reply

Who is online

Users browsing this forum: Google Adsense [Bot] and 2 guests