Weapon special and Ability trouble.

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
ulfgur
Posts: 88
Joined: December 16th, 2008, 1:01 am

Weapon special and Ability trouble.

Post by ulfgur »

I am using 1.8.



I am trying to transfer (Or design from scratch on one or maybe two or perhaps none.) weapon specials and abilities from other peoples' addons. Naturally, because I touched them, they decided not to work and I need help fixing them:







This one needs to be an ability that adds 1 attack for each time the attacker hits, (Offense only), and then reset the number of attacks to 1. Instead, it doesn't do anything. There may also be a bug where it restores one of the unit's HP back to full.

Code: Select all

#define WEAPON_SPECIAL_FLURRY_OF_BLOWS
    # Canned definition of the Charge ability to be included in a
    # [specials] clause.
    [dummy]
        id=charge
        name= _ "Flurry of Blows"
        description= _ "Flurry of Blows:
Each time this unit hits while attacking, it stuns the enemy, giving opportunity for another strike."
    [/dummy]
#enddef




#ifndef WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS
    #define WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS UNIT_TYPE
    
#bloodlust for Breaker

    [event]
        name=attack
        first_time_only=no
       
        [filter]
            type={UNIT_TYPE}
        [/filter]
 
        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
	    variable=temp_varbloodlust
        [/store_unit]
	   [unstore_unit]
                variable=temp_varbloodlust
           [/unstore_unit]



   [/event]
 
   [event]
      name=attacker_hits
      first_time_only=no
 
      [filter]
          type={UNIT_TYPE}
      [/filter]
      

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
	    variable=temp_varbloodlust
        [/store_unit]
	   [unstore_unit]
                variable=temp_varbloodlust
           [/unstore_unit]


      [set_variable]
            name=temp_varbloodlust.attack[0].number
            add=1
      [/set_variable]


[/event]

[event]

       name=attack_end
	   first_time_only=no
	[filter]
          type={UNIT_TYPE}
      [/filter]


      [set_variable]
            name=temp_varbloodlust.attack[0].number
            value=3
      [/set_variable]

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
	    variable=temp_varbloodlust
        [/store_unit]
	   [unstore_unit]
                variable=temp_varbloodlust
           [/unstore_unit]




	  {CLEAR_VARIABLE temp_varbloodlust}

[/event]


#enddef
#endif
credit for the base code goes to either the creators of EOS or EOM, not sure.




On to the second ability.



I want a golem-creating mage to be able to assemble a construct on the battlefield. Instead, it (guess what!) doesn't do anything. The code I borrowed from (And to all credit goes to) either EOM or EOS also requires that a unit expend all his movement and attack to do this. I would rather just expend attack, and not create a limit as to the amount of golems summoned per turn. I did not try to implement this for fear of breaking the code further.


Code: Select all

#Menu Item Macro

#define SUMMON_MENU_ITEM ID DESCRIPTION COST ABILITY UNIT
[event]
	name=select

	first_time_only=no

	[filter]
		ability=summon_lvl3,
		side=$side_number
	[/filter]

	[store_unit]
		[filter]
			x,y=$x1,$y1
		[/filter]
		variable=last_selected_unit
	[/store_unit]
[/event]

