You must be logged in to post messages.
Please login or register

AI & RM Scripting
Moderated by Sebastien, Leif Ericson

Hop to:    
Welcome! You are not logged in. Please Login or Register.1 reply
Age of Kings Heaven » Forums » AI & RM Scripting » AI troops to flare
Bottom
Topic Subject:AI troops to flare
Rico_jolla
Squire
posted 07-07-19 04:10 AM CT (US)         
Hallo,
I already tried to gather info about this in the past, with little results.
Now I need some help badly.

I would like to insert a few code to make my allied P2 (computer player) automatically send all his military units (archers and infantry type) where the human player P1 sparks a flare.

(practically P1 can "move" the entire army of P2 using the flares)

PLEASEPLEASEPLEASE I really need this, for my Kolossal scenario, which is almost finished and I've been working on it 5yrs in a row!

~--------------------------~{}~--------------------------~
> PROPHETS OF DOOM <
o> Project Thread: https://tinyurl.com/y93q84s9
~---------------------------~~---------------------------~
AuthorReplies:
Leif Ericson
Seraph Emeritus
posted 07-07-19 06:13 AM CT (US)     1 / 1       
Which version of the game is your scenario for? This can be done with Userpatch. I'm not sure if it's possible with HD.

Edit:

Here is code to make it happen, mostly borrowed from the Promi AI. I tested this in Userpatch. Soldiers will sometimes attack enemy units and buildings along the way with this code, but if you want the soldiers to attack more intelligently along the way, replace "action-move" in the last line with "action-patrol". This will cause the enemy units to patrol back and forth though.

(defconst flare 274)
(defconst cmdid-military 4)
(defconst cmdid-monk 6)
(defconst all-units-class -1)
(defconst action-move 1)
(defconst action-patrol 2)
(defconst unit-flare-point-x 100)
(defconst unit-flare-point-y 101)

(defrule
(cc-players-unit-type-count any-human flare >= 1)
=>
(up-find-player-flare any-human unit-flare-point-x)
(up-full-reset-search)
(up-set-target-point unit-flare-point-x)
(up-filter-distance c: 8 c: -1)
(up-filter-exclude -1 -1 -1 -1)
(up-filter-range -1 -1 -1 -1)
(up-filter-include cmdid-military -1 -1 -1)
(up-find-local c: all-units-class c: 240)
(up-filter-include cmdid-monk -1 -1 -1)
(up-find-local c: all-units-class c: 240)
(up-target-point 0 action-move -1 -1))

~`o~|\  Join the fresh and exciting AI Ladder for its fourth season!
 `  |_\
       |    Learn the joy of AI scripting in my guide: The World of AI Scripting
______|______
 \        /
   .....Hinga Dinga Durgen! - SpongeBob
  `-=<.__.>=-

[This message has been edited by Leif Ericson (edited 07-07-2019 @ 06:50 AM).]

You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames