How to guarantee some damage in wesnoth 1.1.2

The place to post your WML questions and answers.

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.
Post Reply
Sauron
Posts: 221
Joined: January 11th, 2006, 8:51 am
Location: Barad-Dur, Mordor
Contact:

How to guarantee some damage in wesnoth 1.1.2

Post by Sauron »

Hi!

It is my idea, used it in my modified era with good effects, still - to some extent it reduces influence of random in standard eras. Not satisfactory 4 me.

Code: Select all

#define halfDamageGuaranteed

[event]
	name=attacker_misses
	first_time_only=no
	[store_unit]
		[filter]
			x=$x2
			y=$y2
		[/filter]
		variable=defender
		kill=no
	[/store_unit]

#	[message]
#		speaker=narrator
#		caption="attacker_misses"
#message="defender $defender.hitpoints -2
#[x,y] [$defender.x,$defender.y]"
#	[/message]
	[set_variable]
		name=defender.hitpoints
		add=-2
	[/set_variable]
	[if]
		[variable]
			name=defender.hitpoints
			less_than_equal_to=0
		[/variable]
	[then]
		[store_unit]
			[filter]
				x=$x2
				y=$y2
			[/filter]
			variable=defender
			kill=yes
		[/store_unit]
	[/then]
	[/if]
	[unstore_unit]
		variable=defender
	[/unstore_unit]
	[clear_variable]
		name=defender
	[/clear_variable]
[/event]
[event]
	name=defender_misses
	first_time_only=no
	[store_unit]
		[filter]
			x=$x1
			y=$y1
		[/filter]
		variable=attacker
		kill=no
	[/store_unit]
#	[message]
#		speaker=narrator
#		caption="defender_misses"
#message="attacker $attacker.hitpoints -2
#[x,y] [$attacker.x,$attacker.y]"
#	[/message]
	[set_variable]
		name=attacker.hitpoints
		add=-2
	[/set_variable]
	[if]

		[variable]
			name=attacker.hitpoints
			less_than_equal_to=0
		[/variable]
	[then]
	[store_unit]
		[filter]
			x=$x1
			y=$y1
		[/filter]
		variable=attacker
		kill=yes
	[/store_unit]
	[/then]
	[/if]
	[unstore_unit]
		variable=attacker
	[/unstore_unit]
	[clear_variable]
		name=attacker
	[/clear_variable]
[/event]
#enddef
Sauron
Customize yourself random factor in game:
GET my mod [available as C++ sourcecode and compiled Windows executable] for wesnoth 1.6.4
at http://saurons-mod.zor.org/
Mod thread
http://www.wesnoth.org/forum/viewtopic.php?t=26803
Sauron
Posts: 221
Joined: January 11th, 2006, 8:51 am
Location: Barad-Dur, Mordor
Contact:

Post by Sauron »

Thanx for massive feedback [:rotfl:]
Sauron
Customize yourself random factor in game:
GET my mod [available as C++ sourcecode and compiled Windows executable] for wesnoth 1.6.4
at http://saurons-mod.zor.org/
Mod thread
http://www.wesnoth.org/forum/viewtopic.php?t=26803
User avatar
JW
Posts: 5046
Joined: November 10th, 2005, 7:06 am
Location: Chicago-ish, Illinois

Post by JW »

Sauron wrote:Thanx for massive feedback [:rotfl:]
Thanks for massive patience (90 minutes). :roll:
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

JW wrote:
Sauron wrote:Thanx for massive feedback [:rotfl:]
Thanks for massive patience (90 minutes). :roll:
Ahem...I think it was a bit more than that. :P

first post: Thu Apr 06, 2006 2:03 pm
second post: Mon Apr 17, 2006 3:32 pm
User avatar
JW
Posts: 5046
Joined: November 10th, 2005, 7:06 am
Location: Chicago-ish, Illinois

Post by JW »

LOL 11 days and 90 minutes is what I meant. ;)

Either way, I can't judge the WML, but I think you can, right zookeeper?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I guess it should work like that...I didn't test it though. BTW, I'm just trying to do something similar to this: quaranteeing a hit or a miss (one of Xan's recent changes enables this, I think). It's very tricky, but it would be great for scripted scenario parts and such.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

IIUC, Xan's new additions make it possible to give a unit a specialty that makes it hit 100% or 0%, whichever you prefer:

Code: Select all