[set_menu_item]
	id=summon_{ID}
	description= _ "Summon {DESCRIPTION} ({COST}g)"

	[show_if]
	[/show_if]

	[filter_location]
		[filter_adjacent_location]

			[filter]
				ability={ABILITY}
				side=$side_number
				[filter_wml]
				    moves=$this_unit.max_moves
				[/filter_wml]
				[filter_location]
				[not]
				    terrain=Ce,Ch,Cv,Cud,Chr,Chw,Chs,Ke,Kh,Kv,Kud,Khr,Khw,Khs,Ww,Wwo,Wwf,Wwr
				[/not]
				[/filter_location]
			[/filter]

		[/filter_adjacent_location]

		[not]

			[filter]
			[/filter]

			[or]
				terrain=_off^_usr,Ql,Qlf,Qxu,Wo,Mm^Xm,Md^Xm,Xu,Xv,*^V*
			[/or]
		[/not]

	[/filter_location]

	[command]
				[store_gold]
					variable=actualgold
					side=$side_number
				[/store_gold]
						[if]
							[variable]
								name=actualgold
								greater_than_equal_to={COST}
							[/variable]
						[then]
							[gold]
								amount=-{COST}
								side=$side_number
							[/gold]
							[unit]
								type={UNIT}
								side=$side_number
								x,y=$x1,$y1
								moves=0
								animate=yes
							[/unit]
							[store_unit]
								variable=newunit
								[filter]
									x,y=$x1,$y1
								[/filter]
							[/store_unit]
							[set_variable]
								name=newunit.attacks_left
								value=0
							[/set_variable]
							[unstore_unit]
								variable=newunit
								find_vacant=no
							[/unstore_unit]
							[set_variable]
								name=newunit.moves
								value=0
							[/set_variable]
				            [store_unit]
                                [filter]
			                         ability={ABILITY}
	       	                         side=$side_number
			                         [filter_wml]
				                           moves=$this_unit.max_moves
			                         [/filter_wml]
			                         [filter_adjacent]
					                       x,y=$x1,$y1
			                         [/filter_adjacent]
		                        [/filter]
	                            variable=able_to_summon
	                        [/store_unit]
	                        [if]
	                            [variable]
	                                name=able_to_summon.length
	                                greater_than=1
	                            [/variable]
	                            [then]
	                                {FOREACH able_to_summon a}
                                    [if]
                                        [variable]
                                            name=able_to_summon[$a].id
                                            equals=$last_selected_unit.id
                                        [/variable]
                                        [then]
                                            [set_variable]
								                name=able_to_summon[$a].attacks_left
								                value=0
							                [/set_variable]
							                [set_variable]
								                name=able_to_summon[$a].moves
								                value=0
							                [/set_variable]
							
							                {VARIABLE_OP able_to_summon[$a].experience add 3}
								
							                [unstore_unit]
								                variable=able_to_summon[$a]
								                find_vacant=no
								                text= _ "+$this_unit.level exp"
								                red,green,blue=50,50,200
							                [/unstore_unit]
							                {CLEAR_VARIABLE newunit}
							                {CLEAR_VARIABLE able_to_summon}
                                        [/then]
                                    [/if]
                                    {NEXT a}
                            [/then]
                            [else]
                            [store_unit]
								variable=able_to_summon
								[filter]
								ability={ABILITY}
								side=$side_number
								[filter_wml]
								    moves=$this_unit.max_moves
								[/filter_wml]
								[filter_adjacent]
									x,y=$x1,$y1
								[/filter_adjacent]
								[/filter]
							[/store_unit]
							[set_variable]
								name=able_to_summon[$a].attacks_left
								value=0
							[/set_variable]
							[set_variable]
								name=able_to_summon[$a].moves
								value=0
							[/set_variable]
							
							{VARIABLE_OP able_to_summon[$a].experience add 3}
								
							[unstore_unit]
								variable=able_to_summon[$a]
								find_vacant=no
								text= _ "+$this_unit.level exp"
								red,green,blue=50,50,200
							[/unstore_unit]
							{CLEAR_VARIABLE newunit}
							{CLEAR_VARIABLE able_to_summon}
                            [/else]
                        [/if]
			     [/then]
			     [else]
				    [message]
				        speaker=narrator
                        side_for=$side_number
                        caption=_ "Error"
                        message= _ "I have insufficient materials. I am unable to summon."
                    [/message]
			     [/else]
		    [/if]
		{CLEAR_VARIABLE actualgold}
	[/command]
[/set_menu_item]

####
####

