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.6 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 / 6       
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 / 6       
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 / 6       
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 / 6       
Izalith
Mortal
(id: Lilitu)
posted 13 January 2019 11:25 AM EDT (US)     5 / 6       
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 / 6       
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).]

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

Hop to:    

Age of Mythology Heaven | HeavenGames