HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

SetBuildUpgr() ignored in script

02-07-2003, 05:13 PM#1
Guest
I've started playing with the AI so I can augment the malee AI in the game to hopefully put more 'I' in the AI. However, there seems to be some functions that are ignored. I'm sure it's something simple I have overlooked somewhere but I'll be darned if I can see it ATM.

As a test, I made a campaign map with 1 human opponent for testing. I have set up waves of invassions for them much like the undead08 campaign AI does. However, everything works fine until it encounters the SetBuildUpgr() function. It just seems to ignore it... any suggestions?

Here is what I have for the first wave... works fine except no upgrades happen:

call CampaignAI(HOUSE,null)

set do_campaign_farms = false
call SetCaptainHome(ATTACK_CAPTAIN,50,500)

call SetBuildUnit( 0, TOWN_HALL )
call SetBuildUnit( 2, PEASANT )
call SetBuildUnit( 3, BARRACKS )
call SetBuildUnit( 1, LUMBER_MILL )
call SetBuildUnit( 6, HOUSE )
call SetBuildUnit( 1, BLACKSMITH )
call SetBuildUnit( 5, PEASANT )
call SetBuildUnit( 1, WORKSHOP )
call SetBuildUnit( 1, KEEP )
call SetBuildUnit( 1, HUMAN_ALTAR )
call SetBuildUnit( 1, SANCTUM )
call SetBuildUnit( 1, CASTLE )
call SetBuildUnit( 2, WATCH_TOWER )
call SetBuildUnit( 2, CANNON_TOWER )

// preplaced units
call CampaignDefender (EASY, 2, FOOTMAN )
call CampaignDefender (EASY, 2, RIFLEMAN )
call CampaignDefender (EASY, 1, MTN_KING )

call SetBuildUpgr( 1,UPG_MELEE )
call SetBuildUpgr( 1,UPG_RANGED )
call SetBuildUpgr( 1,UPG_GUN_RANGE)
call SetBuildUpgr( 3,UPG_MASONRY )
call SetBuildUpgr( 1, UPG_SENTINEL)

call WaitForSignal()

set allow_signal_abort = true

//*** WAVE 1 Time 30 seconds ***
call InitAssaultGroup()
call CampaignAttackerEx(2,2,2, FOOTMAN)
call CampaignAttackerEx(1,2,2, RIFLEMAN)
call CampaignAttackerEx(1,1,2, MTN_KING)
call SuicideOnPlayer(30,user)

call SetBuildUpgr( 1, UPG_ARMOR)
call SetBuildUpgr( 1, UPG_LEATHER)

// ****

None of the SetBuildUpgr() functions seem to do anything. The buildings are already there of course and I've made sure ALL tech tree/upgrades are available in the map editor. I'm stumped! :////
02-07-2003, 08:57 PM#2
Guest
ok, well, I figured out the problem. It would seem that the timing of events were wrong. The first upgrades couldn't be initiated in time (cuz the AI was busy making units) when the second set of Upgrades was issued thus cancelling out the initial and current upgrade requests. Somehow I thought they would be queued... but apparently not so in the case where the second upgrade request is encountered before the first could be initiated :////

Works now that I've lessened the load of unit requests to allow time for the initial upgrades to enter the queue. :bgrun:
02-07-2003, 10:22 PM#3
Guest
Just a question why do you have 0 for:
call SetBuildUnit( 0, TOWN_HALL )
?????
That would mean that it wouldn't rebuild the town hall after it is destroyed wouldn't it?
02-07-2003, 10:45 PM#4
Guest
Yeah, that's the intention... there will actually be 3 human settlements in this campaign and there are certain things I don't want them to rebuild... sort of like, if you find out what to destroy in that particular settlement, you have an edge on winning. There are a few of the WC3 campaigns that implement these little "secrets" where if you hit certain buildings, they won't rebuild them... so it gives you a winning edge if you find them out... so I'm trying to implement some of those things as well.

Also, you'll probably notice a few other oddities in that script... I'm testing each function to see what exactly the outcome will be so as I posted it, there were some values I was testing for limits as well. Guess I should have revert it before posting :bgrun:
02-07-2003, 10:51 PM#5
Guest
Ok I just started ai script writing a few days ago I have.. a question... when you use call SuicideOnPlayer(30,user) does that 30 mean the seconds after the signal to attack was called?
02-08-2003, 12:08 AM#6
Guest
Quote:
Originally posted by Chill_88
Ok I just started ai script writing a few days ago I have.. a question... when you use call SuicideOnPlayer(30,user) does that 30 mean the seconds after the signal to attack was called?


Yes, I believe (in my observations) that it means:
Conduct suicide on Player in 30 seconds

Or whatever time you put in there.... there are constants defined for minutes M1,M2, M3, etc...

However, I do believe it depends on whether the attack force can be successfully assembled within that time period, otherwise, the attack will occur at the time the force is assembled.

Just my observations

I too only started playing with WC3 scripts a few days ago so I wouldn't bet my life on those observations just yet, which is why I'm testing what happens when these functions are called and documenting them. However, I am a programmer by trade so getting familiar with the language wasn't such a learning curve but rather the game structure was/is.