filter to stop units spawning on player's villas

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

Post Reply
User avatar
Gwledig
Posts: 569
Joined: March 30th, 2009, 5:10 pm
Location: UK

filter to stop units spawning on player's villas

Post by Gwledig »

In conquest, AI guardians are spawned using on-the-fly [unit] style units on turn 2 (on empty villages unoccupied by players). I'm re-working code to make this simpler, the example below uses {scatter_units... to place units on unoccupied villages on turn 2. However if a player moves their own starting unit off a village on turn 1, I find I am unable to filter out player villages when the AI is spawned, so basically I am looking for a working filter to prevent spawning on player villages. I also found this method places units to an adjacent hex alongside player units, to there is a little bit of wml at the end to kill these units. Otherwise the unit placement is almost instantaneous, the fastest method I've found. Any ideas would be appreciated to stop spawning on player villages. In the example below I am referring to a variable stored in some separate code to [store_villages] on all side turn events.

Code: Select all

#define AI_PLACEMENT
[event]
name=turn 2
first_time_only=yes

{SCATTER_UNITS 999 "Spearman" 2 (
terrain=*^V*
x=0-999
y=0-999


[filter_location]
terrain=*^V*
find_in=allvillages
owner_side=0
[/filter_location]


) (
	side=7
	upkeep=loyal
	alignment=neutral
	generate_name=no
	random_traits=no
	zoc=yes
	unrenamable=yes
	canrecruit=no
	moves=0
	max_moves=0
	movement=0
	experience=0
	max_experience=1000
	name=Militia
	id=AIPeon
	gender=male
	race=human
	level=1
	flies=false
	
[modifications]
[object]
silent=yes
[filter]
id=AIPeon
[/filter]
[effect]
apply_to=remove_attacks
range=ranged
[/effect]
[effect]
apply_to=remove_attacks
range=melee
[/effect]
[effect]
apply_to=new_attack
range=melee
type=blade
description="blade"
icon="attacks/dagger-human.png"
damage=10
number=2
remove_Specials=backstab
remove_specials=berserk
remove_specials=charge
remove_specials=drain
remove_specials=firststrike
remove_specials=magical
remove_specials=marksman
remove_specials=plague
remove_specials=poison
remove_specials=slow
remove_specials=petrify
remove_specials=swarm
[/effect]
[effect]
apply_to=attack
[set_specials]
mode=append
{WEAPON_SPECIAL_BERSERK}
[/set_specials]
[/effect]
[effect]
apply_to=attack
[set_specials]
mode=append
[/set_specials]
[/effect]
[effect]
apply_to=remove_ability
[abilities]
{ABILITY_EXTRA_HEAL}
{ABILITY_AMBUSH}
{ABILITY_CURES}
{ABILITY_HEALS}
{ABILITY_ILLUMINATES}
{ABILITY_LEADERSHIP_LEVEL_1}
{ABILITY_LEADERSHIP_LEVEL_2}
{ABILITY_LEADERSHIP_LEVEL_3}
{ABILITY_LEADERSHIP_LEVEL_4}
{ABILITY_LEADERSHIP_LEVEL_5}
{ABILITY_NIGHTSTALK}
{ABILITY_REGENERATES}
{ABILITY_SKIRMISHER}
{ABILITY_STEADFAST}
{ABILITY_SUBMERGE}
{ABILITY_TELEPORT}
[/abilities]
[/effect]
[effect]
apply_to=new_ability
[abilities]	
[/abilities]
[/effect]
[effect]
apply_to=movement_costs
replace=yes
[movement_costs]
deep_water=3
shallow_water=2
reef=2
swamp_water=2
flat=1
sand=1
forest=2
hills=2
mountains=3
village=1
castle=1
ruin=1
cave=2
frozen=1
unwalkable=100
impassable=100
fungus=2
[/movement_costs]
[/effect]
[effect]
apply_to=defense
replace=yes
[defense]
shallow_water=80
reef=70
swamp_water=70
deep_water=90
flat=60
sand=60
forest=50
hills=50
mountains=40
village=40
castle=40
cave=60
frozen=60
fungus=40
[/defense]
[/effect]
[/object]
[/modifications]	
)}

#kill extranous AI created on map tiles adjacent to vilas
[kill]
id=AIPeon
animate=no
[filter_location]
[not]
terrain=*^V*
[/not]
[/filter_location]
fire_event=yes
[/kill]

fire_event=yes
[/event]

#enddef
Maintainer of Conquest (Original Gameplay), Conquest+, Conquest+ Space/Ranged, Chaoz Battle of the Wizards, Lazersquad (squad game), WesCraft (building MP game)
User avatar
Gwledig
Posts: 569
Joined: March 30th, 2009, 5:10 pm
Location: UK

Re: filter to stop units spawning on player's villas

Post by Gwledig »

Looks like I just needed

Code: Select all

owner_side=0
under the 1st terrain filter shown above
Maintainer of Conquest (Original Gameplay), Conquest+, Conquest+ Space/Ranged, Chaoz Battle of the Wizards, Lazersquad (squad game), WesCraft (building MP game)
Post Reply