[set_menu_item]
	id=summon_zhelp
	description= _ "Summon Help"
	[show_if]
	[/show_if]

	[filter_location]
			[filter]
				type=golem_master
				side=$side_number
			[/filter]
	[/filter_location]
	[command]
				[message]
				    speaker=narrator
                    side_for=$side_number
                    caption=_ "Summoning"
                    message= _ "To summon a unit right-click on adjacent hexes near a selected summoner. 
                    
You need all movement points (and remaining attacks) to summon one creature. You are unable to summon from castles or keeps. A new unit can't be summoned on water.
Every summoning adds +4 to current experience.

If there are 2 or more summoners, a new unit will be summoned by the last selected unit able to summon."
                [/message]
	[/command]
[/set_menu_item]
#enddef

#####################################
#####################################

#Summoners
#Grand Summoner

#define ABILITY_I8_SUMMON_LEVEL3
	[dummy]
		id=summon_lvl3
		name= _ "Summon"
		description= _ "Summon:
this unit can summon new units near him, but not in villages."
	[/dummy]
[/abilities]

[event]
	name=start
	[if]
		[have_unit]
			ability=summon_lvl3
		[/have_unit]
		[then]
			{SUMMON_MENU_LVL3}
		[/then]
	[/if]

[/event]


[event]
	name=recruit
	[filter]
		ability=summon_lvl3
	[/filter]
	{SUMMON_MENU_LVL3}


[/event]



[event]
	name=post_advance
	[filter]
		ability=summon_lvl3
	[/filter]
	{SUMMON_MENU_LVL3}
[/event]



[+abilities]
#enddef



#define SUMMON_MENU_LVL3
{SUMMON_MENU_ITEM 6_1_1 (Sinew golem) 15 summon_lvl3 (stitch_golem)}
{SUMMON_MENU_ITEM 6_1_2 (Sinew golem) 16 summon_lvl3 (stitch_golem)}
#enddef


#define SPECIAL_NOTES_SUMMON_LVL3
	_ " this unit can create other units in the near free spaces, but not in villages."
#enddef



Thanks,

-ulfgur




P.S: a quick forum etiquette question: Is it more (polite? proper?) to post two related questions in one topic (making answering one question or the other difficult), as I did here, or to post them separately (inundating the forum with a smorgasbord of my random requests)?

P.P.S: Sorry about my comprehensibility today. My brain is in Hawaii or something.
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Weapon special and Ability trouble.

Post by pyrophorus »

ulfgur wrote:I am using 1.8.
You should'nt :lol2:
ulfgur wrote: This one needs to be an ability that adds 1 attack for each time the attacker hits, (Offense only), and then reset the number of attacks to 1. Instead, it doesn't do anything. There may also be a bug where it restores one of the unit's HP back to full.
At first glance, the problem is the various events store/unstore unit without doing anything in the middle:

Code: Select all

    [event]
        name=attack
        first_time_only=no
       
        [filter]
            type={UNIT_TYPE}
        [/filter]
 
        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
	    variable=temp_varbloodlust
        [/store_unit]
# ??? no modification ?
	   [unstore_unit]
                variable=temp_varbloodlust
           [/unstore_unit]



   [/event]
 
   [event]
      name=attacker_hits
      first_time_only=no
 
      [filter]
          type={UNIT_TYPE}
      [/filter]
      

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
	    variable=temp_varbloodlust
        [/store_unit]
# here
	   [unstore_unit]
                variable=temp_varbloodlust
           [/unstore_unit]

# this should be moved to 'here' if you want it to work
      [set_variable]
            name=temp_varbloodlust.attack[0].number
            add=1
      [/set_variable]
[/event]
[/quote]
ulfgur wrote: On to the second ability.
You got this one from To Land Unknown. As far as I reckon this code is rather intricated with other things, and maybe some piece is missing. I don't know.
ulfgur wrote: P.S: a quick forum etiquette question: Is it more (polite? proper?) to post two related questions in one topic (making answering one question or the other difficult), as I did here, or to post them separately (inundating the forum with a smorgasbord of my random requests)?
Moderators usually ask to create only one thread for all your WML questions.

