gold adding event help... PLEASE!!!
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
gold adding event help... PLEASE!!!
Hey everybody! I need help with an event that I am placing into my eras file.
This event loads when the game starts and It is supposed to continually check if the is a certain unit on the battlefield (called: Trigon of Wealth)
If this unit is on the field then it is supposed to give its user one gold for every unit on the field at the beginning of the user's turn.
Here is what I got.
I'm not sure what im doing wrong. I hate the stupid side thing and I always have trouble with that so i assume my side declaration is part of the reason.
Lastly this is for multiplayer, not campaign or a scenario.
This event loads when the game starts and It is supposed to continually check if the is a certain unit on the battlefield (called: Trigon of Wealth)
If this unit is on the field then it is supposed to give its user one gold for every unit on the field at the beginning of the user's turn.
Here is what I got.
Code: Select all
#define TRIGON_WEALTH_THING
[event]
name=prestart
[if]
[have_unit]
[filter]
side=$side_number
type=Trigon of Wealth
[/filter]
[/have_unit]
[then]
[event]
name=side turn
first_time_only=no
[store_unit]
[filter]
side=$side_number
[/filter]
variable=units
[/store_unit]
[store_gold]
side=$side_number
variable=gold
[/store_gold]
{FOREACH units i}
{VARIABLE_OP gold add 1}
{NEXT i}
[unstore_gold]
variable=gold
find_vacant=no
[/unstore_gold]
{CLEAR_VARIABLE units}
{CLEAR_VARIABLE gold}
[/event]
[/then]
[/if]
{CLEAR_VARIABLE my_side}
[/event]
#enddef
Lastly this is for multiplayer, not campaign or a scenario.
my logic is sound
Re: gold adding event help... PLEASE!!!
a) no [filter] in [have_unit].
b) you don't need to unstore gold. [unstore_gold] doesn't exist.
c) I'm not sure if side_number is already defined in a prestart event, and if, it won't be anything but 1.
b) you don't need to unstore gold. [unstore_gold] doesn't exist.
c) I'm not sure if side_number is already defined in a prestart event, and if, it won't be anything but 1.
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
Re: gold adding event help... PLEASE!!!
In that case, you don't want prestart, you want side turn. That makes it happen each side turn (when each player has a go, in other words).zengetsu88 wrote:This event loads when the game starts and It is supposed to continually check if the is a certain unit on the battlefield (called: Trigon of Wealth)
As Ceres said, [have_unit] has no filter. If it makes it easier for you to remember, think of [have_unit] as a filter, but for [if] and [set_menu_item].
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: gold adding event help... PLEASE!!!
Okay I did the fixes ya'll told me to do.
It is still not working.
here's what I got:
Thanks for the help so far!!!
It is still not working.
here's what I got:
Code: Select all
#define TRIGON_WEALTH_THING
[event]
name=prestart
[if]
[have_unit]
side=1
type=Trigon of Wealth
[/have_unit]
[then]
[event]
name=side turn
first_time_only=no
[store_unit]
[filter]
side=1
[/filter]
variable=units
[/store_unit]
{FOREACH units i}
[gold]
amount=1
side=1
[/gold]
{NEXT i}
{CLEAR_VARIABLE units}
[/event]
[/then]
[/if]
[/event]
#enddef
Thanks for the help so far!!!
my logic is sound
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
Re: gold adding event help... PLEASE!!!
If I recall correctly, [store_unit] does not need a filter.zengetsu88 wrote:Okay I did the fixes ya'll told me to do.
It is still not working.
here's what I got:
#define TRIGON_WEALTH_THING
[event]
name=prestart
[if]
[have_unit]
side=1
type=Trigon of Wealth
[/have_unit]
[then]
[event]
name=side turn
first_time_only=no
[store_unit]
[filter]
side=1
[/filter]
variable=units
[/store_unit]
{FOREACH units i}
[gold]
amount=1
side=1
[/gold]
{NEXT i}
{CLEAR_VARIABLE units}
[/event]
[/then]
[/if]
[/event]
#enddef
Thanks for the help so far!!!
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
Re: gold adding event help... PLEASE!!!
You don't recall correctly.DEATH_is_undead wrote:If I recall correctly, [store_unit] does not need a filter.
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
Re: gold adding event help... PLEASE!!!
Heh, then its [kill] I must be thinking of.... Disregard my post, then.zookeeper wrote:You don't recall correctly.DEATH_is_undead wrote:If I recall correctly, [store_unit] does not need a filter.
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
Re: gold adding event help... PLEASE!!!
Two things:
1. Where are you putting the macro {TRIGON_WEALTH_THING} within the scenario? It needs to be toplevel (inside the [scenario] tag, outside any [event] tags.)
2. If in a prestart event, the game ONLY checks at the FIRST time you start the scenario if you have the "Trigon of Wealth" unit. What you need to do is put it in an event named "side 1 turn" as so:
1. Where are you putting the macro {TRIGON_WEALTH_THING} within the scenario? It needs to be toplevel (inside the [scenario] tag, outside any [event] tags.)
2. If in a prestart event, the game ONLY checks at the FIRST time you start the scenario if you have the "Trigon of Wealth" unit. What you need to do is put it in an event named "side 1 turn" as so:
Code: Select all
#define TRIGON_WEALTH_THING
[event]
name=side 1 turn
first_time_only=no
[if]
[have_unit]
side=1
type=Trigon of Wealth
[/have_unit]
[then]
[store_unit]
[filter]
side=1
[/filter]
variable=units
[/store_unit]
{FOREACH units i}
[gold]
amount=1
side=1
[/gold]
{NEXT i}
{CLEAR_VARIABLE units}
[/then]
[/if]
[/event]
#enddef
Re: gold adding event help... PLEASE!!!
...What? side 1 turn?
would work just as well for all players, not just player 1.
Code: Select all
[event]
name=side turn
first_time_only=no
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Re: gold adding event help... PLEASE!!!
Right, but he is trying to do specifically side 1. If he does a normal side turn, he'd have to do yet another variable check to see if $side_number equalled 1.
Re: gold adding event help... PLEASE!!!
Its user, not side 1. The [gold] was only given and changed to side 1 when ceres said that on a prestart event, it'll only be 1.zengetsu88 wrote:If this unit is on the field then it is supposed to give its user one gold
Originally, it was supposed to happen each turn, for each side. A bit like the way an Elvish Shaman's healing is triggered.
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: gold adding event help... PLEASE!!!
Thank you, yes that is what I'm going for. And its not for a scenario but for multiplayer era. But it makes sense that I need to do the check inside the "side turn" event and remove the prestart.Reepurr wrote:Its user, not side 1. The [gold] was only given and changed to side 1 when ceres said that on a prestart event, it'll only be 1.zengetsu88 wrote:If this unit is on the field then it is supposed to give its user one gold
Originally, it was supposed to happen each turn, for each side. A bit like the way an Elvish Shaman's healing is triggered.
I will do some fixes and get back to ya'll.
Thanks for the input so far!!!
my logic is sound
- zengetsu88
- Posts: 72
- Joined: March 29th, 2010, 7:25 pm
- Location: This Universe
Re: gold adding event help... PLEASE!!!
Alright here is what I got.
It is still not working. I know that the problem is coming from the "side=" stuff. I hate side declaration, because I can never get it to work. I want this to be used on whichever side is currently playing. But it is purely not working.
Thanks everbody for the input so far.
Code: Select all
#define TRIGON_WEALTH_THING
[event]
name=side turn
first_time_only=no
[store_side]
side=$side_number
variable=self
[/store_side]
[if]
[have_unit]
side=self
type=Trigon of Wealth
[/have_unit]
[then]
[store_unit]
[filter]
side=self
[/filter]
variable=units
[/store_unit]
{FOREACH units i}
[gold]
amount=1
side=self
[/gold]
{NEXT i}
{CLEAR_VARIABLE units}
[/then]
{CLEAR_VARIABLE self}
[/if]
[/event]
#enddef
Thanks everbody for the input so far.
my logic is sound
Re: gold adding event help... PLEASE!!!
Why don't you just go with side=$side_number for the [have_unit] and the [gold] also?
Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
Re: gold adding event help... PLEASE!!!
It's $self.side anyway, since $self is a container variable.
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!