What does "meant to be used as a suffix" mean for macros?
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.
What does "meant to be used as a suffix" mean for macros?
Hey there, I am rather new to this, and this is probably a n00b question, but I can't seem to find any answers out there and I want to write good WML code. Side note: Really excited to become a part of the WML dev community. It's something I've always wanted to do and finally got around to. Hope to be putting out my first co-op survival scenario very soon
I am trying to use the built in macros to spawn units in a multiplayer survival scenarioI am working on using the internal macro . I want to make some of the units have the "guardian" ability. I see that there is a macro available internally in the game, but it is described as "Meant to be used as a suffix to a unit-generating macro call." I'm not sure what this means or how to implement it.
If someone would shed some light on this for me, I'd be very grateful.
Thanks for your help!
- S
I am trying to use the built in macros to spawn units in a multiplayer survival scenarioI am working on using the internal macro
Code: Select all
{UNIT SIDE TYPE X Y WML}
Code: Select all
{GUARDIAN}
If someone would shed some light on this for me, I'd be very grateful.
Thanks for your help!
- S
Re: What does "meant to be used as a suffix" mean for macros?
That macro is used in hundreds of places in mainline campaigns, so if you search for some of those it should become clear how it's used.
Re: What does "meant to be used as a suffix" mean for macros?
I could try to help you if you could tell me which units have this ability.. unit type or name or campaign they are present..Saratos wrote: ↑June 1st, 2018, 4:07 am I am trying to use the built in macros to spawn units in a multiplayer survival scenarioI am working on using the internal macro. I want to make some of the units have the "guardian" ability. I see that there is aCode: Select all
{UNIT SIDE TYPE X Y WML}
macro available internally in the game, but it is described as "Meant to be used as a suffix to a unit-generating macro call." I'm not sure what this means or how to implement it.Code: Select all
{GUARDIAN}
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: What does "meant to be used as a suffix" mean for macros?
You looked but didn't see ...
The [+unit] means you must have JUST closed a [unit] tag and this macro is re-opening it to make a change.
The assumption that you must have done that as a results of a unit-generating macro call is simply that, had you done the unit by-hand, you'd not have needed to re-open the block.
Code: Select all
#define GUARDIAN
# Meant to be used as a suffix to a unit-generating macro call.
[+unit]
ai_special=guardian
animate=no
[/unit]
#enddef
The assumption that you must have done that as a results of a unit-generating macro call is simply that, had you done the unit by-hand, you'd not have needed to re-open the block.
I forked real life and now I'm getting merge conflicts.
Re: What does "meant to be used as a suffix" mean for macros?
Practically it just means you stick the
{GUARDIAN}
inclusion right after the unit-generating macro's inclusion.Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
Re: What does "meant to be used as a suffix" mean for macros?
Tad_Carlucci wrote: ↑June 1st, 2018, 1:26 pmCode: Select all
#define GUARDIAN # Meant to be used as a suffix to a unit-generating macro call. [+unit] ai_special=guardian animate=no [/unit] #enddef
So according to what they were saying, I could think/assume that you could use guardian ability in 2 ways...
1) your unit code would look like this (might not work, but I believe it should work), Spearman would appear on x=22 y=33 and belong to side 1
Code: Select all
{UNIT 1 Spearman 22 33 (
ai_special=guardian
animate=no
)}
Code: Select all
{UNIT 1 Spearman 22 33} ## this might show error... I never used unit macro..
{GUARDIAN}
Code: Select all
{UNIT 1 Spearman 22 33 " "} ## because I assume it expects WML which might be empty if you dont plan any more code..
{GUARDIAN}
I'm not sure as I never used
{UNIT
macro... so instead of WML you can either put some WML code like in example #1)or you could leave it empty with putting quotes or brackets
" "
or ( )
i guess..-------------------------
if you want things more complicated you can create your custom unit macro.. like so:
Just once and NOT inside any event in your code put something like this:
Code: Select all
#define MY_CUSTOM_UNIT_MACRO SIDE TYPE POSITION
[unit]
ai_special=guardian
animate=no
type={TYPE}
x,y={POSITION}
side={SIDE}
generate_name=yes
random_traits=yes
random_gender=yes
role=monster
[modifications]
{TRAIT_LOYAL}
[/modifications]
[/unit]
#enddef
{UNIT}
and {GUARDIAN}
macros just call your custom macro like so:{MY_CUSTOM_UNIT_MACRO 5 (Tentacle of the Deep) (3,2)}
## Tentacle of the Deep appears on x=3 y=2 for side 5and it will already have guardian inside of it.
Re: What does "meant to be used as a suffix" mean for macros?
Thanks so much for the replies! I think I understand now.
So I just need to place the "suffix" code on the following line after the macro it is being added to?
There's a bunch of code in the macros section that says that it is to be used like this, so I am just looking to understand how the reference is written.
I had thought of making my own macro, but yeah, like I said, this was more of an exercise in understanding the "built in code" and also getting out in the community a bit. Although, I did like that first suggestion to go through the mainline campaigns. I had thought of that after posting this question, and figured I would just wait to hear it from you all instead. Thanks for helping me out.
Gonna go try this now, all the best!
So I just need to place the "suffix" code on the following line after the macro it is being added to?
There's a bunch of code in the macros section that says that it is to be used like this, so I am just looking to understand how the reference is written.
I had thought of making my own macro, but yeah, like I said, this was more of an exercise in understanding the "built in code" and also getting out in the community a bit. Although, I did like that first suggestion to go through the mainline campaigns. I had thought of that after posting this question, and figured I would just wait to hear it from you all instead. Thanks for helping me out.
Gonna go try this now, all the best!