Change AI side from defend to attack during scenario
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.
Change AI side from defend to attack during scenario
I am trying to get an allied AI side to stay and defend an area until an event happens in the game, at which point I want the AI side to leave its defended area and attack enemies.
I have the following in the [side] tag:
Then in the a "new turn" [event] I have the following:
I know this fires because the Test message appears. However, when I use the game state inspector, the ai data under the side still says:
Does anyone know what I'm doing wrong? Or is there a better way to accomplish what I want?
I have the following in the [side] tag:
Code: Select all
[ai]
aggression=0.2
passive_leader=yes
[avoid]
[not]
x=30
y=4
radius=4
[/not]
[/avoid]
[/ai]
Code: Select all
[message]
speaker=Ryden
message = _ "Test"
[/message]
[modify_ai]
side=3
aggression=0.8
passive_leader=no
[avoid]
x=30
y=4
radius=4
[/avoid]
[/modify_ai]
Code: Select all
agression: 0.2
...
passive_leader: 1
Re: Change AI side from defend to attack during scenario
I think you have to delete the old avoid. I suggest you use one of the micro_ai to do what you want instead of [avoid]. probably zone_guardian then delete it on the new turn.
Re: Change AI side from defend to attack during scenario
I apologies, i think my answer was confusing. about the aggression not changing, well you used modify_ai incorrectly. check the wiki on how to use modify_ai. Your code should have been [modify_side] with [ai] tags inside of it.
But even if you did that and checked the game inspector aspect, you would have seen both the first avoid block and the second avoid block defined. That is what I meant with you'd have to delete the first avoid block.
But even if you did that and checked the game inspector aspect, you would have seen both the first avoid block and the second avoid block defined. That is what I meant with you'd have to delete the first avoid block.
Re: Change AI side from defend to attack during scenario
Thanks, that's exactly what I needed!
- Celtic_Minstrel
- Developer
- Posts: 2216
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Change AI side from defend to attack during scenario
I'm fairly sure the second avoid block would be the one active, though… so deleting the first wouldn't be strictly necessary.
Re: Change AI side from defend to attack during scenario
I just tried this out with the trusty WML_Guide and what you said does indeed seem to be the case. Thank you.