adding to the right click menu
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.
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
adding to the right click menu
I need help...
How can I add a command or function to the right click drop down menu that you get when right clicking a unit?
I want to be able to execute an attack from a specific unit without targeting another unit... and the only way I could think of is right clicking the unit, and clicking the added command for that unit to execute its attack... Any information would be great...
I'm kinda new to WML so please put script examples for me....
and if there is another way for me to achieve the same principle in a simpler way please... I'm all ears...
all my stuff is for multiplayer... NOT CAMPAIGN... i know that effects some code...
Thanks for any help...
How can I add a command or function to the right click drop down menu that you get when right clicking a unit?
I want to be able to execute an attack from a specific unit without targeting another unit... and the only way I could think of is right clicking the unit, and clicking the added command for that unit to execute its attack... Any information would be great...
I'm kinda new to WML so please put script examples for me....
and if there is another way for me to achieve the same principle in a simpler way please... I'm all ears...
all my stuff is for multiplayer... NOT CAMPAIGN... i know that effects some code...
Thanks for any help...
my logic is sound
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Re: adding to the right click menu
Look at set_menu_item in RefernceWML. If A New Land is still mainline, then look at how it is done there. Otherwise, there are plenty of examples in add-on content (like Brotherhood of Light).
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: adding to the right click menu
okay that helped a ton...
I have researched the set_menu_item a lot... but I still can't figure out where I will be putting the script... and I can't figure out if there is a way to make it so that the command will only appear to the user of the unit and not the other player...
I have researched the set_menu_item a lot... but I still can't figure out where I will be putting the script... and I can't figure out if there is a way to make it so that the command will only appear to the user of the unit and not the other player...
my logic is sound
- Luke the Flaming
- Posts: 215
- Joined: October 18th, 2006, 6:25 pm
Re: adding to the right click menu
Untested (but it should work... in single player it surely would; but I've never tried in multiplayer).
Put it somewhere into [event] with name=start.
Put it somewhere into [event] with name=start.
Code: Select all
[set_menu_item]
id=grid_break_attack
image=blank.png # Or any image you'll like to create for this purpose
# (I suggest to make it 16 x 16 or so).
description= _ "Grid Break attack!"
[show_if]
[have_unit]
type=zengetsu # Or whatever it is called the kind of
# unit with the Grid Break attack.
side=$side_number # So if the current playing side is not the
# one of the unit, the button is not dispalyed.
[filter_location]
x,y=$x1,$y1
[/filter_location]
[/have_unit]
[/show_if]
[command]
# The whole Grid Break attack stuff goes here.
[/command]
[/set_menu_item]
O, Wind, if Winter comes, can Spring be far behind?
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: adding to the right click menu
Alright time for me to actually focus on this one... I tried your script and it didn't seem to work but I am playing with it...
this part is essential because I will be using it for more than grid break... I would like to make a ghetto recruiting ability with it... and an active healing ability... that will come later though...
When I tried this script the command never even appeared... my only guess is that I have it in the wrong place (I have it on the unit with Grid break)...
this part is essential because I will be using it for more than grid break... I would like to make a ghetto recruiting ability with it... and an active healing ability... that will come later though...
When I tried this script the command never even appeared... my only guess is that I have it in the wrong place (I have it on the unit with Grid break)...
my logic is sound
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: adding to the right click menu
[filter_location] goes outside of the [show_if]
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- Luke the Flaming
- Posts: 215
- Joined: October 18th, 2006, 6:25 pm
Re: adding to the right click menu
If it is in the unit, which name have you given to the [event]? Since it is going to be included in the scenario when the first unit of that type appear, if it is name=start it will never work (since itis included once the moment to fire it has already expired). Try with:zengetsu88 wrote:When I tried this script the command never even appeared... my only guess is that I have it in the wrong place (I have it on the unit with Grid break)...
Code: Select all
[event]
name=select
[filter]
type=zengetsu
[/filter]
etc...
Why? Don't we want the zengetsu unit in the exact position where you right click (to display the option of the special attack)?Pentarctagon wrote:[filter_location] goes outside of the [show_if]
O, Wind, if Winter comes, can Spring be far behind?
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: adding to the right click menu
right, my bad
though it turns out that you don't even need the [filter_location], i was able to get a menu item to show up only over a mage with just this:

though it turns out that you don't even need the [filter_location], i was able to get a menu item to show up only over a mage with just this:
Code: Select all
[show_if]
[have_unit]
type=Mage
side=$side_number
x,y=$x1,$y1
[/have_unit]
[/show_if]
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: adding to the right click menu
Okay I got it to work... The menu item shows up but time to get more complicated...
I only want it to show up if the units dot is green or yellow (the little dot above their head that means their status is still active...) and I don't want it to show up if that unit's do is red...
and finally how do I make the command or action like an attack and use up all the movement points by using it (turns the dot red)
I only want it to show up if the units dot is green or yellow (the little dot above their head that means their status is still active...) and I don't want it to show up if that unit's do is red...
and finally how do I make the command or action like an attack and use up all the movement points by using it (turns the dot red)
my logic is sound
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: adding to the right click menu
store the unit, {VARIABLE var_name.moves 0}, unstore unit.zengetsu wrote:and finally how do I make the command or action like an attack and use up all the movement points by using it (turns the dot red)
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- Luke the Flaming
- Posts: 215
- Joined: October 18th, 2006, 6:25 pm
Re: adding to the right click menu
zengetsu88 wrote:I only want it to show up if the units dot is green or yellow (the little dot above their head that means their status is still active...) and I don't want it to show up if that unit's do is red...
Code: Select all
[show_if]
[have_unit]
type=zengetsu # Or whatever it is called the kind of
# unit with the Grid Break attack.
side=$side_number # So if the current playing side is not the
# one of the unit, the button is not dispalyed.
[not]
moves=0 # The "red dot".
[/not]
[not]
attacks_left=0 # You probably do not want the unit to attack
# normally AND with the special attack in the
# same turn, don't you?
[/not]
x,y=$x1,$y1
[/have_unit]
[/show_if]
O, Wind, if Winter comes, can Spring be far behind?
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: adding to the right click menu
the moves used up thing works but the only show if moves or attacks thing does not...
more details...
How do I add an animation to the unit is using the attack
I have this animation sequence
but im not entirely sure how to use it or where to put it...
other than that I think I've got everything worked out
more details...
How do I add an animation to the unit is using the attack
I have this animation sequence
Spoiler:
other than that I think I've got everything worked out
my logic is sound
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: adding to the right click menu
okay ignore the animation thing... I still can't get this to work right...
I don't want the menu item to show if the units moves are done... I already have it so that the units little dot turns red/the unit has no more moves left when you use the menu item/ability...
I have tried using the not tags inside the show_if tags but that just removes the menu item entirely...
I don't want the menu item to show if the units moves are done... I already have it so that the units little dot turns red/the unit has no more moves left when you use the menu item/ability...
I have tried using the not tags inside the show_if tags but that just removes the menu item entirely...
my logic is sound
- Luke the Flaming
- Posts: 215
- Joined: October 18th, 2006, 6:25 pm
Re: adding to the right click menu
I forgot that values like "moves" and "attacks_left" aren't keys of the Standard Unit Filter, but need a [filter_wml] tag to be valid.
Code: Select all
[show_if]
[have_unit]
type=zengetsu # Or whatever it is called the kind of
# unit with the Grid Break attack.
side=$side_number
[filter_wml]
[not]
moves=0
[/not]
[not]
attacks_left=0
[/not]
[/filter_wml]
x,y=$x1,$y1
[/have_unit]
[/show_if]
O, Wind, if Winter comes, can Spring be far behind?
Re: adding to the right click menu
You also can't use [not] inside a [filter_wml]. You need two [not]s, each containing a [filter_wml].Luke the Flaming wrote:I forgot that values like "moves" and "attacks_left" aren't keys of the Standard Unit Filter, but need a [filter_wml] tag to be valid.Code: Select all
[show_if] [have_unit] type=zengetsu # Or whatever it is called the kind of # unit with the Grid Break attack. side=$side_number [filter_wml] [not] moves=0 [/not] [not] attacks_left=0 [/not] [/filter_wml] x,y=$x1,$y1 [/have_unit] [/show_if]