wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > JASS/AI scripts tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-15-2010, 01:34 AM   #61
SHAƎDY
User
 
Join Date: Apr 2010
Posts: 14

SHAƎDY has little to show at this moment (0)

Default

I always thought that this tutorial should use BJDebugMsg() instead of DisplayTextToForce().
SHAƎDY is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-23-2011, 02:42 PM   #62
WarriorRos
User
 
Join Date: Mar 2011
Posts: 2

WarriorRos has little to show at this moment (0)

Default

Q: i want the AI to attack a unit, so 4 example a put:
call AttackMoveKillA ('o00N:otrb') --> code of my custom unit
but then, i want the AI to keep attackin the player after the unit is dead, how can i do that?

an other thing: i've use ur method to make an ai. Just like urs but with humans, and is rare cause one player
seems fine, it gather gold, but don't attack
and the other, with the SAME ai, but with changed attack groups, don't even move :S
what is wrong? i leave here the code
(I leave in the code ur comments to guide me, maybe thats it)

globals
// We put the globals variables here
player MyVictim = Player(1)
endglobals

function ConfigureAI takes nothing returns nothing
call SetSlowChopping( true ) //AI will do a normal harvesting
call SetPeonsRepair( true ) //AI will repair damaged structures
call SetTargetHeroes( true )
endfunction

function hero_levels takes nothing returns integer
local integer hero = GetHeroId()
local integer level = GetHeroLevelAI()
local integer a = 0
if hero == PALADIN then
if level == 1 or level == 3 or level == 5 then
set a = HOLY_BOLT
endif
if level == 2 or level == 4 or level == 7 then
set a = DEVOTION_AURA
endif
if level >= 8 or level == 9 or level == 10 then
set a = DIVINE_SHIELD
endif
if level == 6 then
set a = RESURRECTION
endif
endif
return a
endfunction

function main takes nothing returns nothing
// Tier 1 Buildings
call SetBuildUnitEx( 1, 1, 1, TOWN_HALL ) // <==(1)
call SetBuildUnit( 15, PEASANT )
call SetBuildUnitEx( 1, 2, 3, HOUSE )
call SetBuildUnitEx( 1, 1, 2, BARRACKS )
call SetBuildUnit( 1, HUMAN_ALTAR )
call SetBuildUnit( 1, BLACKSMITH )
call CampaignDefenderEx( 3, 3, 4, FOOTMAN ) // <==(2)
call CampaignDefenderEx( 2, 2, 2, RIFLEMAN )
call CampaignDefenderEx( 1, 2, 4, GUARD_TOWER )

// Tier 2 buildings
call SetBuildUnit( 1, KEEP )
call SetBuildUnitEx( 1, 1, 2, WORKSHOP )
// Tier 3 buildings
call SetBuildUnit( 1, CASTLE )
call SetBuildUnitEx( 0, 1, 1, AVIARY )
// Extra
call SetReplacements(1, 2, 3)
// **********************************
// * End Building Strategy *
// **********************************

// **********************************
// * Attack Strategy *
// **********************************
//*** WAVE 1 ***
call InitAssaultGroup() // <==(1)
call CampaignAttackerEx( 1, 1, 2, FOOTMAN ) // <==(2)
call CampaignAttackerEx( 1, 1, 2, PRIEST )
call SuicideOnPlayerEx( M3, M2, M2, MyVictim ) // <==(3)
//*** Basic upgrades from BlackSmith ***
call SetBuildUpgrEx( 1, 1, 1, UPG_MELEE )
call SetBuildUpgrEx( 1, 2, 2, UPG_RANGED )
call SetBuildUpgrEx( 0, 1, 1, UPG_DEFEND )

//*** WAVE 2 *** Between 2 or 3 minutes after Wave 1
call InitAssaultGroup()
call CampaignAttackerEx( 3, 4, 4, FOOTMAN )
call CampaignAttackerEx( 1, 2, 3, RIFLEMAN )
call SuicideOnPlayerEx( M3, M2, M2, MyVictim )
//*** Defend Upg for easy mode
call SetBuildUpgrEx( 1, 1, 1, UPG_DEFEND )

