You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by Yeebaagooon, TAG

Hop to:    
Welcome! You are not logged in. Please Login or Register.9 replies
Age of Mythology Heaven » Forums » Scenario Design » Improved Modify Protounit Absolute
Bottom
Topic Subject:Improved Modify Protounit Absolute
nottud
Mortal
posted 06 January 2019 07:33 AM EDT (US)         
For anyone that has used my original modify protounit absolute http://aom.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=13,29917,0,all there was an issue where some fields that are integer based would not work. I have discovered a second exploit which abuses integer overflow that allows integer fields to be set now too. Below is a modified improved version which should now work with every field.

<Effect name="Modify Protounit Absolute player range">
<Param name="ProtoUnit" dispName="$$22449$$ProtoUnit" varType="protounit">Anubite</Param>
<Param name="p1" dispName="lowest player" VarType="string">1</Param>
<Param name="p2" dispName="highest player" VarType="string">4</Param>
<Param name="Field" dispName="$$23943$$Field" varType="pufield">0</Param>
<Param name="Amount" dispName="Amount" VarType="string">1.0</Param>
<Command>trQuestVarSet("PlayerID", %p1%);</Command>
<Command>while(%p2%>=trQuestVarGet("PlayerID")) {</Command>
<Command>if(%Field% == 6){</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, -9999999999999999999.0);</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, %Amount% - 1);</Command>
<Command>} else if(%Field% == 5 || %Field% == 7 || %Field% == 10 || %Field% == 13){</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, 2147483648.0);</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, 2147483648.0);</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, %Amount%);</Command>
<Command>} else {</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, 9999999999999999999.0);</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, -9999999999999999999.0);</Command>
<Command>trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, %Amount%);</Command>
<Command>}</Command>
<Command>trQuestVarSet("PlayerID", trQuestVarGet("PlayerID")+1);}</Command>
</Effect>

As for how it works - I am not really sure but essentially if you overflow the integer field it seems to go to the same value regardless by how much, then I just need to normalise to 0 before setting the actual value.

NOTE: I don't know if this improvement will work in the non EE version as the handling of overflow may be different.

[This message has been edited by nottud (edited 01-06-2019 @ 07:39 AM).]

AuthorReplies:
TAG
That AoM Guy
(id: aom expert)
posted 06 January 2019 08:27 PM EDT (US)     1 / 9       
Nice!

Check out my YouTube
For live help with me, enter this chatroom. If I'm not on you can leave a message.
Izalith
Mortal
(id: Lilitu)
posted 07 January 2019 01:50 AM EDT (US)     2 / 9       
I remember with the old absolute modify I had some pufield cost overflow into other pufields. It regarded the unit cost which resulted in me getting gold for making units which should've costed 0 gold, probably transforming some vills into Ulfsarks. But dunno & couldn't replicate last time I tried, so might've been some issue on my end.

Azarath Metrion Zinthos

Steam: Order of Azarath
Twitch: twitch.tv/orderofazarath
Discord: Azarath @ https://discord.gg/3ENKJeb
nottud
Mortal
posted 07 January 2019 07:32 AM EDT (US)     3 / 9       
If you get the issue again let me know and I can look into it.

[This message has been edited by nottud (edited 01-07-2019 @ 07:34 AM).]

Hammerhands
Mortal
posted 13 January 2019 10:20 AM EDT (US)     4 / 9       
Izalith
Mortal
(id: Lilitu)
posted 13 January 2019 11:25 AM EDT (US)     5 / 9       
With "Modify Protounit" you only can change unit stats relative to their starting stats.

If you want an Ulfsark to have 100 HP you'd have to do:
Modify Protounit 20
Modify Protounit Absolute 100

If you ant a Medusa to have 100 HP you'd have to do:
Modify Protounit -260
Modify Protounit Absolute 100

The relative thing is horrible to work with cause you gotta look up all the stats and they could be different on different balance patches or mods or games (old game vs. EE balance).

Azarath Metrion Zinthos

Steam: Order of Azarath
Twitch: twitch.tv/orderofazarath
Discord: Azarath @ https://discord.gg/3ENKJeb
nottud
Mortal
posted 13 January 2019 03:01 PM EDT (US)     6 / 9       
Yea - a big useful I have is say you are playing tower defence and you want everyone's towers to cost 100 gold say:
* Set gold cost: 100
* Set wood cost: 0

This will work regardless of starting cost and as pointed out will not break with game patches.

@Izalith - having your think about your bug - one thing that might have caused your past problem is if you set the stats before the starting god techs activate and it makes the cost cheaper that might result in a bug that you described where it goes negative.

[This message has been edited by nottud (edited 01-13-2019 @ 03:32 PM).]

Someone_9999
Mortal
posted 14 March 2019 09:06 PM EDT (US)     7 / 9       
Tested it and it works in non-EE version too, very useful.

It only affects the base value and does not effect god bonuses or upgrades (like Oranos speed worship bonus) so you don't need to wonder if the result is different.

Nottud i think you have to make a new trigger file with all of your new triggers too.
Your file here misses a lot: http://aom.heavengames.com/downloads/showfile.php?fileid=7765

Except you already uploaded a new one and i didn't notice it.
nottud
Mortal
posted 15 March 2019 08:20 AM EDT (US)     8 / 9       
I need to do an update - trouble is I have changed the way my triggers are which would make it difficult to release a trigger pack without annoying everyone.
It only affects the base value and does not effect god bonuses or upgrades (like Oranos speed worship bonus) so you don't need to wonder if the result is different.
Not quite true. If you call in run immediately then yes god bonuses are not affected because they applied after the trigger fired. However if you call any other time including high priority it will wipe out the god bonus.

I have got some free time next week so I might look at doing such an update.

[This message has been edited by nottud (edited 03-15-2019 @ 08:22 AM).]

Someone_9999
Mortal
posted 15 March 2019 06:07 PM EDT (US)     9 / 9       
Indeed, you are right! Unchecking the "Run Immediately" box fixed the issue. Thanks!!

It would be great to see an updated file will all triggers so the rest of us will not have to copy/paste them from different topics! :-)

[This message has been edited by Someone_9999 (edited 03-18-2019 @ 07:35 PM).]

You must be logged in to post messages.
Please login or register

Hop to:    

Age of Mythology Heaven | HeavenGames