[AI] Help!!!!!

Level 4
Joined
Apr 3, 2004
Messages
19
I've made an Ai ,in Jass Editor, for my campaign for ,Player 2 Blue - Blood elf, but it don't work what is wrong on it???
-------------------------------------
globals
player user = PlayerEx(3)
endglobals

function main takes nothing returns nothing
call CampaingAI(ELF_FARM,null)

call SetWoodPeons = 2
call SetGoldPeons = 3

call SetReplacements(0,2,3)

call SetBuildUnitEx(0,0,1, TOWN_HALL)
call SetBuildUnitEx(0,1,2, ELF_HIGH_BARRACKS)
call SetBuildUnitEx(0,3,6, HOUSE)
call SetBuildUnitEx(0,0,2, LUMBER_MILL)
call SetBuildUnitEx(0,0,1, HUMAN_ALTAR)
call SetBuildUnitEx(0,0,1, BLACKSMITH)
call SetBuildUnitEx(0,0,1, SANCTUM)
call SetBuildUnitEx(0,0,1, KEEP)
call SetBuildUnitEx(0,0,1, CASTLE)

call CampaignDefenderEx( 1,1,1, SPELL_BREAKER )
call CampaignDefenderEx( 1,1,2, HIGH_SWORDMAN )
call CampaignDefenderEx( 0,0,1, SORCERESS )
call CampaignDefenderEx( 1,1,1, PRIEST )
call CampaignDefenderEx( 1,1,2, HIGH_ARCHER )

call WaitForSignal()


