macro to deadvance unit. any way to trim?

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
ducklord_time
Posts: 16
Joined: April 15th, 2009, 10:10 am

macro to deadvance unit. any way to trim?

Post by ducklord_time »

I am trying to make a macro to deadvance a unit. The only way I can think of to do it is using lots of [case] tags:

Code: Select all

[case]
value=red_mage,white_mage
{RETYPE_UNIT id={UNIT}.id mage}
[case]
I am having to write several unit ids manually for each advancing unit.
is there any way I could cut the amount of writing down?

RETYPE_UNIT FILTER TYPE is a macro I defined.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: macro to deadvance unit. any way to trim?

Post by zookeeper »

ducklord_time wrote:I am trying to make a macro to deadvance a unit. The only way I can think of to do it is using lots of [case] tags:

Code: Select all

[case]
value=red_mage,white_mage
{RETYPE_UNIT id={UNIT}.id mage}
[case]
I am having to write several unit ids manually for each advancing unit.
is there any way I could cut the amount of writing down?

RETYPE_UNIT FILTER TYPE is a macro I defined.
No, something like that is the only way. However all the WML you have there seems to be completely bogus.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: macro to deadvance unit. any way to trim?

Post by Gambit »

Lastbreath is to Death as ??? is to Advance.

Is there such a thing that goes in place of the ???'s ? If so store the unit right before it advances, reset its exp and unstore...
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: macro to deadvance unit. any way to trim?

Post by Ken_Oh »

Gambit wrote:Lastbreath is to Death as ??? is to Advance.

Is there such a thing that goes in place of the ???'s ? If so store the unit right before it advances, reset its exp and unstore...
Right, it depends what and when ducklord means by "deadvance." The advance event fires before a unit advances and a post_advance event fires after the advance, so, if you just want to prevent a unit from advancing, then gambit is on the right track. Just store the unit on advance and then unstore on post_advance.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: macro to deadvance unit. any way to trim?

Post by zookeeper »

Ah well, I assumed he wanted it to work whenever for any unit, not just when a unit advances, since...of course he would have said so if that would have been the case, right? :|
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: macro to deadvance unit. any way to trim?

Post by Gambit »

In a standard scenario one can only recruit level ones. So I assumed the only way to get a higher level unit would be to... advance?

I agree. He needs to elaborate more on the exact usage/implimentation.
ducklord_time
Posts: 16
Joined: April 15th, 2009, 10:10 am

Re: macro to deadvance unit. any way to trim?

Post by ducklord_time »

My intention was to define a unit which, when it attacked, reduced the experience of the unit it attacked. If the experience were reduced below 0, the unit it attacked would be turned into something which could advance into it. I intended to make an attacker_hits event which stored unit2 and then called this macro on the variable:
Spoiler:
etc


other WML I made to facilitate it is:
Spoiler:
I see now that I need to put $ and | signs in the filters. What else is wrong with the WML?
User avatar
A Guy
Posts: 793
Joined: May 24th, 2008, 1:55 am

Re: macro to deadvance unit. any way to trim?

Post by A Guy »

You forgot to put a # at the beginning of enddef. Also, I find that I have to match the capitalization of the ID of units, but it might just be for using the recruit list. It wouldn't hurt to do it anyways.

I might look more into your WML later.
I'm just... a guy...
I'm back for now, I might get started on some work again.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: macro to deadvance unit. any way to trim?

Post by Ken_Oh »

MODIFY_UNIT is used to alter an unstored unit. Using it in that event, where it the unit is automatically stored, wouldn't work with the rest of your code in the event. Just use {VARIABLE unit.variables.amla_count 1}.

Which brings me to my next note: why are you manipulating "unit1"?

Code: Select all

[not]
   [variable]
   name=unit1.variables.amla_count
   boolean_equals=1
   [/variable]
[/not]
You don't want this. Take the [not]s out and put in not_equals=1.

AFAIK, you can't put multiple values for cases, like you have here:
value=necromancer,lich
I've tested it a few versions ago (probably 1.5.6-ish) and it didn't work then, so unless it has changed, it won't work.

That's probably not everything. I just skimmed the code and picked out the obvious stuff.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: macro to deadvance unit. any way to trim?

Post by Gambit »

So wait a minute... just to paraphrase to make sure I understand, you want a unit that can go around hopping through the forest bopping units on the head and de-evolving them?
ducklord_time
Posts: 16
Joined: April 15th, 2009, 10:10 am

Re: macro to deadvance unit. any way to trim?

Post by ducklord_time »

A Guy wrote:You forgot to put a # at the beginning of enddef. Also, I find that I have to match the capitalization of the ID of units, but it might just be for using the recruit list. It wouldn't hurt to do it anyways.

I might look more into your WML later.
Ken_Oh wrote:MODIFY_UNIT is used to alter an unstored unit. Using it in that event, where it the unit is automatically stored, wouldn't work with the rest of your code in the event. Just use {VARIABLE unit.variables.amla_count 1}.

Which brings me to my next note: why are you manipulating "unit1"?

Code: Select all

[not]
   [variable]
   name=unit1.variables.amla_count
   boolean_equals=1
   [/variable]
[/not]
You don't want this. Take the [not]s out and put in not_equals=1.

AFAIK, you can't put multiple values for cases, like you have here:
value=necromancer,lich
I've tested it a few versions ago (probably 1.5.6-ish) and it didn't work then, so unless it has changed, it won't work.

That's probably not everything. I just skimmed the code and picked out the obvious stuff.


Thanks.

The [not] tags rather than "not_equals" were because I wanted it to test if the variable had been set at all, and I wasn't sure if "not_equals" would do that. Should I make a recruit event to set it to zero?


Gambit wrote:So wait a minute... just to paraphrase to make sure I understand, you want a unit that can go around hopping through the forest bopping units on the head and de-evolving them?
yes.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: macro to deadvance unit. any way to trim?

Post by Gambit »

keeping with the little bunny foofoo reference; down came the sugarplum fairy and she said

sounds like a cool idea. can't wait to play it. let us know when its working and uploaded :D
Post Reply