#define WEAPON_SPECIAL_UBERPOWERFUL
		[chance_to_hit]
			id=uberpowerful
			name="" #so that it doesn't display anything indicating that you have such a special
			description=""
			value=100
			cumulative=no
		[/chance_to_hit]
#enddef
However, I don't know how the engine will respond to a 100% or a 0% chance to hit...

Now, since we probably CAN give specials to units on the fly, we wouldn't need to create a bunch of duplicate unit types when using this. So it would actually be useful.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Sauron
Posts: 221
Joined: January 11th, 2006, 8:51 am
Location: Barad-Dur, Mordor
Contact:

Post by Sauron »

turin wrote:IIUC, Xan's new additions make it possible to give a unit a specialty that makes it hit 100% or 0%, whichever you prefer:
However, I don't know how the engine will respond to a 100% or a 0% chance to hit...

Now, since we probably CAN give specials to units on the fly, we wouldn't need to create a bunch of duplicate unit types when using this. So it would actually be useful.
IMHO MUCH MORE is needed system like

dmg= SUM_i(MinDMG_per_hit(i) + rnd_hits_or_not(i)*additional_dmg_per_hit)==
== n * MinDMG_per_hit+SUM_i(rnd_hits_or_not(i)*additional_dmg_per_hit)
Sauron
Customize yourself random factor in game:
GET my mod [available as C++ sourcecode and compiled Windows executable] for wesnoth 1.6.4
at http://saurons-mod.zor.org/
Mod thread
http://www.wesnoth.org/forum/viewtopic.php?t=26803
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

You appear to be setting damage to a boolean value. Maybe you should type out the formula in english or define some of your terms?

Also, if you are wondering why there is so little response: "the developers feel that randomness is a large part of the game, and that taking the randomness out of the game would be somewhat akin to taking the randomness out of most card games."
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Sauron
Posts: 221
Joined: January 11th, 2006, 8:51 am
Location: Barad-Dur, Mordor
Contact:

Post by Sauron »

Sapient wrote:You appear to be setting damage to a boolean value. Maybe you should type out the formula in english or define some of your terms?

Also, if you are wondering why there is so little response: "the developers feel that randomness is a large part of the game, and that taking the randomness out of the game would be somewhat akin to taking the randomness out of most card games."
I think REDUCTION of randomness is solution - ELIMINATION would result in BORING GAME

Code: Select all

int 
attacker_basic_dmg=getBasicDMG(attacker,defenfer,attack_type,daytime,terrain),
attacker_additional_dmg=getAdditionalDMG(attacker,defenfer,attack_type,daytime,terrain),
defender_basic_dmg=getBasicDMG(defenfer,attacker,attack_type,daytime,terrain),
defender_additional_dmg=getAdditionalDMG(defenfer,attacker,attack_type,daytime,terrain);


for(int i=0;i<attacker->getAttacks();i++)
{
    defender->health-=attacker_basic_dmg+random_0_or_1(distribution_you_picked)*attacker_additional_dmg;
//conditional defender retaliation and other conditional instructions go here
//...
}
//in case defender still has some retaliations to hit - do it now
what spoils game now (IMHO) - is basic_damage==0

Mabye players should have some option of adjusting the split of dmg between basic and additional, as it is with gold, experience an gpv?

Exactly what I mean is

Code: Select all

int
attacker_dmg=getDMG(attacker,defenfer,attack_type,daytime,terrain),
defender_dmg=getDMG(defenfer,attacker,attack_type,daytime,terrain);


for(int i=0;i<attacker->getAttacks();i++)
{
    defender->health-=floor(game->split_ratio*attacker_dmg)
+ceil((1-game->split_ratio)*random_0_or_1(distribution_you_picked)*attacker_dmg);
//conditional defender retaliation and other conditional instructions go here
//...
}
//in case defender still has some retaliations to hit - do it now

They would be able to pick deterministic/random and all possibilities in between. I think this would soon prove, what PLAYERS think of randomness. I think this modification is EXTREMELY EASY to implement and I am pretty amused it was not implemented so far taking into consideration the amount of anti-random feedback on forums.

P.S.
Yes, yes, I've read
http://www.wesnoth.org/forum/viewtopic.php?t=1158
:-)
Sauron
Customize yourself random factor in game:
GET my mod [available as C++ sourcecode and compiled Windows executable] for wesnoth 1.6.4
at http://saurons-mod.zor.org/
Mod thread
http://www.wesnoth.org/forum/viewtopic.php?t=26803
Post Reply