HTH
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Weapon special and Ability trouble.

Post by SkyOne »

pyrophorus wrote:
ulfgur wrote: P.S: a quick forum etiquette question: Is it more (polite? proper?) to post two related questions in one topic (making answering one question or the other difficult), as I did here, or to post them separately (inundating the forum with a smorgasbord of my random requests)?
Moderators usually ask to create only one thread for all your WML questions.
It is because we can always edit the posts and the topic title, and increasing the number of pages is not an issue (putting numbers or alphabets at each question will be kind for people who will answer the questions in the case). :wink:
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
ulfgur
Posts: 88
Joined: December 16th, 2008, 1:01 am

Re: Weapon special and Ability trouble.

Post by ulfgur »

Okay, here's the revised version. It still does absolutely nothing.

Code: Select all

#ifndef WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS_FOR_THREE_ATTACKS
    #define WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS_FOR_THREE_ATTACKS UNIT_TYPE

   [event]
      name=attacker_hits
      first_time_only=no
 
      [filter]
          type={UNIT_TYPE}
      [/filter]
     

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
       variable=temp_varbloodlust
        [/store_unit]
      [set_variable]
            name=temp_varbloodlust.attack[0].number
            add=1
      [/set_variable]
      [unstore_unit]
                variable=temp_varbloodlust
           [/unstore_unit]

[/event]


    [event]

           name=attack_end
          first_time_only=no
       [filter]
              type={UNIT_TYPE}
          [/filter]




            [store_unit]
                [filter]
                    x,y=$x1,$y1
                [/filter]
           variable=temp_varbloodlust
            [/store_unit]


          [set_variable]
                name=temp_varbloodlust.attack[0].number
                value=3
          [/set_variable]

          [unstore_unit]
                    variable=temp_varbloodlust
               [/unstore_unit]




         {CLEAR_VARIABLE temp_varbloodlust}

    [/event]


    #enddef
    #endif



At first glance, the problem is the various events store/unstore unit without doing anything in the middle:

Oh, so That's how it works. Always been a bit confused with the store/unstore unit thing.

As far as I reckon this code is rather intricated with other things, and maybe some piece is missing. I don't know.
'k. I'll try to write something from scratch. EDIT: rework the original into something manageable.It will not work, and I will post it later for help. (If it does work, I will probably have a heart attack or something.) Edit: It breaks wesnoth. Here it is. I was forced to save it as a separate document and put it somewhere other than wesnoth. Here it is:

Code: Select all

#define SUMMON
    # Canned definition of the Charge ability to be included in a
    # [specials] clause.
    [dummy]
        id=summon
        name= _ "Summon"
        description= _ "Summon:
This unit can summon or build servants onto the battlefield."
    [/dummy]
#enddef



#define SUMMON_MENU_ITEM

[set_menu_item]
	id=summon_1
	description= _ "Summon Sinew Golem for 16 gold."


	[filter_location]
		[filter_adjacent_location]

			[filter]
				ability=summon
				side=$side_number
				[filter_location]
				[not]
				    terrain=Ce,Ch,Cv,Cud,Chr,Chw,Chs,Ke,Kh,Kv,Kud,Khr,Khw,Khs,Ww,Wwo,Wwf,Wwr
				[/not]
				[/filter_location]
			[/filter]

		[/filter_adjacent_location]

		[not]

			[filter]
			[/filter]

			[or]
				terrain=_off^_usr,Ql,Qlf,Qxu,Wo,Mm^Xm,Md^Xm,Xu,Xv,*^V*
			[/or]
		[/not]

	[/filter_location]










	[command]
				[store_gold]
					variable=actualgold
					side=$side_number
				[/store_gold]
						[if]
							[variable]
								name=actualgold
								greater_than_equal_to=16
							[/variable]
						[then]
							[gold]
								amount=-16
								side=$side_number
							[/gold]
							[unit]
								type=stitch_golem
								side=$side_number
								x,y=$x1,$y1
								moves=0
								animate=yes
							[/unit]
							[store_unit]
								variable=newunit
								[filter]
									x,y=$x1,$y1
								[/filter]
							[/store_unit]
							[set_variable]
								name=newunit.attacks_left
								value=0
							[/set_variable]
							[unstore_unit]
								variable=newunit
								find_vacant=no
							[/unstore_unit]
							[set_variable]
								name=newunit.moves
								value=0
							[/set_variable]
                        [/if]
			     [/then]
			     [else]
				    [message]
				        speaker=narrator
                        side_for=$side_number
                        caption=_ "Error"
                        message= _ "I have insufficient materials. I am unable to summon."
                    [/message]
			     [/else]
		    [/if]
		{CLEAR_VARIABLE actualgold}
	[/command]
