This is not really an article. It's more or less meant to share some ideas of mine with you.TABLE OF CONTENTS:
Environment and skills
Relations between your heroes
WagesEnvironment
I'm, partly by means of an experiment, working on a simple, linear scenario. You start with a bunch of heroes and need to hack and slash your way through to the other end of the map, gradually improving on the way. However, this isn't all. Instead of a boring 'skills' system like "+1 attack for every 10 kills", your heroes really have to learn, and may also forget their skills again when they don't practice. In addition, heroes may become friends, and fighting near friends of course gives them a healthy boost. How do I realise all this? I'll first explain the skills system.Decide which kinds of skills you need. What about the following example skill: Line of Sight.
Decide in which situations the skills should be learnt. Line of Sight could be learnt when standing on a hilltop, overlooking the landscape!
Now, you need two triggers per hero, per skill, that determine whether you are in an "educative situation" (e.g. on a hilltop).
Whether you're on a hilltop should be decided based on cinematic blocks you put on each hilltop, let's call them "environmental markers". The conditions for the trigger are a disjunction ("OR") of the hero's distance to each environmental marker:ACTIVE
Distance to block A < 5 OR
Distance to block B < 5 OR
Distance to block C < 5 OR
...etc...
-->
QV Set "sight" to 1,
Fire the trigger below.
And of course you need triggers that check whether you're out of the situation again, that set the quest vars back to zero. In this case, the condition is a conjunction of the hero's distance to each environmental marker:INACTIVE
Distance to block A > 5 AND
Distance to block B > 5 AND
Distance to block C > 5 AND
...etc...
-->
QV Set "sight" to 0,
Fire the trigger above.
So, we have a quest var called "sight" that is set to 1 when the hero is in a educative situation for the Line of Sight skill, and set to 0 in any other situation. What we need now is a single trigger that constantly increases our hero's Line of Sight when the hero is in an educational situation (e.g. on a hilltop). I use a custom effect QV Modify Protounit for that, in which the delta field has a quest var as input.LOOPING, ACTIVE
timer 1 second
-->
QV Copy "delta_sight" from "sight",
QV modify "delta_sight" * 0.1,
QV Modify Protounit: Hero, LOS, delta = "delta_sight".
This trigger is active all the time, even when our hero isn't in an educative situation. But it only actually performs something when the "sight" QV does not equal zero. If "sight" == 0, then "delta_sight" == 0 also (namely 0.1*0), and nothing will happen. Only if "sight" == 1 (e.g. when on a hilltop), this looping trigger will slowly increase the LOS with 0.1 per second (namely 0.1*1).
Now, the good thing is that instead of only 0 and 1, we can set the quest var "sight" to any number. For really high hills (very educative!) it could be 2 (causing an LOS increase of 0.2 per second), and for low hills it could be like 0.5 (increase 0.05 per second)! And the best thing: the factor can also be negative, causing a skill decay! In example, when our hero is not in an educative situation, set "sight" back to -0.1 instead of zero. This way, LOS will slowly decrease again when you're not on a hilltop. The hero "forgets" his skill.
Summary of the triggers required for a "sight" skill for one hero:ACTIVE
Distance to block A < 5 OR
Distance to block B < 5 OR
Distance to block C < 5 OR
...etc...
-->
QV Set "sight" to X,
Fire the trigger below.
(Where X is the educational value of the situation. e.g. the higher the hill, the higher X. Any value from 0 to 2 is reasonable. In this case, you need a separate trigger for each educational value you wish (so group similar hills together, e.g. the low hills (0.5), the medium hills (1.0) and the high hills (2.0).)
INACTIVE
Distance to block A > 5 AND
Distance to block B > 5 AND
Distance to block C > 5 AND
...etc...
-->
QV Set "sight" to Y,
Fire the trigger above.
(Where Y is a negative value called the Forget Rate, depending on how fast your hero forgets. -0.1 would be reasonable.)
LOOPING, ACTIVE
timer 1 second
-->
QV Copy "delta_sight" from "sight",
QV modify "delta_sight" * 0.1,
QV Modify Protounit: Hero, LOS, delta = "delta_sight".
Other possible skills are: attack (when enemies are near, and the more enemies there are, the higher the "attack" quest var (or the educational value)!), forest (e.g. how far you can see in a dense forest, or how fast you can run there), negotiate (which you learn when nearby some allied or neutral units and which can be used to convert them to your side). Each skill can of course have different educational/forgetting values.
Of course you can add limits to the skills - you wouldn't want a hero with 100 LOS, that would be a bit overpowered. Making the learning process exponential solves this automatically (exponential means: the better your skills, the harder it is to improve it even more).I will add the part about relations between the heroes later on. It's even more interesting If you want a better explanation or a summary, please say so. I have written this very fast. If you want more maths or more formal trigger descriptions, or another skill example, or explanation on the limits and exponential part, also tell me. I hope you liked it so far Relations
There are four heroes. Each pair of heroes of course needs a "friendship" quest var that holds their relation-strength. This makes six quest vars total.
Relations are basically skills. However, instead of the "environment markers" above, you need triggers that check the distance between heroes. Also, it works best if another condition is that no other heroes, besides the two friends-to-be, are in the area. Otherwhise all units grouped together are constantly, passively, working on their relations - which is boring. I will not go into detail on the specific triggers you need for this. Just see for yourself.
Now, I want that befriended heroes, when near eachother, fight better (e.g. increased attack). You need a trigger that checks whether they're near eachother, and if so, modify the attack of both corresponding heroes by an amount linearly or exponentially (however important you want friendship to be) dependent on the friendship quest var. I used QV Modify Protounit for this and just used the friendship QV itself as input.
Of course you need to change the stats back as soon as they're away from eachother again. And that's where you have to pay attention: during the time the friends were near eachother, their relation improved. So, if you just substract the (now changed) relationship friendship quest var from the heroes' attack, a larger value will have been substracted from it than the one added to it in the first place. Solve this by copying the friendship quest var into a friendship_backup quest var at the time you boost the stats. Then substract this backup after the boost, instead of the - now changed - original quest var. Add the condition "timer 10 seconds" to the trigger ending the boost and check OR. This way, the boost will automatically adjust itself to the ever changing friendship quest var.Easy-peasy Again, tell me if you want a better explanations, and just tell me if you want an overview of the triggers required for this.Wages
Imagine you have to pay the wages of your army. Perfectly sensible, no? Then why is it never implemented? It's really quite easy First, we need a trigger that takes the wages from your gold amount, every, say, five seconds. To do so, we use the custom effect QV Grant Resources:
<Effect name="QV Grant Resources">
<Param name="PlayerID" dispName="$$22301$$Player" varType="player">1</Param>
<Param name="ResName" dispName="$$22455$$Resource" varType="resource">gold</Param>
<Param name="Amount QV" dispName="$$22456$$Amount" varType="string">QV1</Param>
<Command>trPlayerGrantResources(%PlayerID%, "%ResName%",trQuestVarGet("%Amount%"));</Command>
</Effect>
We then make a simple trigger like this, with the custom effect:
LOOPING, ACTIVE
timer 5 seconds
-->
QV Grant Resources: player 1, Resource gold, Amount QV "wages".
This trigger makes sure that every five seconds, the amount stored in 'wages' is added to your gold amount. This means that wages should have a negative amount (a number below zero) in order for it to [u]substract[/i] it from your gold amount.
To calculate the height of the wages, we need to store the number of military units you have in a quest var (because you don't pay your civilians, right?). To do so, we need another custom effect: QV Set Unit count by type.
<Effect name="QV Set Unit count by type">
<Param name="QVName" dispName="$$23952$$Var Name" VarType="string">QV1</Param>
<Param name="ProtoUnit" dispName="$$19160$$Unit" VarType="string">Military</Param>
<Param name="PlayerID" dispName="$$22534$$Fake Player" VarType="player">0</Param>
<Command>trQuestVarSet("%QVName%", trPlayerUnitCountSpecific(%PlayerID%, "%ProtoUnit%"));</Command>
</Effect>
Let's say I want each soldier to earn 2 gold pieces every 5 seconds. To do this, I just multiply the amount of soldiers by two, using quest var modify. However, remember that the "wages" quest var needs to be a negative value, so I multiply it by minus 2. I modify the simple wages trigger I created earlier:
LOOPING, ACTIVE
timer 5 seconds
-->
QV Set Unit count by type: QV "wages", player 1, military units only.
Quest Var Modify: "wages" * -2
QV Grant Resources: player 1, Resource gold, Amount QV "wages".
And there we are!
Do you know the "slippery slope"? It means that once a player is ahead of the rest, he'll remain ahead of the rest forever. To avoid this, just make the wages increase quadratically with the amount of soldiers. Multiply it with itself! However, the value will be extremely high then. So you have to divide it by some numer again. Then you get this:
LOOPING, ACTIVE
timer 5 seconds
-->
QV Set Unit count by type: QV "wages", player 1, military units only.
Quest Var Modify 2: "wages" * "wages"
Quest Var Modify: "wages" / -100
QV Grant Resources: player 1, Resource gold, Amount QV "wages".
What does the "-100" mean? It means that when I have the square root of 100 soldiers, each soldier costs 1 gold. Let's see if this it true: the square root of 100 is 10. Say I have 10 soldiers, the wages are then 10*10/-100 = 100/-100 = -1. It's true!
Let's see what this means for gameplay. Imagine I have 1 unit, the wages are then 1*1/-100 = -0.01 gold - not much. With 20 units, the wages are 20*20/-100 = -4 gold. Now imagine I have 50 units, the wages are then 50*50/-100 = 2500/-100 = -25 gold. That's quite a lot compared to 0.01 gold for 1 unit. Because it increases quadratically, the more soldiers you have, the more each soldier costs!
Now, of course something needs to happen when you run out of gold. What about a looping trigger damaging all soldiers in the area by a small amount? Or using change units in area to convert all your soldiers to mother nature?So with only one trigger, you have created a lovely wages system, which can even solve the slippery slope! All clear? [This message has been edited by Archaeopterix (edited 10-07-2006 @ 02:57 PM).]