//*** WAVE 1 ***
call InitAssaultGroup()
call CampaignAttackerEx( 3,3,5, HIGH_SWORDMAN )
call CampaignAttackerEx( 2,2,3, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call SuicideOnPlayerEx(M4,M3,M3,user)

//*** WAVE 2 ***
call InitAssaultGroup()
call CampaignAttackerEx( 2,3,4, SPELL_BREAKER )
call CampaignAttackerEx( 2,2,3, HIGH_ARCHER )
call SuicideOnPlayerEx(M6,M4,M5,user)

//*** WAVE 3 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, HIGH_SWORDMAN )
call CampaignAttackerEx( 1,1,2, PRIEST )
call CampaignAttackerEx( 1,1,3, SPELL_BREAKER )
call SuicideOnPlayerEx(M5,M4,M5,user)

//*** WAVE 4 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,1,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call SuicideOnPlayerEx(M4,M4,M2,user)


//*** WAVE 5 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,0,2, HIGH_ARCHER )
call CampaignAttackerEx( 2,2,4, SORCERESS )
call SuicideOnPlayerEx(M6,M5,M7,user)

//*** WAVE 6 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, HIGH_SWORDMAN )
call CampaignAttackerEx( 2,2,4, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,2, PRIEST )
call SuicideOnPlayerEx(M6,M6,M7,user)

//*** WAVE 7 ***
call InitAssaultGroup()
call CampaignAttackerEx( 2,3,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,1,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call CampaignAttackerEx( 1,2,3, SORCERESS )
call SuicideOnPlayerEx(M7,M5,M6,user)

//*** WAVE 8 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,4, HIGH_SWORDMAN )
call CampaignAttackerEx( 2,2,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,2, PRIEST )
call SuicideOnPlayerEx(M8,M8,M3,user)

//*** WAVE 9 ***
call InitAssaultGroup()
call CampaignAttackerEx( 2,3,4, SPELL_BREAKER )
call CampaignAttackerEx( 2,2,3, HIGH_SWORDMAN )
call CampaignAttackerEx( 0,1,2, HIGH_ARCHER )
call SuicideOnPlayerEx(M8,M7,M7,user)

//*** WAVE 10 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,0,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call SuicideOnPlayerEx(M4,M4,M6,user)

//*** WAVE 11 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, HIGH_SWORDMAN )
call CampaignAttackerEx( 2,2,4, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,2, PRIEST )
call SuicideOnPlayerEx(M7,M7,M7,user)

//*** WAVE 12 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,0,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call SuicideOnPlayerEx(M8,M8,M3,user)

loop
//*** WAVE 13 ***
call InitAssaultGroup()
call CampaignAttackerEx( 1,2,4, HIGH_SWORDMAN )
call CampaignAttackerEx( 2,2,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,2, PRIEST )
call CampaignAttackerEx( 1,1,2, SORCERESS )
call SuicideOnPlayerEx(M5,M4,M3,user)

//*** WAVE 14 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,4, HIGH_SWORDMAN )
call CampaignAttackerEx( 1,2,3, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, PRIEST )
call CampaignAttackerEx( 1,1,2, SORCERESS )
call SuicideOnPlayerEx(M6,M4,M4,user)

//*** WAVE 15 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,0,2, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call CampaignAttackerEx( 2,2,4, SORCERESS )
call SuicideOnPlayerEx(M8,M6,M6,user)

//*** WAVE 16 ***
call InitAssaultGroup()
call CampaignAttackerEx( 4,4,6, SPELL_BREAKER )
call CampaignAttackerEx( 0,2,3, HIGH_ARCHER )
call CampaignAttackerEx( 1,1,1, BALLISTA )
call CampaignAttackerEx( 2,2,4, SORCERESS )
call SuicideOnPlayerEx(M8,M5,M4,user)
endloop
endfunction
--------------------------------------------
 
Level 6
Joined
Jun 16, 2004
Messages
237
I'm pretty sure that the two lines I pointed out aren't correct. I can't understand your code very well, because you use many non-native functions. Uh, and what are M-variables in SuicideOnPlayer function calls?

call SuicideOnPlayerEx(M4,M3,M3,user)

You also have your user variable wrong. Player 2 is Player(1), not Player(3). I suggest that you use InitAI() and then use ai_player variable to refer to the player in question. Or you may set:

player user = Player(GetAiPlayer())
 
Level 6
Joined
Jun 16, 2004
Messages
237
Have you tried debugging it? Insert DisplayTimedTextToPlayer calls here and there and try to figure out what's the problem.

First, add "Hello World" at the start of the function main and see if the script starts at all.
 
Level 2
Joined
Sep 4, 2004
Messages
30
M variables mean "minute" - M6 means 6 minutes.
(That's defined in common.ai.)

player user is NOT GetAIPlayer! "user" is the player
he wants to attack! There is no function to
determine that, u must set it manualy.
So "player user=Player(0)" means Player 1(Red) is
the user on this map. Computer will attack him.

The two lines u wrote are really not correct,
'cause SetWoodPeon is a FUNCTION!
So "call SetWoodPeons(2)" is the sollution.

DEATH is written so, not deaht :)
 
Level 4
Joined
Apr 3, 2004
Messages
19
Thanks for the help tommy and fury, I have made the modifications but it appears that when an AI don't want to work it simple don't work, this Ai is going to make me crazy!!!!!!!!!!!

Please don't pay attention in my english, as you can see in the location i'm from South America, the english i leran was in WC3 :lol: .
 
Level 2
Joined
Sep 4, 2004
Messages
30
Did you checked it with jass syntax checker demo?
If it had a syntax error what was it?
If it had not what is what it does not when you play it?
You have to write your problem detailed else we cant help you!
 
Level 2
Joined
Sep 4, 2004
Messages
30
Yeah, it's just A LITTLE BIT overcomlicated.
A 'campaign AI' can be done much easier.
You tried to make a 'melee mix campaign AI',
and it's far too long and lots of unnessesary
stuff. I would rewrite it if I were you.
(But I'm not so you decide :wink: )
 
Level 2
Joined
Sep 4, 2004
Messages
30
I think you saw already some campaign AIs that were used in RoC or TFT, so I dont understand why u dont use their style. The 'call CampaignAI(ZIGGURAT_1,null)' function does every production things for you. You just have to set the waves with CampaignAttackerEx and thats all. I thing this way the file would be only half long.

Campaign maps have the following attributes:
- Computer players have a big preplaced base.
- They have preset heroes with levels appropriate to the game difficulty.
- They have infinite resources.
- They do suicide attacks, mean nobody retreats.

I dont know why Malbion couldnt have any of these above. And 'All waves 60 food' is also unnecessary.
If you look at RoC orc last map: the Warsong Clan 'is' 3 players with same colors and names! The foodcost of units is reduced so they dont have to build endless burrows. Because this is unimportant stuff. It is not a melee map, it is a campaign! Only the challenge counts!

I hope you dont misunderstand my piont. :wink:
 
Level 6
Joined
Jun 16, 2004
Messages
237
I see your point... But I'm a balance freak and want to do everything the way as if it were melee. :roll: Otherwise it feels like lazy work (or cheating)... It was fun to create more and more effective undead waves, just based on unit composition. I played undead back in the days of RoC... :wink:

Edit: Originally, the style of the AI stems from the fact that I started it by modifying a custom melee AI created by the AI editor over a year ago.
 
Level 2
Joined
Sep 4, 2004
Messages
30
I know I read it 8)

Chaos Orcs have nothing to do with balance, so this cannot be done with every map. Archimonde and the Pit Lord of the last map are also unbalanced, but this makes them more fun. The Pit Lord at least :) Archimonde is way too strong.
CPU never plays as good as a 'medium' player (maybe on insane - I never played that much), so it needs a bonus advantage. For example level 10 heroes at start in a campaign, but in melee also maybe +20% experience?
I played the unpatched version of your map, and it wasnt very difficult(but fun anyway :) ). I always play normal first to get the story, but then I NEED the hard to make the game fun for the second time too.
 
