HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making a Computer unit Buy from Tavern?

07-05-2008, 10:09 PM#1
TEC_Ghost
Ok so I'm trying to make a computer but from the tavern, but it won't work and it's getting frustrating.

Collapse JASS:
if (IsPlaying[2] == true) then
set AI_Peon[2] =CreateUnitAtLoc(Player(1),'hpea',Lobby,180)
call SetPlayerStateBJ( Player(1), PLAYER_STATE_RESOURCE_GOLD, 900 )
    if IsAI[2] == true then
    set l=1
    loop
    exitwhen l > 6
        set r = GetRandomInt(1,7)
        call IssueTrainOrderByIdBJ( AI_Peon[2], RandomPick[r] )
        set l=l+1
    endloop
    endif
endif

The RandomPick[r] is an array of all the units integer 'H001' etc.

Am I doing this wrong, does it not work for AI players?

The unit it spawned right next to the tavern.
07-05-2008, 10:23 PM#2
Feroc1ty
i dont believe you train from taverns, i think you buy or something along those lines
07-05-2008, 10:55 PM#3
TEC_Ghost
I tried to use

Collapse JASS:
call IssueNeutralImmediateOrderById( Player(1), gg_unit_n000_0003, RandomPick[r] )

Which is force a Shop to Sell a Unit to A Player. And still nothing...
07-05-2008, 11:00 PM#4
Feroc1ty
is your function IsAI working?
07-05-2008, 11:05 PM#5
TEC_Ghost
Yup, It all works up fine except the Unit wont buy anything...I might just do it the long tedious way and script it cause this isn't working :(
07-05-2008, 11:18 PM#6
Feroc1ty
change the gg_unit_n000_0003 to AI_peon[2], and add a BJDebugMsg to see if the script even gets to the part where unit buys the unit
07-05-2008, 11:53 PM#7
TEC_Ghost
Everything runs fine except the damn thing wont but from the Tavern... I can't even my my own guy buy from the tavern via triggers... I'm gonna make a test map to see if it's anything in my map conflicting.
07-06-2008, 01:39 AM#8
Themerion
First, make sure that you actually can buy units from the tavern (no requirements for the heroes, etc...).

Then do this:

Collapse JASS:
call IssueNeutralImmediateOrderById(buyingPlayer,sellingUnit,'H000')
07-06-2008, 01:41 AM#9
TEC_Ghost
Ya I got it to work on a new map, so something is messing with my trigger. I just went ahead and did a manual unit creation. Thanks guys!