Post by Boaster on Dec 4, 2006 17:27:09 GMT -6
I've been doing a lot of updates revolving around artifacts and charges. It's really all good stuff. So I think it'd be a little nice of me to show you all (that care) how to do some of the stuff.
How did I start?
I was observing the Shrine of Vitality artifact ("gs/artifact/shrineofvit.gs") and I noticed it worked with charges. Though the most important pieces of data was how the artifact itself took away or added charges.
If you've been doing any editing at all, you'll understand what this piece of code says. For those who are more or less dummies, I'll explain.
artifactarmy artifactunit artifactself
Tells the artifact to look at the guy with the artifact, and then look at the artifact's own data.
ARTIFACT_CHARGES
ARTIFACT_CHARGES is a real value. This is how many charges it has remaining. Much like UNIT_HIT_POINTS is a real number which represents the current life points of a unit.
getartifactdata 1 gt
Make a call for the artifact's remaining charges and check to see if it is less than one.
After the complete statement, artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata 0 lt you insert your if or ifelse scenarios.
One code you might see placed in an /end_combat_proc{}def is artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata 1 lt{artifactarmy artifactunit artifactself destroyartifact}if
This says, if the artifact has less than 1 remaining charge, then destroy the artifact. Now that we got the simple shit out of the way, we can look into some more exciting uses for charges.
Things we can do:
· We can limit abilities on attack or defend.
· We can limit how many times an artifact's spell can be used.
· We can decide when we want the artifact to regain charges.
· We can manually take charges away.
· We can limit abilities on attack or defend and limit the number of times an artifact's spell can be cast, together.
· We can create equations that depend on charges.
We can limit abilities on attack or defend.
We can limit how many times an artifact's spell can be used.
We can decide when we want the artifact to regain charges.
We can manually take charges away and We can create equations that depend on charges.
Limiting how many times a spell can be cast and limiting how many abilities can be used in defending or attacking just uses combined elements.
[/u]Things to remember[/u]:[/b]
Manipulating artifact mana goes much the same way. So just replace the keywords with a different pair: ARTIFACT_MANA ARTIFACT_MAX_MANA.
So now you all know what the hell I'm doing and maybe you've learned something. I can do it, and now you can do it, and pretty soon your little brother will learn how to do it. It's that easy.
Later.
How did I start?
I was observing the Shrine of Vitality artifact ("gs/artifact/shrineofvit.gs") and I noticed it worked with charges. Though the most important pieces of data was how the artifact itself took away or added charges.
artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata 1 lt
If you've been doing any editing at all, you'll understand what this piece of code says. For those who are more or less dummies, I'll explain.
artifactarmy artifactunit artifactself
Tells the artifact to look at the guy with the artifact, and then look at the artifact's own data.
ARTIFACT_CHARGES
ARTIFACT_CHARGES is a real value. This is how many charges it has remaining. Much like UNIT_HIT_POINTS is a real number which represents the current life points of a unit.
getartifactdata 1 gt
Make a call for the artifact's remaining charges and check to see if it is less than one.
After the complete statement, artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata 0 lt you insert your if or ifelse scenarios.
One code you might see placed in an /end_combat_proc{}def is artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata 1 lt{artifactarmy artifactunit artifactself destroyartifact}if
This says, if the artifact has less than 1 remaining charge, then destroy the artifact. Now that we got the simple shit out of the way, we can look into some more exciting uses for charges.
Things we can do:
· We can limit abilities on attack or defend.
· We can limit how many times an artifact's spell can be used.
· We can decide when we want the artifact to regain charges.
· We can manually take charges away.
· We can limit abilities on attack or defend and limit the number of times an artifact's spell can be cast, together.
· We can create equations that depend on charges.
We can limit abilities on attack or defend.
/defend_proc{
attacker 0 UNIT_HIT_POINTS 3 copy getunitdata 1 sub 1 max setunitdata
soundfxdict /w1rng get playsoundfx
defender 0 artifactself ARTIFACT_CHARGES 4 copy getartifactdata 1 sub setartifactdata}def
We can limit how many times an artifact's spell can be used.
/can_be_used false def /spell_id spelldict /water_dispell get def /uses_wizard_mana false def /uses_artifact_mana false def /max_mana 1000 def /max_charges 300 def
We can decide when we want the artifact to regain charges.
Artifact charges, unlike artifact mana, do not automatically replenish at the begining of the turn.
begin_turn_proc{
currentturn 3 mod 0 eq
currentplayer artifactarmy ARMY_OWNER getarmydata eq and
artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata
artifactarmy artifactunit artifactself ARTIFACT_MAX_CHARGES getartifactdata lt and{
artifactarmy artifactunit artifactself ARTIFACT_CHARGES 4 copy getartifactdata 1 add
artifactarmy artifactunit artifactself ARTIFACT_MAX_CHARGES getartifactdata min setartifactdata}if
}def
If the current turn is divisible by 3, it's the begining of the wielder's turn and the remaining charges is less than the artifact's maximim amount of charges, then we can add 1 charge to it but without going over.
We can manually take charges away and We can create equations that depend on charges.
/defend_proc{
/steam_amount 0 2 gamerand def
defender 0 artifactself ARTIFACT_CHARGES getartifactdata 0 gt{
attacker 0 UNIT_HIT_POINTS 3 copy getunitdata steam_amount sub 1 max setunitdata
soundfxdict /w1rng get playsoundfx
defender 0 artifactself ARTIFACT_CHARGES 4 copy getartifactdata steam_amount sub setartifactdata}if
}def
Each time the unit gets hit, a variable will roll a random number. The artifact will check to see if more than 1 charge remains on the artifact. If yes, then the variable number will determine how much damage the attacker will take and how many charges to take away from the artifact.
Limiting how many times a spell can be cast and limiting how many abilities can be used in defending or attacking just uses combined elements.
[/u]Things to remember[/u]:[/b]
artifactarmy artifactunit artifactself ARTIFACT_CHARGES getartifactdata
artifactarmy artifactunit artifactself ARTIFACT_MAX_CHARGES getartifactdata lt
Remaining Charges > Maximum Charges.
artifactarmy artifactunit artifactself ARTIFACT_CHARGES 4 copy getartifactdata 3 add
artifactarmy artifactunit artifactself ARTIFACT_MAX_CHARGES getartifactdata min setartifactdata
Add 3 charges to the artifact and keep it from exceeding the maximum amount of charges.
/max_charges 300 def
Something you'll want to add if you want the artifact to have charges. If an artifact has charges, then charges will have priority over artifact mana and wizard mana. Also, when there are charges the artifact will never use artifact or wizard mana, period. So if you want other effects to be dependant on artifact mana, you'll be able to put it to use.
Place the max_charges statement around the spell data. It looks nice there and you'll remember where to find it.
Manipulating artifact mana goes much the same way. So just replace the keywords with a different pair: ARTIFACT_MANA ARTIFACT_MAX_MANA.
So now you all know what the hell I'm doing and maybe you've learned something. I can do it, and now you can do it, and pretty soon your little brother will learn how to do it. It's that easy.
Later.