[/set_menu_item]


ulfgur wrote:
I am using 1.8.
You should'nt :lol2:
I read somewhere that 1.10.3 is so different from 1.8 that the units are incompatible. If someone has an easy, fool-proof way to modify all the code for the bajillion B-rated units I'm still oddly attached to, I will gladly upgrade.
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Weapon special and Ability trouble.

Post by pyrophorus »

ulfgur wrote:Okay, here's the revised version. It still does absolutely nothing.
Your code would only work if the enemy attacks with it's first weapon ($unit.attack[0].number), not the other. Unfortunately, this would not work anyway, because I think attack numbers are not a counter but the start value of a counter. More of it, I don't know how to stop a started attack. I have somewhere an attack which petrifies opponents when defender hits (and does more, if not I would use the WEAPON_SPECIAL_PETRIFY). The unit is actually petrified, but continue attacking.
Maybe Zookeeper or another WML wizard could give an advice. I don't.
ulfgur wrote:
ulfgur wrote:
I am using 1.8.
You should'nt :lol2:

I read somewhere that 1.10.3 is so different from 1.8 that the units are incompatible. If someone has an easy, fool-proof way to modify all the code for the bajillion B-rated units I'm still oddly attached to, I will gladly upgrade.
WMLMINT is your friend (it's an utility: you'll find it in your distribution folder).

HTH
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Weapon special and Ability trouble.

Post by zookeeper »

Firstly, I see no indication that you're actually calling these macros somewhere. Macro definitions don't do anything by themselves. There's no sense in trying to debug the contents of an event (except for syntax errors, see below) if you don't even know if the event is ever triggered in the first place, so check that first.

Secondly, if you have a problem with a syntax error (meaning the Wesnoth-breaking errors when you launch the game or multiplayer or your campaign) that you think you can't find, then just follow the simple procedure outlined in this sticky thread and you'll quickly be able to pinpoint any such errors you might have. You currently have at least one syntax error, a stray [/if].
ulfgur
Posts: 88
Joined: December 16th, 2008, 1:01 am

Re: Weapon special and Ability trouble.

Post by ulfgur »

Your code would only work if the enemy attacks with it's first weapon ($unit.attack[0].number), not the other. Unfortunately, this would not work anyway, because I think attack numbers are not a counter but the start value of a counter. More of it, I don't know how to stop a started attack. I have somewhere an attack which petrifies opponents when defender hits (and does more, if not I would use the WEAPON_SPECIAL_PETRIFY). The unit is actually petrified, but continue attacking.
Maybe Zookeeper or another WML wizard could give an advice. I don't.

..... Umm,,,


....Okay, I only need it to work on attack, and I only need it to work for the unit's first attack. (At least I think that's how I should reply to what you are saying. As for the petrify, I do not know what you are trying to say.

An alternate way to get this working (If someone helps) would be to write a weapon special like this:

Code: Select all

#define WEAPON_SPECIAL_FLURRY_OF_BLOWS
    #wmllint: unbalanced-on
    [attacks]
        name=_ "flurry_of_blows"
        name_inactive=_ "Flurry of Blows"
        description=_ "Blah blah blah"
        description_inactive=_ "Blah blah blah"
        add=1
    [/attacks]