//*** WAVE 3 *** Between 2 or 3 minutes after Wave 2
call InitAssaultGroup()
call CampaignAttackerEx( 4, 4, 5, FOOTMAN )
call CampaignAttackerEx( 1, 2, 4, RIFLEMAN )
call CampaignAttackerEx( 1, 1, 1, 'hcth' )
call SuicideOnPlayerEx( M3, M2, M2, MyVictim )
//*** WAVE 4 *** Between 2 or 3 minutes after Wave 3
call InitAssaultGroup()
call CampaignAttackerEx( 3, 4, 4, FOOTMAN )
call CampaignAttackerEx( 1, 2, 4, RIFLEMAN )
call CampaignAttackerEx( 1, 1, 2, 'hcth' )
call CampaignAttackerEx( 1, 1, 1, TANK )
call SuicideOnPlayerEx( M3, M2, M2, MyVictim )
//*** Medium Upg
call SetBuildUpgrEx( 0, 1, 2, UPG_SORCERY )
call SetBuildUpgrEx( 1, 1, 3, UPG_LEATHER )
call SetBuildUpgrEx( 1, 2, 3, UPG_ARMOR )
//*** WAVE 5 *** Between 3 or 4 minutes after Wave 4
call InitAssaultGroup()
call CampaignAttackerEx( 3, 3, 3, FOOTMAN )
call CampaignAttackerEx( 1, 1, 1, RIFLEMAN )
call CampaignAttackerEx( 1, 1, 1, PALADIN )
call CampaignAttackerEx( 0, 1, 1, KNIGHT )
call CampaignAttackerEx( 1, 1, 2, TANK )
call SuicideOnPlayerEx( M4, M3, M3, MyVictim )
//*** Priest Upg
call SetBuildUpgrEx( 0, 1, 2, UPG_PRAYING )
//*** WAVE 6 *** Between 3 or 4 minutes after Wave 5
call InitAssaultGroup()
call CampaignAttackerEx( 2, 2, 2, RIFLEMAN )
call CampaignAttackerEx( 1, 1, 1, PALADIN )
call CampaignAttackerEx( 1, 2, 2, KNIGHT )
call CampaignAttackerEx( 0, 1, 1, 'hcth' )
call SuicideOnPlayerEx( M4, M3, M3, MyVictim )
//*** Ultimate Upg
call SetBuildUpgrEx( 0, 0, 1, UPG_ARTILLERY )
call SetBuildUpgrEx( 1, 2, 2, UPG_TANK )
call SetBuildUpgrEx( 0, 2, 3, UPG_MASONRY )
call SetBuildUpgrEx( 0, 1, 1, UPG_BREEDING )
call SetBuildUpgrEx( 0, 0, 1, UPG_GUN_RANGE )

loop //Init the infinite attack loop
//*** WAVE 7 *** Between 3 or 5 minutes after Wave 6
call InitAssaultGroup()
call CampaignAttackerEx( 2, 2, 2, FOOTMAN )
call CampaignAttackerEx( 1, 1, 1, PALADIN )
call CampaignAttackerEx( 1, 1, 1, 'hcth' )
call CampaignAttackerEx( 1, 1, 2, RIFLEMAN )
call CampaignAttackerEx( 0, 1, 2, KNIGHT )
call CampaignAttackerEx( 1, 1, 2, TANK )
call SuicideOnPlayerEx( M5, M4, M4, MyVictim )
//*** WAVE 8 *** Between 3 or 5 minutes after Wave 7
call InitAssaultGroup()
call CampaignAttackerEx( 2, 2, 2, KNIGHT )
call CampaignAttackerEx( 1, 1, 1, PALADIN )
call CampaignAttackerEx( 1, 1, 1, TANK )
call CampaignAttackerEx( 1, 2, 3, RIFLEMAN )
//*** WAVE 9 *** Between 4 or 6 minutes after Wave 8
call InitAssaultGroup()
call CampaignAttackerEx( 2, 2, 2, FOOTMAN )
call CampaignAttackerEx( 1, 1, 1, PALADIN )
call CampaignAttackerEx( 1, 1, 1, TANK )
call CampaignAttackerEx( 1, 2, 3, KNIGHT )
call CampaignAttackerEx( 0, 1, 2, RIFLEMAN )
call CampaignAttackerEx( 1, 1, 2, 'hcth' )
call SuicideOnPlayerEx( M6, M5, M4, MyVictim )
endloop
// **********************************
// * Attack Strategy never ends *
// **********************************

endfunction


An other Q: how can I make the AI to attack a destructible?

all of this is because im making a map where a city of tauren is attack by a legion of humans, and the objective of the humans is to destroy the DOOR 1st, then keep atakin to destroy the base of the taurens.

Last edited by WarriorRos : 03-24-2011 at 12:41 PM.
WarriorRos is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 07:04 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services