Level 6
Joined
Jun 16, 2004
Messages
237
For a melee game, Archimonde is of course too strong, but I think storywise, he is too weak. Only 4250 hit points? 42500 hit points would have been more appropriate for the commander of the burning legion... something like that should be expected from a demon lord that can destroy Dalaran with one terrible spell.

Rain of Chaos had a good touch, but Finger of Death was plain horrible.
 
Level 2
Joined
Sep 4, 2004
Messages
30
Not only hit points count! A Mountain Giant in not stronger than any hero! And Archimonde has divine armor which reduces any damage except chaos to 5%, this multiplicates his life to 20 times! And he has 3 life reg as base - this means truly 3x20=60! And besides this game is about spells, if a hero cant cast its spells then its not more worth than an abo for example. Dark Portal creates only a few units but they are permanent and dont use any food. Rain of Chaos look really good, and Bash to a ranged unit is quite unbalanced. Finger of Death damages buildings and units with spell immunity, but it has a too long cooldown.
Archimonde is only one of the two leaders. To destroy a city is easy - Earthquake :). And to be the strongest does not mean he is invincible. He has a lot of power but also a lot of servants, (like real life bosses) who do the dirty jobs for him. Even Sargeras was defeated and he was a titan not a mere eredar!

Doing balance is ok (i do it too), but in a campaign ist just a waste of time. You work more but the result wont be better. You could spend the time to make the next map :)
 
Level 6
Joined
Jun 16, 2004
Messages
237
I think that Sargeras's killing was lame. Hey come on... Aegwynn just cast one spell that killed the dark god. I would have expected something better than a single deathblow. And what Sargeras possibly thought to achieve by infesting Medivh?

(Or maybe then Khadgar's visions weren't entirely accurate.)
 
Level 6
Joined
Jun 16, 2004
Messages
237
Fury said:
I played the unpatched version of your map, and it wasnt very difficult(but fun anyway :) ). I always play normal first to get the story, but then I NEED the hard to make the game fun for the second time too.
Try the latest version on Champion difficulty (available in the stand-alone version). You need some real skills to beat it. =) Not recommended for the faint of heart.
 
Level 2
Joined
Sep 4, 2004
Messages
30
A played the unpathed because I never ever install any blizz patches because they really suck - and on purpose! Blizzard makes them wrong on purpose and I hate them for that. So if the new one doesnt run on 1.07 then I cant play it.
(I play diablo even without the exp because they messed up the entire item system. Not to mention the loads of unfixed bugs.)

Medivh was the last guardian! The strongest mage in the world. Sargaeras wanted his body but couldnt control it entirely, he still managed to open the portals from Draenor. If he had succeeded he could have taken the worldtrees energy. OFF: Chaos Orcs beat NE up like hell!

PS: What's if a mod is double-posting ? :)
 
Level 6
Joined
Jun 16, 2004
Messages
237
Fury said:
A played the unpathed because I never ever install any blizz patches because they really suck - and on purpose! Blizzard makes them wrong on purpose and I hate them for that. So if the new one doesnt run on 1.07 then I cant play it.
You are so conservative! :wink: That's called balancing. They do good stuff too. I was surprised to see that Animate Dead is nowadays only 175 mana when it used to be 300.

Fury said:
Medivh was the last guardian! The strongest mage in the world. Sargaeras wanted his body but couldnt control it entirely, he still managed to open the portals from Draenor. If he had succeeded he could have taken the worldtrees energy. OFF: Chaos Orcs beat NE up like hell!
Actually, Medivh hadn't born yet, but I guess Sargeras somehow saw what he would become. But it was a poor plot device, if you ask me.
 
