A still enemy Unit.

For writers working on documentation, story prose, announcements, and all kinds of Wesnoth text.

Moderators: Forum Moderators, Developers

Post Reply
KeyserSoze
Posts: 16
Joined: March 10th, 2010, 4:27 pm

A still enemy Unit.

Post by KeyserSoze » March 10th, 2010, 4:30 pm

Hello together,

can anyone say me how I can creat a unit which doesnt move until the player attacks it?
Greez

User avatar
Araja
Posts: 718
Joined: May 28th, 2009, 9:56 am
Location: Bath, England

Re: A still enemy Unit.

Post by Araja » March 10th, 2010, 7:57 pm

Well, if you're in debug mode you can turn an AI unit into a "guardian". This means it won't move until an enemy comes within it's movement radius. That's about as close as I can come with my limited knowledge of WML, but I'll add it just in case.

(Or to save the time of people who *do* know what they're talking about) :)

User avatar
artisticdude
Moderator Emeritus
Posts: 2424
Joined: December 15th, 2009, 12:37 pm
Location: Somewhere in the middle of everything

Re: A still enemy Unit.

Post by artisticdude » March 10th, 2010, 8:13 pm

This should probably have been posted in the WML forums, as this forum is more for story and dialogue than coding problems.

As far as your question goes, there are a number of ways you could do this, but none of them are exactly easy to code. Unless it's absolutely necessary for the unit not to move until it is attacked, you can get away with the ai_special=guardian, which works as stated above.
"I'm never wrong. One time I thought I was wrong, but I was mistaken."

KeyserSoze
Posts: 16
Joined: March 10th, 2010, 4:27 pm

Re: A still enemy Unit.

Post by KeyserSoze » March 10th, 2010, 8:24 pm

THX. It has worked. Sorry for the wrong thread. Greez

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: A still enemy Unit.

Post by Mabuse » March 10th, 2010, 9:41 pm

btw, if you modify the units movement costs (to 100 each) it wont move until it gets attcked ;)
(this can be easily done via object-->effect for example)

i still recommend to set the unit ALSO to guardian though since this will save a lot of ai calc time
The best bet is your own, good Taste.

Post Reply