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.5 replies
Age of Kings Heaven » Forums » AI & RM Scripting » Siege Workshop doesnt train some units
Bottom
Topic Subject:Siege Workshop doesnt train some units
Serchant92
Squire
posted 11-30-19 07:05 PM CT (US)         
Im trying to make the AI create Battering Rams, Mangonels and Scorpions thou it only creates Scorpions and Mangonels. No Battering Rams

Im using DE version and no errors popup at the start of the scenario. Also tried using their IDs (35) with no effect

This is the script for the units:

;############Battering Ram###############

(defrule
;(true)
(false)
=>
(set-goal battering-ram-count 0)
(disable-self)
)

(defrule
;(game-time > 1500)
(true)
=>
(set-goal battering-ram-count 3)
(disable-self)
)

(defrule
(goal battering-ram-count 3)
(unit-type-count-total battering-ram-line < 3)
(can-train battering-ram-line)
=>
(train battering-ram-line)
)

;############Scorpion###############

(defrule
;(true)
(false)
=>
(set-goal scorpion-count 0)
(disable-self)
)

(defrule
;(game-time > 1800)
(true)
=>
(set-goal scorpion-count 3)
(disable-self)
)

(defrule
(goal scorpion-count 3)
(unit-type-count-total scorpion-line < 3)
(can-train scorpion-line)
=>
(train scorpion-line)
)

;############Mangonel###############

(defrule
;(true)
(false)
=>
(set-goal mangonel-count 0)
(disable-self)
)

(defrule
;(game-time > 2100)
(true)
=>
(set-goal mangonel-count 2)
(disable-self)
)

(defrule
(goal mangonel-count 2)
(unit-type-count-total mangonel-line < 2)
(can-train mangonel-line)
=>
(train mangonel-line)
)

-----------------
AuthorReplies:
Leif Ericson
Seraph Emeritus
posted 11-30-19 11:03 PM CT (US)     1 / 5       
I just tested it, and this code works for me.

By the way, I found that restarting the scenario didn't actually update the AI code whenever I made any changes. This is a DE bug. I had to quit the scenario, go back to the editor, and test the scenario again for the scenario to read any AI changes I made. I'd make sure that you open the scenario fresh and see if your code now works.

If not, then there is probably something wrong with your goals. Do you change the battering-ram-count goal anywhere else in your AI? Also, what's the goal number for battering-ram-count? Do any other goals have the same goal number?

~`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
  `-=<.__.>=-
Serchant92
Squire
posted 12-04-19 09:19 AM CT (US)     2 / 5       
Restarting the scenario didnt work.


The goal number is 35, no other goals have the same id. Also tried goal number 350 and still doesnt work

Tried also replacing the battering-ram-line with the id of the unit (35) and the unit class but with no effect

[This message has been edited by Serchant92 (edited 12-04-2019 @ 09:20 AM).]

Leif Ericson
Seraph Emeritus
posted 12-04-19 01:08 PM CT (US)     3 / 5       
Email me the script and scenario, and I'll take a look. My email should be in my profile.

~`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
  `-=<.__.>=-
Leif Ericson
Seraph Emeritus
posted 12-04-19 05:15 PM CT (US)     4 / 5       
The version of the AI that you sent me doesn't match what you pasted in the first post. Below is what you sent me. You'll notice that a large amount of game time must pass (25 to 35 minutes) before the AI will set the goal to a number greater than zero. Once the time was reached, the AI started training siege units.

(defrule
(true)
;(false)
=>
(set-goal battering-ram-count 0)
(disable-self)
)

(defrule
(game-time > 1500)
(true)
=>
(set-goal battering-ram-count 3)
(disable-self)
)

(defrule
(goal battering-ram-count 3)
(unit-type-count-total battering-ram-line < 3)
; (unit-type-count-total -291 < 3)
; (can-train battering-ram-line)
(can-train 35)
; (can-train -291)
=>
; (train battering-ram-line)
(train 35)
; (train -291)
)

;############Scorpion###############

(defrule
(true)
;(false)
=>
(set-goal scorpion-count 0)
(disable-self)
)

(defrule
(game-time > 1800)
(true)
=>
(set-goal scorpion-count 3)
(disable-self)
)

(defrule
(goal scorpion-count 3)
(unit-type-count-total scorpion-line < 3)
(can-train scorpion-line)
=>
(train scorpion-line)
)

;############Mangonel###############

(defrule
(true)
;(false)
=>
(set-goal mangonel-count 0)
(disable-self)
)

(defrule
(game-time > 2100)
(true)
=>
(set-goal mangonel-count 2)
(disable-self)
)

(defrule
(goal mangonel-count 2)
(unit-type-count-total mangonel-line < 2)
(can-train mangonel-line)
=>
(train mangonel-line)
)

~`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
  `-=<.__.>=-
Serchant92
Squire
posted 12-04-19 07:47 PM CT (US)     5 / 5       
True, ive been testing some stuff while further designing my scenario.

Thing is the AI is training already Scorpions and Mangonels, while it already should have been training Rams already.

Maybe its cause of the goal ids that exceeded the goal number limit that may cause some bugs.. Ill try to update the ai file tomorrow and keep you updated
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames