|You must be logged in to post messages.
Please login or register
Scenario Design and Discussion
|Topic Subject:||UP 1.5 Effects & How to use them in Maps|
|« Previous Page 1 2 3 ··· 5 Next Page »|
posted 08-31-17 09:19 AM CT (US)
Hello friends! This post will probably be quite lengthy, and be updated as UserPatch does adding new features, so watch this space. For this reason, I'm not writing it as a University entry because of the constant updates that UserPatch is getting right now and I don't want a University article needing constant revisions to keep it up to date.
The UP Effect, or up-effect, is a special feature of UserPatch 1.5-onwards that -- put simply -- allows some basic data modding within the Scenario Editor.
What that means is that you can
Why is this a big deal? Well, a little history lesson:
DotA 2 is a "Moba". DotA 2 exists because DotA 1 Exists. DotA 1 exists because of Warcraft 3.
"up-effect" works by using AoC's Technology Effect system. Everything that can be achieved through technology effects can be achieved through up-effects (with some notable additions)
I have also been answering a lot of questions on the topic of using up-effects, and what they can achieve.
These are up-effect, and up-attribute. I will talk more about up-attribute later.
But you'll get the hang of it!
To use a up-effect, you need a Display Instructions trigger. To prepare it for an up-effect, set the timer to 99999999 (
One thing you might struggle with is remembering all the 9's for the timer field. You can't just put any old number in there (unless Scripter changes that in the future), you
Next, we start the "Message" field with "up-effect". Until you get used to it, I suggest also completing it with 0,0,0,0,0,1 -- Like this:
This should hopefully help you to keep track of all your numbering. The up-effects all rely on numbers, and there must always be six of them. Let's dissect them:
In Scripter's documentation, he writes:
Looking at that, a quick glance might make you think that you can write something like "up-effect 0,SET_ATTRIBUTE,VILLAGER_CLASS,ATTR_HITPOINTS,200,1" but this isn't correct. The reason Scripter has written these block-capital words is probably due to the way up-effects can be put into random map scripts, using these words instead of numbers like we do in a scenario.
So, Scripter provides an example:
The top line is what you'd do in our Display Instructions trigger. The bottom line is what you'd put in your random map script. I haven't experimented with the random map script functions yet, and probably won't ever. So I won't talk much about them here, but it is useful to note that there's potential for making random map scripts that, for example, incorporate X-Patch's balance changes, without needing the mod. This is something that, whilst I won't use it (probably), should definitely not be overlooked as a cool side-effect.
So instead of just copying Scripter's example, let's do our own.
First, we want to choose the player for our effect. You can use 0, 1, 2, 3, 4, 5, 6, 7 or 8. 0 means "All Players", 1-8 should be self explanatory. I haven't experimented with the Gaia attributes much, but as I understand it -- if you want to specifically effect
I'm going to use player 1.
Next, we want to decide on our "effect". I'm going to keep things simple, and ignore everything that doesn't affect a unit. In the documentation, under file "UserPatchConst.rms", Scripter writes:
If you were writing a Random Map Script, you'd use these const names. We however are only interested in the numbers.
So, these numbers:
So, have you decided what you want to try? I'm going to SET, so my second number in the up-effect line will be 0. It looks the same as before, but yours might not.
The third number is a big deal. This is what we're going to effect. There's two ways we can do this.
up-effects can effect any individual unit whose ID is between 0-900, and 1000-1959. IDs in the 900-999 range are actually reserved for counting data (According to Scripter), so he's made use of them for Classes. This means that if you want to affect a Longbowman like in my above example, you want "8". But if you want to affect ALL archer units, you'd use "900", because an Archer is class 0.
In our experiment, I'm going to pick number 24 - The Crossbowman. Now my up-effect line looks like this:
(I'll award bonus points to anyone who can point out how dangerous this line is for my crossbowman, right now.)
Our fourth number is also an important one, and it changes depending on our second number. If our second number is 0 (Set), 4 (Add) or 5 (Mult.), this fourth number is an Attribute ID. But, if our second number was, for example, 2 (Enable Object), then this fourth number would be either 0 (To Disable), or 1 (To Enable). Scripter's documentation explains some of these, albeit a bit confusingly. EG, for "Enable Object" he writes:
You have to scroll further into the document to even find where "ATTR_DISABLE" and "ATTR_ENABLE" translate from Random Map Script text to a Scenario number:
So, in our case we just want to do some simple messing with Attributes. So, your second number should be 0, 4 or 5. We want to then pick an Attribute from the list:
Scripter has also added some special ones:
If you look at the list of attributes, you'll be able to find Attribute 16 and get an idea of what it can do. I'll give you a clue -- It's used by the tech "Chemistry". I advise you skip Attribute's 9 and 8, as they need some special maths which I will explain later.
Our fifth number is the "Value". In my case, I need a Unit ID. In some cases you might want to use percentages, or float values. For that, you'll need to remember that a value of "100", with a "Style" (The sixth number) of 2, will make it "1.0". You may be wondering why you can't just write in "1.0", and I wonder that too. But clearly -- if that was possible then Scripter would of let us do it that way.
So, I've went ahead and picked a Unit ID for my Attribute 16:
My "Style" -- The sixth number -- will remain as 1. This is because I don't need to convert my fifth number into a percentage. If you were doing something like, adding 10% to the Longbowman as above, your Style here would be 2 and your Value would be 110. This turns into 1.10x, or 110% of the original value. The Effect (Second number) would be 5, because you're Multiplying.
Something to bare in mind is that this projectile change could be overwritten if I were to later research Chemistry.
Now, this example might be a bit extreme. Changing projectiles is a very specific effect. But, hopefully you've experimented and chosen your own values and attributes to change. Be careful when changing Projectile IDs, though. If you choose an ID that is not a valid projectile unit, the likely case will be that your attacks will fire no projectile and do no damage, and unlike Melee Units that have their projectile ID set to -1, a projectile ID set to something like a Watch Tower would cause the game to try spawning a watch tower and failing, thus the game would deduce that the projectile did not hit and do no damage.
This could be drastic in a scenario where the projectile might not change for a long time into the map, on a specific unit. The map designer might not even notice that he's firing blanks, because he's not firing a proper Projectile unit.
Off the top of my head, here's some other examples of up-effects for units:
Something to remember;
When doing up-effects, each up-effect should be on a separate line, like this:
And a Display Instructions effect can only hold so much text. There will probably come a time where you need to use multiple effects.
First, let's look at MOD_RESOURCE (Effect ID 1) and MUL_RESOURCE (Effect ID 6). Contrary to my original belief, these
Here's an example:
The Player is 1, the Effect is 1 (MOD_RESOURCE), the Item is 4 (Population Headroom), the Attribute is 1 (When using MOD_RESOURCE, use 0 or 1. 0 SETS, 1 ADDS.), the Value is 100, and the Style is 1.
What this does is simple -- adds 100 Population Headroom to Player 1. It doesn't go over the player's Pop Cap max, though.
So what's the point of this, if I can use Tributes for the same effect? (And oh boy, can you use Tributes. UserPatch allows you to select every available resource for Tributes, including ones added by Scripter.)
Well, unlike tributes you can now:
Furthermore, these tributes allow you to have control over the Weather and Fog lighting systems in UserPatch 1.5. A very good article on the University
Secondly, let's look at Tech modifications. This one is a bit weird, because there's
Before we get onto that, though; let's look at Effect 7 (Enable Tech). This work just in the way that disabling/enabling techs through the Research Technology triggers work, with the exception that you can enable/disable techs that aren't listed in the vanilla editor. However, you can't Research techs with this, only Enable or Disable them. This and Effect 102 (Disable Tech) are aimed more for use in Random Map Scripts, where triggers don't apply.
I've been having difficulty working with the Tech effects. For example, I can't seem to get Effect 8 to work correctly. Hopefully Scripter can enlighten us.
What I have been able to get working, is Effect (The second number) 100, 101 and 103.
So, for example, you might want to take Loom for Player 1 and make it cost 500 Gold. You'd do that with this line: up-effect 1,100,22,3,500,1
However in my experience I've been unlucky with adding new resources to the costs. You can also use Effect 8 (MODIFY_TECH) to achieve the same effects, but again, I can only seem to affect costs that already exist. I can Change the gold cost of Loom, but I can't make it have a Stone cost.
Using the GAIA effects is a little unknown to me. I assume they're specifically for affecting units owned by GAIA, so lets try it out: I'll use the line "up-effect 0,-1,4,0,200,1" -- In theory this should set GAIA archers to have 200 HP.
Seems to be a success:
So I can assume from these results that you need the Player (the first number) to be 0, to affect all players. Then the Attribute set to one of the negatives that only affect GAIA.
From Scripter's Documentation:
I've not noticed any performance penalties that don't normally occur. Due to the way up-effects work, the game handles it really well, just like any Tech effect. up-effect can also be used to affect over 300 units at once, and also affects units not even created yet. For example, in a multiplayer RPG I've been working on as a "showcase" of UP effects, I have a scaling difficulty where every 25 losses, the enemy player gains 10% HP on all their units, created or not. Looping up-effects also has a very little impact. Almost unnoticeable unless you have a lot of them going off at once.
The same performance nicety's can't be extended as much to up-attribute, though, and we'll talk about that in the next post...
Co-creator of Silent Evil - Voted Best Multiplayer Scenario of 2009
and The Seas of Egressa - Voted Best Multiplayer Scenario of 2010
[This message has been edited by BF_Tanks (edited 07-06-2018 @ 01:38 PM).]
08-31-17 09:19 AM
1 / 157
"up-attribute" is different to "up-effect" because it targets specific units through the Change Object Name trigger.
What this means is that, the unit it affects gets separated out from other units, meaning any future techs don't affect it (Just like the regular Change Object triggers, or Conversions/Changed Ownership). Theoretically, you
What I mean by that is, it takes a lot more processing power (Just like regular Change Object triggers) than a simple tech effect. When I say a lot, I mean if you have over 100 or so going off on loops constantly, the game will noticeably lag -- and worse in Multiplayer. Something people have noticed are Scripter's words:
which is very true, but only for up-attributes. My theory on why it's more performance intensive is because it's singling out individual units and storing their data in separate arrays, Whilst tech effects apply blanket changes to one piece of cached data.
You can't affect Line of Sight, (But that's done through the Change Object Range trigger) and you can't affect GARRISON ARROWS (Which actually means MINIMUM PROJECTILES).
What are the types?
Every living unit is Type 70. Every building unit is Type 80. Every Dead Unit is Type 30. Every projectile is Type 60. Every Tree, Mine, Bush, Fish, etc are Type 10. (Type 15 I believe is actually unused, despite being called "Tree".) GAIA Eye Candy objects are also Type 10 (Haystacks, etc).
This means up-attribute triggers (And by extension, any Change Object triggers) can only affect living units and buildings. Take note, because I'll be talking about Types in a later post.
So what are the benefits?
Well, it's quicker to write, and it adds some nice flavor to Change Object triggers. That's about it, really.
Here's a comparison of two triggers, both doing the same thing:
Let's dissect the trigger on the left;
It's a Change Object Name trigger, so already we know what the scope is in terms of what it can apply to. We also need to set the Number field to "1".
Next, the writing. Following up-effect rules, each effect has to be on a separate line. But in the up-attribute, we are missing two numbers -- The Player (as it's set by the trigger itself) and the Item (As we're determining it with the trigger) You also can't change a name and set up-attributes in the same effect, but that should be obvious.
To quote Scripter again for details:
Over-all, there's a lot less uses for up-attributes, due to the fact there's already a Change Object HP Trigger, which can set, add and heal-to. A Change Object Attack Trigger, that can set and add. And the various other triggers such as speed, range and armors.
Co-creator of Silent Evil - Voted Best Multiplayer Scenario of 2009
and The Seas of Egressa - Voted Best Multiplayer Scenario of 2010
[This message has been edited by BF_Tanks (edited 08-31-2017 @ 01:31 PM).]
08-31-17 10:56 AM
2 / 157
A lot of the content of this post is being researched actively and I will update it as my studies get results.
"player" is the first number. "effect" is the second number. "item" is the third number. "attr" is the fourth number. "value" is the fifth number. "style" is the sixth number.
"mode" is the first number. "attr" is the second number. "value" is the third number. "style" is the fourth number.
"up-effect" can have different
* * * * * * * * * *
Depending on your "effect" number, the use of "attr" numbers changes. Below is a list of all the "effect" values you can have and how they are used:
For example; Upgrading a Bamboo Tree to a Pikeman will make a Pikeman that isn't animated, that you can attack with a unit to kill, or chop with a villager to get 1 wood. Be very careful, whilst some of these effects may be cool and a lot I haven't tested yet (Still as a statue units, or units you can pass through, etc.), the usual result from selecting one of these units (until it's dead) is an instant crash to desktop.
And unlike techs, you don't need to disable/enable the unit to see the cost changes.
* * * * * * * * * *
These are "Unit Attributes" and are for "effect" 0 (SET), 4 (ADD) and 5 (MULTIPLY), or "up-attribute". I'll try to list them all in a uniform fasion, going Attribute number (Scripter's Name)
For reference, Here's the list of Types:
"Hitpoints" ranges from -2147483648 to 2147483647. Below 0, the unit will die -- but this isn't always the case. The actual value can exceed 2147483647 but will show as a negative:
This will cause the unit to be invincible and show no health bar.
When you use a Damage Object trigger, for negatives or not, you're affecting the Hitpoints of a unit. Whilst a Change Object HP trigger affects both Hitpoints AND Max-Hitpoints. Want to affect ONLY Max Hitpoints? Use a up-attribute where the "attr" is 0. This will ONLY add to the Max-Hitpoints, meaning you can start units half-damaged. Affecting Hitpoints through a Damage Object trigger does NOT separate the unit from receiving tech-effects like a Change Object trigger does.
I've seen a lot of people refer to an invincible unit trick by using multiple damage object effects set to 2147483647, when really you just need one -- 2147483648. This will bring the range around to -2147483648 (in the trigger field too), thus causing the unit to have more damage than the range can hold, meaning its health is now out of the bounds of the game engine, and it's unable to check if the unit's health is low enough to die. The unit also stops receiving any damage, except from trigger sources.
Let's say you want to set 20 Melee Armor to an Elite Teutonic Knight. First we have to find the ETK in the Data, so we use AGE, find the unit ID (554) and then look for its Armor table:
Melee Armor is the Second entry in the list, so its Index is 1 (because we start with 0.) -- This means, we need to multiply 256 by 1, to get the "0" value for this armor class. Then we add 20, so in our up-effect we use "276", to get 20 Melee Armor.
The drawbacks of this are that we can't set the value above 256, because then we'd be moving onto the next entry in the table. We also cant add any new armor classes this way, nor can we give the class a negative value.
However, if we ADD, it's a bit different. Instead of finding the Index of the armor class we need, we look instead for the armor class value itself and multiply that by 256. So in this case, if I want to ADD 10 armor to get 20, I would need to multiply 256 by 4, and add 20 to that.
Can we ADD a new armor class? To find out, I've stripped away an ETK's Base Melee and Base Pierce, and instead I'll ADD 100 Cavalry-class armor.
Now, we can't see if the Cavalry class armor has been added or not without trying him against some cavalry, and unfortunately it does not seem to have added the armor.
The more MAX_DUP_MISSILES, the more your building can fire when units are garrisoned. However, If you have 10 MAX but only 5 Garrison Capacity, you'll still only have five projectiles.
As it's 8 bits, we configure it by adding the values of individual bits to get a total. Here's the bit values and what they correlate to: