Random Damage Type
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Random Damage Type
I want to make an attack which deals damage that's of random type, rerandomized on each individual bolt (so a 8-3 randomly hot*/cold could go hot cold hot, for example). I'm willing to sacrifice the damage prediction being accurate.
I'm supposing the general idea is I assign an event to the unit type; and the event reacts to each attack that has this special and changes its damage type just before it goes off?
I'm looking at the EventWML wiki page and figuring out how to do that.
I'm thinking
Okay, so supposing that'd trigger, I don't see anything in DirectActionsWML that would do this unless I implement it as giving the unit an object that'd have an Effect that'd change their damage type. There is a uniqueness restriction on objects, that I don't want. And I don't see what sort of filter I can put on DirectActionsWML that'd indicate which unit is the one doing the attack.
Now, it is not necessary for the damage type to be maintained individually for each unit with the special, as it'll be rerandomized before each hit anyway. But I don't want things to slow to a crawl if 20 low-level pastamancers get into a fight, and I don't want only one of them to be able to get a particular damage type.
So... where do I go from here? Will I need to learn Lua?
* I'm using nonstandard damage types
I'm supposing the general idea is I assign an event to the unit type; and the event reacts to each attack that has this special and changes its damage type just before it goes off?
I'm looking at the EventWML wiki page and figuring out how to do that.
I'm thinking
Code: Select all
[event]
name=attacker hits
[filter_attack]
special=randomlyhotcold
[/filter_attack]
... what goes here?
[/event]
Now, it is not necessary for the damage type to be maintained individually for each unit with the special, as it'll be rerandomized before each hit anyway. But I don't want things to slow to a crawl if 20 low-level pastamancers get into a fight, and I don't want only one of them to be able to get a particular damage type.
So... where do I go from here? Will I need to learn Lua?
* I'm using nonstandard damage types
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
The Kingdom Of Loathing Era
Re: Random Damage Type
so wheres the point of having random damage types ?
answer:
different damages affect different resistances, so there will be different amount of damage done.
so the main goal is to generate DIFFERENT DAMAGE VALUES (assumed the fire/cold resistances of the target are different - if they are not, there wont be any difference)
so if yu cant do REAL random damage types, you can at least SIMULATE it by adusting the damage
now im not going to post code here, but thats the approach i would try.
(exchange fire/cold with the damage-types you are ging to use)
answer:
different damages affect different resistances, so there will be different amount of damage done.
so the main goal is to generate DIFFERENT DAMAGE VALUES (assumed the fire/cold resistances of the target are different - if they are not, there wont be any difference)
so if yu cant do REAL random damage types, you can at least SIMULATE it by adusting the damage
now im not going to post code here, but thats the approach i would try.
(exchange fire/cold with the damage-types you are ging to use)
The best bet is your own, good Taste.
Re: Random Damage Type
Code: Select all
[event]
name=attacker hits
first_time_only=no
[filter_attack]
special=randomlyhotcold
[/filter_attack]
{FOREACH unit.attack i}
[if]
[variable]
name=unit.attack[$i].specials.randomlyhotcolddummy.id
equals=randomlyhotcold
[/variable]
[then]
{RANDOM hot,cold}
{VARIABLE unit.attack[$i].type $random}
[/then]
[/if]
{NEXT i}
[unstore_unit]
variable=unit
find_vacant=no
text= _ "going $random"
[/unstore_unit]
[/event]
If the above doesn't work, then the alternative would be something akin to what you'll find in the LessLuck Era, but even more complicated and lots more verbose since attack specials can't change the actual damage type, just the damage. I wouldn't even try to do that as it is.
Re: Random Damage Type
looks great though.zookeeper wrote:That's just what I'd try first.
and i think i learned something from looking at it
(concerning the random values ... )
The best bet is your own, good Taste.
Re: Random Damage Type
You're unstoring a unit without storing it. Is that kosher?
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
The Kingdom Of Loathing Era
- PsychoticKittens
- Posts: 573
- Joined: May 29th, 2006, 8:49 pm
Re: Random Damage Type
I believe that in that event type "unit" is prestored as the unit attacking. Or sommat like that.
Creator of: Mercenaries Era; Modern Combat
Future Projects: Faunima: Land of Monsters
Temporarily Dropped Projects: Zombie Horde
Future Projects: Faunima: Land of Monsters
Temporarily Dropped Projects: Zombie Horde
Re: Random Damage Type
Whoopdy-dee and trolly-bazoo! It works!
Thanks a lot!
Thanks a lot!
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
The Kingdom Of Loathing Era
Re: Random Damage Type
awesome.
kinda cool idea if you ask me
(and after thinkg a bit about it)
it makes a units attack unpredictable.
kinda cool idea if you ask me
(and after thinkg a bit about it)
it makes a units attack unpredictable.
The best bet is your own, good Taste.
Re: Random Damage Type
Ohoho, I am going to have fun with this! When 0.1.6 comes out, start a fight between some pastamancers and saucerors.
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
The Kingdom Of Loathing Era
Re: Random Damage Type
A time traveler... from the past?drachefly wrote: When 0.1.6 comes out
It's moments like these that make me love forums.
Even if you meant 1.6.0 you're still a bit behind the times.
- artisticdude
- Moderator Emeritus
- Posts: 2424
- Joined: December 15th, 2009, 12:37 pm
- Location: Somewhere in the middle of everything
Re: Random Damage Type
I have version 0.1.6 on my computer somewhere (don't ask me why). And I mean 0.1.6, not 1.6.0. I even play it occasionally, just to remind myself how far the game has come since its infancy, and to marvel at how much better the graphics are in the recent versions. [/off-topic]
"I'm never wrong. One time I thought I was wrong, but I was mistaken."
Re: Random Damage Type
See my sig. 0.1.6 of that.
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
The Kingdom Of Loathing Era
Re: Random Damage Type
I think zookepers code must not work completely as you want. You have first strike with no randomness. All other strikes in one fight is really random.Whoopdy-dee and trolly-bazoo! It works!
Or I don't know something and event "attacker/defender hits" fires before unit hits?
Re: Random Damage Type
You are correct. As it stands, you can see the next type of damage you'll deal.
That's... annoying.
Hmm. I could have it trigger on the attack itself before anything happens AND on hits, with only actual hits displaying the damage type (and displaying the old one). Needs different kind of trigger for each.
Anyway, I assume I can get that ironed out. In the mean time, I've added some additional features:
I've extended it to include all 6 damage types (for a different unit). I also made a dummy 'attack animation' that slowed down the attack to the point that you could make out the individual messages instead of having them crammed together. Then I changed the text shown to be representative of the damage type rather than the name of the damage type, using randomly selected representatives. And, perhaps more importantly, colored them to match the type.
Now I'm working on getting it to fire even when the affected unit is defending. That's going to require some indirection, but no more than we'll need to sort out that first issue.
Also, we'll need it not to fire multiple times if there are multiple unit types with this ability in the field. The overlaid text is silly.
That's... annoying.
Hmm. I could have it trigger on the attack itself before anything happens AND on hits, with only actual hits displaying the damage type (and displaying the old one). Needs different kind of trigger for each.
Anyway, I assume I can get that ironed out. In the mean time, I've added some additional features:
I've extended it to include all 6 damage types (for a different unit). I also made a dummy 'attack animation' that slowed down the attack to the point that you could make out the individual messages instead of having them crammed together. Then I changed the text shown to be representative of the damage type rather than the name of the damage type, using randomly selected representatives. And, perhaps more importantly, colored them to match the type.
Now I'm working on getting it to fire even when the affected unit is defending. That's going to require some indirection, but no more than we'll need to sort out that first issue.
Also, we'll need it not to fire multiple times if there are multiple unit types with this ability in the field. The overlaid text is silly.
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
The Kingdom Of Loathing Era