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

Scenario Design
Moderated by Yeebaagooon, nottud

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: My easy way to fix the QV 6 decimals/zeros in message problem
posted 28 July 2006 08:32 AM EDT (US)   
Ok, for those of you who don't know what this is about, if you make a Quest Var, and try to display it in a message (message, chat, etc.), it also displays 6 decimal places behind each number, so you get something like "You just got 135.000000 gold!". Well, I figured out a relatively quick way to fix this by only copying and modifying 1 effect from typeeffect.xml, and only adding a minimum of 3 or 4 effects (including the message/chat effect) to a trigger, and it works with any number up to pretty much whatever the game can handle.

What this does is sends the Quest Var to some other number in the game that does not store decimals, and when the value is read by a message you don't get the extra 6 zeros, then it has to clear this number so it can be done again. The way I figured out will only require that you have at least 1 extra player space available in the game whose resources won't be used.

1. Open up typetest.xml from ...Age of Mythology\trigger2\ in Notepad and find "Grant Resources", make a blank line below the closing </effect> tag for the Grant Resources effect. I copied two parts from QV Tribute, the line where you input your QV name, and the trQuestVarGet() function so it can use the number, you just have to paste this:

<Effect name="QV Grant Resources">
<Param dispName="$$22301$$Player" name="PlayerID" varType="player">0</Param>
<Param dispName="$$22455$$Resource" name="ResName" varType="resource">food</Param>
<Param VarType="string" dispName="$$23952$$Var Name" name="QVName">QV1</Param>
<Command>trPlayerGrantResources(%PlayerID%, "%ResName%", trQuestVarGet("%QVName%"));</Command>
</Effect>

You can format it with the tabs if you want.

2. How to set up the effects for your game:

You have the effects to set up your QV, for example:
Quest Var Set: QV1 = 50
Quest Var Modify: QV1 * 5

Then you add these effects to make the message. You can use any available player, any resource (except for maybe Favor, since that has a limit of 100/200), and which ever mothod of telling the player (message, chat, spoofed chat, etc.) this is an example.

QV Grant Resources: Player 3, Gold, QV1

Spoofed Chat to player 1: "You just got "+trPlayerResourceCount(3,"Gold")+" Gold from killing an enemy!"

Quest Var Modify: QV1 * -1

QV Grant Resources: Player 3, Gold, QV1

And then add whatever else you need to.

This gives the empty Player 3 250 gold, equal to what you wanted to display to the player, reads this to the player, and then clears it. You could do multiple identical values at the same time, by adding the same gold to Player 3 and 4, but only clearing it from Player 3, so the gold value of Player 4 will act as the Total number.

So now you don't have to put up with something like "You just got 250.000000 gold, 56.000000 food, and 12.000000 favor from killing an enemy!", or try to make a ton of triggers to convert each number to a message.

Replies:
posted 28 July 2006 11:56 AM EDT (US)     1 / 12  
if this works

erm well i dont like edditing my files (ill kill it knowing my skill) so ill wait for some one to make a downloadable version.


Out Reach
The guy who writes the erotic fan fiction in Yeebaagoon's signature
posted 28 July 2006 12:32 PM EDT (US)     2 / 12  
You don't need to, you just have to copy and paste.

If you have typetest.xml, open it up and search for "grant resources", you'll find this:

<Effect name="$$22457$$Grant Resources">
<Param dispName="$$22301$$Player" name="PlayerID" varType="player">0</Param>
<Param dispName="$$22455$$Resource" name="ResName" varType="resource">food</Param>
<Param dispName="$$22456$$Amount" name="Amount" varType="long">100</Param>
<Command>trPlayerGrantResources(%PlayerID%, "%ResName%", %Amount%);</Command>

</Effect>
<Effect name="$$22458$$Ungarrison">
<Param dispName="$$19160$$Unit" name="SrcObject" varType="unit">default</Param>
<Command>trUnitSelectClear();</Command>
<Command>trUnitSelect("%SrcObject%");</Command>
<Command>trUnitEjectContained();</Command>
</Effect>

Just click on the end of the green line,press enter to create a new blank line, and paste the new effect in. It should look like this when you're done, minus the colors of course: (the tabs aren't needed, but you can put them in to make it look neat)


<Effect name="$$22457$$Grant Resources">
<Param dispName="$$22301$$Player" name="PlayerID" varType="player">0</Param>
<Param dispName="$$22455$$Resource" name="ResName" varType="resource">food</Param>
<Param dispName="$$22456$$Amount" name="Amount" varType="long">100</Param>
<Command>trPlayerGrantResources(%PlayerID%, "%ResName%", %Amount%);</Command>

</Effect>
<Effect name="QV Grant Resources">
<Param dispName="$$22301$$Player" name="PlayerID" varType="player">0</Param>
<Param dispName="$$22455$$Resource" name="ResName" varType="resource">food</Param>
<Param VarType="string" dispName="$$23952$$Var Name" name="QVName">QV1</Param>
<Command>trPlayerGrantResources(%PlayerID%, "%ResName%", trQuestVarGet("%QVName%"));</Command>
</Effect>

