filtering a unit by controller
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.
-
- Art Contributor
- Posts: 117
- Joined: July 18th, 2006, 12:23 am
filtering a unit by controller
Hello!
Can anybody tell me how i can filter a unit by controller. That means, the event should be executed when the unit is controlled by ai. It couldn't be done by side, because the map is in multiplayer mode and i don't know wich side is controlled by whom before playing.
Have to be something like this.
Can anybody tell me how i can filter a unit by controller. That means, the event should be executed when the unit is controlled by ai. It couldn't be done by side, because the map is in multiplayer mode and i don't know wich side is controlled by whom before playing.
Have to be something like this.
Code: Select all
[event]
name=moveto
first_time_only=no
[filter]
x,y={X},{Y}
controller=ai # something like that?
[/filter]
... (some code) ...
[/event]
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
Re: filtering a unit by controller
Should work...
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: filtering a unit by controller
Code: Select all
[event]
name=moveto
first_time_only=no
[store_side]
side=$side_number
variable=temp
[/store_side]
[if]
[variable]
name=temp.controller
equals=ai
[/variable]
[then]
...
[/then]
[else]
[allow_undo]
[/allow_undo]
[/else]
[/if]
{CLEAR_VARIABLE temp}
[/event]
-
- Art Contributor
- Posts: 117
- Joined: July 18th, 2006, 12:23 am
Re: filtering a unit by controller
@zookeeper
Thanks a lot! It works fine
Concerning the danger of OOS errors, i use this check only to skip a dialog for ai turns. That means only human players will see the dialog. I think it shouldn't throw some OOS even if someone droids. But it has to be tested.
Thanks a lot! It works fine
Concerning the danger of OOS errors, i use this check only to skip a dialog for ai turns. That means only human players will see the dialog. I think it shouldn't throw some OOS even if someone droids. But it has to be tested.
Re: filtering a unit by controller
Yeah, there's no problem if you don't actually change anything in the event (or use random, since random in MP requires that each client executes the same number of calls to prevent them from going off-sync).musketaquid wrote:@zookeeper
Thanks a lot! It works fine
Concerning the danger of OOS errors, i use this check only to skip a dialog for ai turns. That means only human players will see the dialog. I think it shouldn't throw some OOS even if someone droids. But it has to be tested.