Replace Attack
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.
Replace Attack
Is it possible to replace the old attack when you "buy" a new one?
Lets say the character has '1-1 punch' as the attack, and you have them shop and buy a '2-2 pitchfork'. Could you make the pitchfork replace the punch?
As always, thanks for any help!
Lets say the character has '1-1 punch' as the attack, and you have them shop and buy a '2-2 pitchfork'. Could you make the pitchfork replace the punch?
As always, thanks for any help!
remove_attacks (1.3.13 or SVN trunk only) remove the matching attacks. All tags from the attack filter construct will be used to match the attack; see FilterWML. Notes: do not use a [filter] tag. Also, the last remaining attack will never be removed (since Wesnoth don't support it).
If you plan on asking many little questions about individual things in Wesnoth, I suggest you at the very least put it all together in one thread. Title it, Beastss' WML Help thread, or something like that. As well, I suggest you to check the wiki for looking up tags. If you can't find it after actually looking hard for it, then post it. If you notice on the side of this page, http://www.wesnoth.org/wiki/EffectWML it has a list of all (well almost all) the WML tags that are currently enabled by Wesnoth.
If you plan on asking many little questions about individual things in Wesnoth, I suggest you at the very least put it all together in one thread. Title it, Beastss' WML Help thread, or something like that. As well, I suggest you to check the wiki for looking up tags. If you can't find it after actually looking hard for it, then post it. If you notice on the side of this page, http://www.wesnoth.org/wiki/EffectWML it has a list of all (well almost all) the WML tags that are currently enabled by Wesnoth.
No worries about that, just try to keep it atleast in one thread together. I know when I started learning WML, I probably asked zookeeper 20 questions if not more a day. Which if done in individual threads, can take up a lot of space. :P I still probably ask 3-5 questions a day, so I probably could cover half of the WML workshop first page with questions.
- irrevenant
- Moderator Emeritus
- Posts: 3692
- Joined: August 15th, 2005, 7:57 am
- Location: I'm all around you.
Personally, I disagree with that : not only do things tend to fall through the cracks when you do it that way, the thread loses a lot of its benefit as a reference for other forum members.Blueblaze wrote:If you plan on asking many little questions about individual things in Wesnoth, I suggest you at the very least put it all together in one thread. Title it, Beastss' WML Help thread, or something like that.
In this instance, the problem and solution are neatly located in a short thread called "Replace attack" and not on page 4 of an omni-thread.
However, I have no authority in this particular forum, so if the rulemakers prefer the other way I'm happy to be overruled...
Want to post a Wesnoth idea? Great! Read these:
Frequently Posted Ideas Thread
Giving your idea the best chance of acceptance
Frequently Posted Ideas Thread
Giving your idea the best chance of acceptance
Well, I don't think the WML Workshop is meant to be used to ask individual specific tag questions, but rather help on larger scale events and so forth. The whole point of the WML Reference is to help answer these individual questions about how you add a custom menu, or remove an attack etc.. I don't know what/if the official position is, but I thought it would just be cleaner that way (and I doubt it would get left in the cracks if it's a minor WML question, as the post does get bumped up to the top). Whatever is fine, but, you wouldn't want me to show you how annoying it could get per individual topic :)
ok, so I spent the last couple of hours going at a different approach to it. I tried to make a variable that would handle all the complex work like shifting the damage to 0 then adding the amount of the new weapon. However, I don't really understand variables right now, and so I couldn't get it to work. Then I decided to skim the WML reference to see if I could find a loop hole somewhere in the mesh, and viola look what I found!
I tested it and it works. So far... The only glitch I could find it that if someone has been upgrading a certain attack so much, this would replace it even if this one is weaker than the old one. Also, it doesn't just pick one attack, it does all the attacks that are of that range that the unit/character has, so possible glitch... This is just the beginning results that I have, and I am super tired so I am going to sleep its 4 am btw...
Oh and guys, I kinda think both of you are right, so I will try to help both of you with a "Single Omni-covering Topic" it will have all the questions that I ask, and the answers in the first post so people can go to search, and see my topic then just go to the first page to see the result of the queries... Let me know if that is a good idea (got it from the forums of this other game I used to play "Runescape")...
and one more thing Thank you for your help, both of you!
Code: Select all
[option]
message=_ "Bronze Dagger (2-4 M, B): 100g"
[command]
[if]
[variable]
name=gold
greater_than_equal_to=100
[/variable]
[then]
[gold]
amount=-100
side=$side_number
[/gold]
[object]
silent=yes
[effect]
apply_to=attack
range=melee
set_name=Bronze Dagger
set_type=blade
increase_damage=-100
increase_attacks=-100
[/effect]
[effect]
apply_to=attack
range=melee
increase_damage=1
increase_attacks=3
[/effect]
[/object]
[/then]
[/if]
[/command]
[/option]
Oh and guys, I kinda think both of you are right, so I will try to help both of you with a "Single Omni-covering Topic" it will have all the questions that I ask, and the answers in the first post so people can go to search, and see my topic then just go to the first page to see the result of the queries... Let me know if that is a good idea (got it from the forums of this other game I used to play "Runescape")...
and one more thing Thank you for your help, both of you!
I'm not exactly sure what you are trying to do with that WML code... if you want to remove an attack, you have to use what I gave you. Any new attacks will be added behind the old one, they are not organized by damage, but rather by the order you have them.
I suggest you read this page:
http://www.wesnoth.org/wiki/EffectWML
I suggest you read this page:
http://www.wesnoth.org/wiki/EffectWML
Well, the basic idea behind that bit of code is that the unit buying a new weapon won't have a list of attacks. Just a single attack, so when they buy a new attack of the same range (melee in this case) it would replace the old one.
It gets kind of annoying if you buy like 6 attacks and you can only see 5 of them on the side of the screen, and the only way you know you have it is if you go to attack someone and its there.
This way that won't happen....
Oh, and that's where I found that loop hole...
It gets kind of annoying if you buy like 6 attacks and you can only see 5 of them on the side of the screen, and the only way you know you have it is if you go to attack someone and its there.
This way that won't happen....
Oh, and that's where I found that loop hole...