<Effect name="$$22458$$Ungarrison">
<Param dispName="$$19160$$Unit" name="SrcObject" varType="unit">default</Param>
<Command>trUnitSelectClear();</Command>
<Command>trUnitSelect("%SrcObject%");</Command>
<Command>trUnitEjectContained();</Command>
</Effect>

[This message has been edited by Phoenixx86 (edited 07-28-2006 @ 01:26 PM).]

posted 28 July 2006 07:12 PM EDT (US)     3 / 12  
If this does work, then it really is a marvellous find. Well done.
posted 28 July 2006 07:18 PM EDT (US)     4 / 12  
If this works, it's going on the site ASAP. And you, my friend, are going to be in the news. People have been trying to do this for ages. Amazing how the answer is so easy now that you think about it, yet nobody has ever tried it before.

Also, correct me if I'm wrong, but doesn't QV Grant Resources come with SNXT?


oh you can wait for what I can give
you know what I am so you know how I live
try to look proud but you’re not in the slightest
its happening now and it’s always been like this.
posted 28 July 2006 07:22 PM EDT (US)     5 / 12  
It doesn't, there are things very close, like QV tribute and QV playerresourcecount.

Yes, periods and smileys are the same for me
No matter what you say
posted 28 July 2006 09:32 PM EDT (US)     6 / 12  
Yeah, just QV Tribute.

Tributing to a player generates the "You've tributed 10 Gold to Player 2" announcement, so it would display multiple tribute announcements with the message if you needed to make a message containing multiple QVs. Also, tributing would require an extra player slot to be available, one to have the resources to tribute to the other player.

posted 29 July 2006 02:21 PM EDT (US)     7 / 12  
I thought I posted that effect ages ago, but I apparently haven't gotten round to it Mine has the exact same name...

Well, awesome find.

EDIT! Wow! You've also found the way to make it not get screwed up by HTML... I can't believe I didn't think of that

Might as well... This QV-ifies the player too. Not much help, but ye might as well

<Effect name="QV Grant Resources 2">
<]Param dispName="Player QV" name="PlayerID" varType="string">0</Param>
<Param dispName="Resource" name="ResName" varType="resource">food</Param>
<Param VarType="string" dispName="Var Name" name="QVName">QV1</Param>
<Command>trPlayerGrantResources(trQuestVarGet("%PlayerID%"), "%ResName%", trQuestVarGet("%QVName%"));</Command>
</Effect>

DOUBLE EDIT:

Going one step further, this trigger makes the "=" operator set the resources AT a particular value, rather than modifying it:

<Effect name="QV Grant Resources 1">
<Param name="PlayerID" dispName="Player" varType="player">1</Param>
<Param name="ResName" dispName="Resource" varType="resource">food</Param>
<Param name="QVName" dispName="Amount QV" VarType="string">QV1</Param>
<Param name="Oper" dispName="Action Operator" VarType="string">+</Param>
<Command>if("%Oper%"=="+"){</Command>
<Command>trPlayerGrantResources(%PlayerID%,"%ResName%",trQuestVarGet("%QVName%"));}</Command>
<Command>if("%Oper%"=="="){</Command>
<Command>trPlayerGrantResources(%PlayerID%,"%ResName%",0-trPlayerResourceCount(%PlayerID%,"%ResName%"));</Command>
<Command>trPlayerGrantResources(%PlayerID%,"%ResName%",trQuestVarGet("%QVName%"));}</Command>
</Effect>

If I'm not mistaken, I think oddy might of mentioned the latter to me a while back, but I'm not sure if he designed the trigger, it was ages ago. He deserves some credit for it, either way.

[This message has been edited by Xdaamno (edited 07-29-2006 @ 02:37 PM).]

posted 27 August 2006 02:41 AM EDT (US)     8 / 12  
Does this work online?

The boy with the mad imagination
Prepare for the ultimate duel!
Learn to use all my triggers and what you can do with them. Visit here.
Find out and download the transform trigger here.
Play some minigames I have created outside AOM including some 3D games here.
posted 27 August 2006 09:47 AM EDT (US)     9 / 12  
If the normal grant resources effect works online, then yes it should.
posted 27 August 2006 11:58 AM EDT (US)     10 / 12  
Sorry it took me so long to put this on the site, I completely forgot about it.

@Phoenixx86: Do you want your name on this page to be a link to your email, or should I leave it as it is?


oh you can wait for what I can give
you know what I am so you know how I live
try to look proud but you’re not in the slightest
its happening now and it’s always been like this.
posted 27 August 2006 02:10 PM EDT (US)     11 / 12  
Yeah, make the link my email please.

[This message has been edited by Phoenixx86 (edited 08-27-2006 @ 02:11 PM).]

posted 27 August 2006 02:36 PM EDT (US)     12 / 12  
Phoenixx86 has lost his Aom News Virginity to Papaya!


I lost it to King Jared....and it was short and fast...

Age of Mythology Heaven » Forums » Scenario Design » My easy way to fix the QV 6 decimals/zeros in message problem
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Mythology Heaven | HeavenGames