Level 2
Joined
Sep 4, 2004
Messages
30
That the 300 mana and 240 sec cooldown were too expensive I knew when I first saw the game. I dont think the beta-testers were too dumb to see this too. This means Blizzard left this (and other bugs) in the game on purpose. I (and anyone else) could have fixed dozens of bugs in the game after the first week I played. (Ok my speciality is debugging :roll: but anyway.) And they reduced the cost of it but changed its meaning by making the units invurnerable. They cannot be attackad and so their lifes are useless. So the units with the most damage (e.g. ranged units) should be revived, but it still revives the units with the most lifes, because the selector was made so and they didnt reconfigured it. Invurnerability is also one thing. I found it very starnge that the paladin could become invurnerable. I always thought they should made it so that it changes his armortype to divine, this way he is well protected but still not invurnerable. The scout could have also be changed with more life beacuse it still has no attack so 1500 life on lvl3 wouldnt be too much. But they are really on the invurnerability-trip. Now even the animated corpses are invurnerabel, vengeance, voodoo and you can buy invurnerability potions at the merchants.

Other example: starfall 200 mana 1125 damage per unit in a 900 circle. Death and Decay 250 mana 4% damage in a very small area. Both channel. Where is balance here? (Blizzard lvl3: 500 damage for 75 mana in 10 seconds.)

And that spells with req above level 2 ignore Spell Immunity? Infernal meteor still DOES NOT damage dryads when falling down!!! But starfall damages infernals and spell breakers too :evil: . So 'balance' and 'Blizzard' have nothing to do with each other!

I agree that Sargearas had not many choices, but he knew that the son of the most powerful sorceress would be also quite powerful. And when he takes over control, his main enemy will already be dead.
'Evil is never defeated it only goes to sleep for awile.' (Or sometihng like that :) )
 
Level 6
Joined
Jun 16, 2004
Messages
237
We had done good job hijacking the thread so far. But I guess it's ok for a forum that otherwise gets one post in two weeks. :roll:

Starfall is IMHO, overpowered, anyway you look at it. But I guess Blizzard thought that it should be rather powerful, because the rest of the PotM's abilities are not that great. Owl, cough, owl...

Death and Decay isn't that great (it even damages your own units), and thus I balanced it to 175 mana in City of the Seven Mithril Golems. However, it is surprisingly useful for destroying large units. You can destroy Nameless Ones with it alone. It is also possible to kill the Starspawn with Death and Decay without ever activating Mithril Golems. Thus, it has its uses. Against 5000+ HP units it is very good. :) Such units, of course, do not exist in melee games (maybe some fully upgraded HU townhalls come close).

D&D is, though, 20x more useful than any version of animate dead.
 
Level 2
Joined
Sep 4, 2004
Messages
30
I dont think that potm is a weak unit without starfall. SA deals 300 damage for 80 mana, thats not bad, and +30% damage to all units except druid ot the claw is also good. And easy to use beacuse u set SA to auto and beacuse she is ranged u dont even need much micro.

Besides D&D damages Paladin with divine shield! :D (what a bug)

Off: could you please moderate sarooooo?

Can I ask you a favour?
Could you check my 'The Scourge.ai' and test it a bit. Some tips for making it better would be nice.
 
Level 2
Joined
Sep 4, 2004
Messages
30
Yes it's a melee AI. The first AI I extracted was the Roc undead, and I improved it in many ways but not like writing new functions instead of the natives like AMAI, just the 'regular' way. I uploaded a version to the site, so you can download it from here.
(I changes some data already but not updated the file :roll:, but it's still nearly the same.)
 
Level 6
Joined
Jun 16, 2004
Messages
237
OK. I looked at the AI script. It seems to me that the unit building strategy seems pretty generic, and perhaps not using the best combos. What combos do you use? Can you explain the idea of the AI's strategies?

And since it is done for 1.07, you've got pretty few people using it...
 
Level 2
Joined
Sep 4, 2004
Messages
30
I wrote 1.07 just as an info. The patch only inserts 2 new neutral heroes and fixes 'thousands' of bugs, but that's all. The AI should work with the patch too, except they changed the techtree of units too much (I didnt checked that out).

The Mephistroth profile uses a generic mix (the advance of the original), in the update it uses more gargs to increase the effect of the DL's VA. The other uses a ghoul and fiend strat that changes with the advance of the techtree to a abo/wyrm strat. It uses a DK to heal these high HP units and a CL to increase the unitcount with his beetles, also good for the DK to heal, and the Lich to recover mana. On larger maps the Lich 'always' has max mana by consuming the beetles which seems very effective. The second profile seems stronger on most maps.

The alone creeping part of the AI is not finished yet, because it should vary with mapsize. The number of frost towers which prevent a rush should also change with the number of allies/enemies/mapsize. I didnt figured out the optimal number for these, yet.

I assume you have the patch, so how worked my AI on your mashine? This would be nice to know, I would write it to the file's comment.
 
Top