Blueknights Questions

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
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Blueknights Questions

Post by blueknight1758 »

It's come to my attention that I have lots of questions (I'm a noob) and it may seem that I'm 'spamming' the forums so I've create this thread for ALL my future questions thanks!

SOLVED

Question 1

How would you code an ability that reduces a units attack power (ranged and Melee) to one for a turn, like the 'slows' ability?

NEW

Question 2

Would it be possible to add a new attack type (pierce, impact etc) to the game?
Last edited by blueknight1758 on June 25th, 2011, 9:36 am, edited 2 times in total.
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Blueknights Questions

Post by 8680 »

What do you mean by "attack power"? Damage? Strikes? Hit chance?
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Blueknights Questions

Post by blueknight1758 »

I meant damage sorry.
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: Blueknights Questions

Post by Dixie »

Correct me if I'm wrong: you want a weapon special (let's name it "superslow") that gives a special condition to units when it hits them, which make all of the target's attacks do only 1 damage? It's something a bit complicated, I hope you have at least an okay understanding of WML.

The main part of the code is derived from my Dazzle ability: http://forums.wesnoth.org/viewtopic.php?f=21&t=29544
The part that makes the attack do 1 damage is this: http://wiki.wesnoth.org/AbilitiesWML#Th ... als.5D_tag
Spoiler:
Note that I haven,t tested it, but IIRC Dazzle worked, so you should have a relatively solid baseframe to work with. And by the way, it will only work in 1.9 because of the "side turn end" event which I use: it wasn't available under 1.8.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Blueknights Questions

Post by blueknight1758 »

I noticed dazzle that in your coding near the end it starts using 'dazzle' and 'undazzle' i assume that this is unitntentional and have changed them to superslowed for the version i am about to test and thanks for the code.

EDIT: once changed from dazzle to superslowed it works great! thank you!
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: Blueknights Questions

Post by Dixie »

Yes, I notice I have forgotten the last post-advance event. You can also get rid of the two CLEAR_VARIABLE macro calls near the end - I've changed a few things in the code so that it behaves exactly like slow, and these call are obsolete. They won't cause the code to not work, though, they just do nothing :)
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Blueknights Questions

Post by 8680 »

Try this. Put {WEAPON_SPECIAL_ENERVATE} in the unit's attack's [specials] tag, and {ENERVATE_EVENT} in the [unit_type] tag.

Code: Select all

#define WEAPON_SPECIAL_ENERVATE
[dummy]
    id="enervate"
    name=_"enervate"
    name_inactive=_"enervate"
    description=_"A unit hit by this attack will have all its attacks' damages reduced to one for a turn."
    description_inactive=_"A unit hit by this attack will have all its attacks' damages reduced to one for a turn."
[/dummy]
#enddef
#define enervate_event_base evnm fltr uvar
[event]
    name="{evnm} hits"
    first_time_only=false
    [filter_{fltr}attack]
        special="enervate"
    [/filter_{fltr}attack]
    {FOREACH {uvar}.attack i}
        {VARIABLE _enervate_olddmg_[$i] ${uvar}.attack[$i].damage}
        {VARIABLE {uvar}.attack[$i].damage 1}
    {NEXT i}
    [unstore_unit]
        variable={uvar}
    [/unstore_unit]
    [event]
        name="side ${uvar}.side turn $($turn_number+1) end"
        [if]
            [have_unit]
                id=${uvar}.id
            [/have_unit]
            [then]
                [store_unit]
                    variable="_enervate_store_"
                    [filter]
                        id=${uvar}.id
                    [/filter]
                [/store_unit]
                {FOREACH _enervate_store_.attack i}
                    {VARIABLE _enervate_store_.attack[$i].damage $_enervate_olddmg_[$i]}
                {NEXT i}
                [unstore_unit]
                    variable="_enervate_store_"
                [/unstore_unit]
                {CLEAR_VARIABLE _enervate_store_}
            [/then]
        [/if]
        {CLEAR_VARIABLE _enervate_olddmg_}
    [/event]
[/event]
#enddef
#define ENERVATE_EVENT
{enervate_event_base attacker () second_unit}
{enervate_event_base defender second_ unit}
#enddef
edit : Too slow I guess.

edit2 :
Dixie wrote:

Code: Select all

...
      [+attack]
   [+specials]
#enddef
Does that work? I tried that — in one of Blueknight's other threads I think — and Sapient said it didn't.
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: Blueknights Questions

Post by Dixie »

Well it worked under 1.8 and up to about 1.9.2 or .3 (when I stopped actively doing code 'cause of school). I know some people frown at this method and it's nto referenced anywhere in the wiki, so maybe ti was deprecated or something. Although I still think it's pretty handy. But in any case, you could just define two macros - one for the actual weapon special, and the other for the events, and put the special where it ought to be and the events just outside of the attack tags... Or you could just include the events in an era tag, or in every scenario file, it's really up to you.

The avantage of the above method, as far as I'm concerned, is that I like having all related stuff in one spot. So if I want to meddle with my weapon special, I can just go to "specials.cfg" and I don,t have to look around unit files, the era file and some other random file. Then again, I s'pose you could just define a a macro for just the events and call it in the [era] or in every [scenario]. Oh well.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Blueknights Questions

Post by blueknight1758 »

Dixies code seems to work fine and I thank you for your help anyway 8680
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Blueknights Questions

Post by blueknight1758 »

Would it be possible to add a new attack type (pierce, impact etc£
User avatar
powershot
Posts: 1193
Joined: May 7th, 2011, 3:03 am
Location: Central America
Contact:

Re: Blueknights Questions

Post by powershot »

blueknight1758 wrote:Would it be possible to add a new attack type (pierce, impact etc£
Yes, write a new one and it automatically works.
My new account is: Power_Pixel_Wannabe. Yea. Yea.... Why are you still reading this? What the heck m8? You have some kind of problem? Yea. I draw. NO I'M NOT 5 ANYMORE!!! Little brats.
The heck m8? I thought you left... No seriously... go... serious...
ok bye m8. I'm serious.
blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Blueknights Questions

Post by blueknight1758 »

where is the file you need to edit?
User avatar
Chtomorc
Posts: 68
Joined: June 9th, 2011, 2:48 pm
Location: Paris, France.

Re: Blueknights Questions

Post by Chtomorc »

It is the unit's files, check the wiki. Even if it is outdated, it give you the first steps to make new units.
Last edited by Chtomorc on June 27th, 2011, 3:35 pm, edited 1 time in total.
My writing frightens you? Consider you happy not to hear me :p
Tribes of the North MP era : factions developpement and unit's sprites
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Blueknights Questions

Post by 8680 »

You mean a new damage type? Like, say, instead of having blade/pierce/impact/fire/cold/arcane you'd have blade/pierce/impact/fire/cold/arcane/antimatter? Put this in your campaign's #ifdef (I don't know how to do this in other add-on types):

Code: Select all

[+language]
    type_antimatter= _ "antimatter" # just using "antimatter" as an example
[/language]
Then you can use....

Code: Select all

[unit_type]
    ...
    [attack]
        ...
        type=antimatter
        ...
    [/attack]
    ...
[unit_type]
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Blueknights Questions

Post by 8680 »

powershot wrote:Make sure to add his code or i will say ....... Type shadow, and will not give the right word:
....What? :|
Post Reply