[/specials]
...but with a filter for is the attack hits or not. I looked at the filter code available for weapon specials and could not find the proper filter. (I am incompetent and incapable of debugging my own WML. If only wesnoth were written in flash... :lol2: I'm trying to learn but progress is slow.)

WMLMINT is your friend (it's an utility: you'll find it in your distribution folder).

HTH
WMLMINT?
distribution folder?

These both sound like things I should know about but don't.

Firstly, I see no indication that you're actually calling these macros somewhere. Macro definitions don't do anything by themselves. There's no sense in trying to debug the contents of an event (except for syntax errors, see below) if you don't even know if the event is ever triggered in the first place, so check that first.

I call it at the bottom of the unit I want to use the code on, right before the [/unit]. In the case of the flurry of blows, I attach

Code: Select all

{WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS_FOR_THREE_ATTACKS monk}
to my monk. If you have a better place that does not involve tacking it on to maps, I'm all ears.



Unless WMLMINT is magic and fixes these codes automatiacally, I will temporarily give up on the summoning code.
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Weapon special and Ability trouble.

Post by pyrophorus »

ulfgur wrote:
....Okay, I only need it to work on attack, and I only need it to work for the unit's first attack. (At least I think that's how I should reply to what you are saying. As for the petrify, I do not know what you are trying to say.
I said I don't know how to modify an attack when it's running and even if it is possible.
ulfgur wrote: An alternate way to get this working (If someone helps) would be to write a weapon special like this:

Code: Select all

#define WEAPON_SPECIAL_FLURRY_OF_BLOWS
    #wmllint: unbalanced-on
    [attacks]
        name=_ "flurry_of_blows"
        name_inactive=_ "Flurry of Blows"
        description=_ "Blah blah blah"
        description_inactive=_ "Blah blah blah"
        add=1
    [/attacks]
[/specials]
...but with a filter for is the attack hits or not. I looked at the filter code available for weapon specials and could not find the proper filter. (I am incompetent and incapable of debugging my own WML. If only wesnoth were written in flash... :lol2: I'm trying to learn but progress is slow.)
If you want to use specials, you must write an event 'attacker hits' where you apply an 'object' whose 'effect' apply to the attack and add/remove your special.
ulfgur wrote:
Firstly, I see no indication that you're actually calling these macros somewhere. Macro definitions don't do anything by themselves. There's no sense in trying to debug the contents of an event (except for syntax errors, see below) if you don't even know if the event is ever triggered in the first place, so check that first.
I call it at the bottom of the unit I want to use the code on, right before the [/unit]. In the case of the flurry of blows, I attach

Code: Select all

{WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS_FOR_THREE_ATTACKS monk}
to my monk. If you have a better place that does not involve tacking it on to maps, I'm all ears.
And this not the right place to put a weapon special. It should be in the 'specials' tag of an 'attack' tag in a 'unit_type'. BTW, creating an unit_type for your monk, you can shun the hassle to modify the unit in every scenario.
ulfgur wrote:
WMLMINT is your friend (it's an utility: you'll find it in your distribution folder).

HTH
WMLMINT?
distribution folder?

These both sound like things I should know about but don't.
Sorry, it's a typo: it's WMLLINT (as in your macro).

May I suggest you to learn WML with less difficult projects ? Your ideas are not very clear and some practice with simple things will certainly help you.
Friendly,
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Weapon special and Ability trouble.

Post by zookeeper »

ulfgur wrote:
Firstly, I see no indication that you're actually calling these macros somewhere. Macro definitions don't do anything by themselves. There's no sense in trying to debug the contents of an event (except for syntax errors, see below) if you don't even know if the event is ever triggered in the first place, so check that first.

I call it at the bottom of the unit I want to use the code on, right before the [/unit]. In the case of the flurry of blows, I attach

Code: Select all

{WEAPON_SPECIAL_FLURRY_OF_BLOWS_EVENTS_FOR_THREE_ATTACKS monk}
to my monk. If you have a better place that does not involve tacking it on to maps, I'm all ears.
Well, [event] has no meaning inside [unit], so indeed it won't do anything. You can put them inside [unit_type], [scenario], [multiplayer] or [era] (and inside another [event] of course, if you want to "create" the event mid-scenario).
ulfgur
Posts: 88
Joined: December 16th, 2008, 1:01 am

Re: Weapon special and Ability trouble.

Post by ulfgur »

Well, [event] has no meaning inside [unit], so indeed it won't do anything. You can put them inside [unit_type], [scenario], [multiplayer] or [era] (and inside another [event] of course, if you want to "create" the event mid-scenario).
Sorry, sorry! meant [unit_type]. it is in the [unit_type]. Yeah, if I were creating a scenario this might be a lot easier, but I'm not.
I said I don't know how to modify an attack when it's running and even if it is possible.
that... could be a big problem.

Code: Select all

May I suggest you to learn WML with less difficult projects ? Your ideas are not very clear and some practice with simple things will certainly help you.
Friendly,

I can assure you that I have done much simpler projects. My difficulty learning WML lies in two things: 1) age. When I first started coding WML I was quite young and could not understand things on the WML guide. I am only recently going on there and truly figuring out how WML is put together. 2) my first coding language is adobe flash, which is, well, nothing like WML. I dunno, I thought these pieces of code were fairly simple. Plainly not. (But we're going to ignore the summoning bit, there has to be an easier way to do that, I just need to figure it out.)





If you want to use specials, you must write an event 'attacker hits' where you apply an '`object' whose 'effect' apply to the attack and add/remove your special.
Would that work to add an attack for each time the attacker hits? It seems like that would only work the first time. :hmm: it seems like I'd need to remove it directly after I add it. That could get confusing. If this truly is the best way to go, I will take a crack at it...


Sorry, it's a typo: it's WMLLINT (as in your macro).
... Alas, I still have no idea what WMLLINT is. I just looked both that and macro up in the code guide and came up blank. (yes, I know what a macro is, i just thought if I looked up "macro" it might have a WMLLINT subsection. )







[quote]Your ideas are not very clear and some practice with simple things will certainly help you.[/quote]

Am I being too wordy, or my ideas are not clear in the code? I do have a tendency to be too wordy and fit too much information in one sentence. If that is the case, I can look over stuff more thoroughly before I hit "submit".
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Weapon special and Ability trouble.

Post by pyrophorus »

Hi,
ulfgur wrote:Sorry, sorry! meant [unit_type]. it is in the [unit_type]. Yeah, if I were creating a scenario this might be a lot easier, but I'm not.
Your special macro will not work either at the end of a 'unit_type'.
I meant no offense saying your ideas are not very clear, and certainly not they're not clear in a general way. I think you figure not clearly how WML constructs works. Each tag defines a particular context where some keys and tags only are allowed (or working). This context is not shared by embedding tags: in other words, your weapon special macro is valid only in the 'specials' tag of an 'attack' in a 'unit_type' (or in an 'object' as I wrote earlier). It can't be used directly in the 'unit_type' where you put it.
Same with the order: you can generally write keys and filter tags in any order. This don't mean order is never important. Of course it is, particularly in 'event' tags where it defines in which order actions are executed. This is why your previous example (store_unit unstore_unit, then set_variable) could'nt work.
ulfgur wrote:
If you want to use specials, you must write an event 'attacker hits' where you apply an '`object' whose 'effect' apply to the attack and add/remove your special.



Would that work to add an attack for each time the attacker hits? It seems like that would only work the first time. :hmm: it seems like I'd need to remove it directly after I add it. That could get confusing. If this truly is the best way to go, I will take a crack at it...
I don't know if this way to do things will work, but IMO, it shall not. I think all the parameters defining an attack are loaded when it begins in a private data set, and modifications done on the fly are taken into account when attack ends only. Just my two cents...

Friendly,
Post Reply