Question on Triggers and unitProperty

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Question on Triggers and unitProperty

crazy_german
Greetings all,

I would like to use a trigger to change the fuel cost of a unit. Looking in the Pact of Steel 2 XML, I couldn't find how to do so. I tried this code and it didn't work

        <attatchment name="triggerAttachmentGermanFuelEfficiency" attatchTo="Germany" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
                <option name="conditions" value="conditionAttachmentGermanyTech01"/>
                <option name="when" value="before:GermanyNonCombatMove"/>
                <option name="unitType" value="infantry"/>
                <option name="unitProperty" value="fuelCost" count="Gas:5"/>
        </attatchment>

Is this something the engine can do? If so how?
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

Cernel
Triggering the fuel cost on different values for Combat and Non Combat Move has the big issue that it is charged upon loading, not upon unloading, sadly (Veqryn did this because there were issues with charging it upon unloading, and he said it would have been too much work to put it to work that way, thus he went for charging it on loading, while initially it was charged upon unloading, but was bugged). For example, if you say that Armour costs 1 PUs fuel during Non Combat Move and 2 PUs fuel during Combat Move, which would be an interesting dynamic, then you would pay 2 PUs if you load and unload it during Combat Move, but only 1 PUs if you loaded it during the previous Non Combat Move phase, which makes no sense.
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

Cernel
In reply to this post by crazy_german
Also I believe it is very weird for non-Americans to see the liquid motor fuel (assuming you are meaning petrol, not kerosene) called gas. I would suggest to at least call it gasoline, or most non-Americans I suppose will think you are talking about some natural gas, like methane.
Just a warning, since I think most not-Americans won't think about something liquid when something is called "Gas".
But maybe it's just me.
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

crazy_german
The idea is just to let someone develop a tech to spend less on fuel, and I have the techs activating before noncombat move. It might get moved to the end of turn phase, that's not really the important part. I'll consider renaming gas as well

Do you know if its possible to set triggers to change properties like this? The format I have does nothing (as far as I can tell the engine just ignores that line of code). I could have sworn there was a way to change unit properties that needed at least 2 variables, but I can't find how to format it for the XML.

Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

Cernel
Ah, if it lowers the cost of fuel and doesn't increase it anymore then it is totally fine, nevermind that (I just guessed you wanted to do it like in Roll Through The Reich).
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

Cernel
In reply to this post by crazy_german
Ah, and yeah, "5:Gas" not "Gas:5".

Cheers
History plays dice
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

crazy_german
Thats the fix I needd, thanks Cernel

Out of curiosity, are there any other issues you know of with switching fuel costs on and off throughout a game? I actually had something like that planned (but it wouldn't affect transports)
Correctly crazy, disingenuously German
Reply | Threaded
Open this post in threaded view
|

Re: Question on Triggers and unitProperty

Cernel
I'm almost sure switching fuel on/off works fine; tho purists would say it's a hack.

As long as you are making a game with no air and no naval there are no other issues either.

The only absurdity is the load / unload I detailed.

With naval, there is the nonsense that a ship staying in the middle of the ocean forever will have no fuel costs forever, which makes the TripleA absurdity of not having to have to go back to port worse off.

With air, there is the nonsense that you use fuel on the fly, which means ridiculous to calculate for what you need in noncombat and maybe you will finish the fuel on the fly and crash, which is silly. Also the engine does not check for all aircrafts having the fuel needed to safely land, which means kamikaze fuel is allowed.

Honestly, at its current state, I think fuel should be used only for land units, never for sea or air units, unless getting very creative with triggers etc. or if it is enough marginal that you never have to worry to consume it all.
History plays dice