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 > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-06-2009, 12:08 PM   #1
daPanda
User
 
Join Date: Jan 2009
Posts: 28

daPanda has little to show at this moment (0)

Default How to determine what units are sold at goblin lab?

There seems to be a lot of threads on how to add/remove units for sale, but how do you check what units are available for sale at the Goblin Laboratory at run-time?

More info: Some of my maps don't sell the zeppelin, and I want my AI to check whether the zeppelin is for sale or not, and if it is not available, not to bother going all the way to the goblin lab to buy one.
daPanda is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-06-2009, 12:44 PM   #2
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Can't think of much, for example , you could basically use the NeutralOrder native and bruteforce to see if it returns 0 for a certain unit id, but this method is a little sucky, if there are cooldowns.

Since you can't dynamically add units to buildings, I think the only way is to tweak your AI so there is a manually-set constant that determines if the building can train a certain unit.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-06-2009, 02:43 PM   #3
xombie
Banned
 
Join Date: Oct 2006
Posts: 858

xombie has a spectacular aura about (79)xombie has a spectacular aura about (79)xombie has a spectacular aura about (79)

Default

Quote:
Originally Posted by daPanda
There seems to be a lot of threads on how to add/remove units for sale, but how do you check what units are available for sale at the Goblin Laboratory at run-time?

You could physically check the object editor (covers map initialization) and record what units are added/removed from the Goblin Laboratory in-game. I don't know, just spreadin' ideas.
xombie is offline   Reply With Quote
Old 03-07-2009, 10:32 AM   #4
daPanda
User
 
Join Date: Jan 2009
Posts: 28

daPanda has little to show at this moment (0)

Default

Thanks for the ideas, guys.
Part of the problem is that this is an .ai file to replace the default melee AI to fix a number of blizzard bugs (such as Random Hero, Relative costs, GetEnemyExpansion(), etc) and to make the AI act more human-like. So I'm not sure from where I would access that info since types and functions are limited in .ai files.

So the problem I am at right now is that when the ai go to buy a zep and there isn't any to buy, they will keep going back until they obtain the requested amount specified elsewhere in the .ai file (2 in this case). I was hoping to make it work on any melee map and just 'somehow' check if the unit is even available for sale (either no slot, or cooldown, doesn't matter really).

I would have thought SellUnits would be defined and accessible "somewhere" to test if 'ngad' was an defined unit :(

The generic AI is pretty much done, and there are only a few things left to work out such as the zep purchase. So close, now yet so far :\

I was hoping to make this into somewhat of a tutorial on how to write generic melee AI using vJass where most of the underlying melee AI work is done for you, then all is left is for the user to write the race specific build orders, harvesting, and attack requirements. So far so good, other than these few things left to resolve.

Last edited by daPanda : 03-07-2009 at 10:33 AM.
daPanda is offline   Reply With Quote
Old 03-07-2009, 07:45 PM   #5
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

You can add units\item to shop on runtime without any problems.
if your goblin shop have proper "market skills".

Checking every possible unit is lame, keep data base.
This will be easy if you set units to sell in game, not OE.

Last edited by DioD : 03-07-2009 at 07:46 PM.
DioD is offline   Reply With Quote
Old 03-07-2009, 08:36 PM   #6
xombie
Banned
 
Join Date: Oct 2006
Posts: 858

xombie has a spectacular aura about (79)xombie has a spectacular aura about (79)xombie has a spectacular aura about (79)

Default

daPanda, there is no extremely simple way of doing what you're asking. You might be able to import a .slk table and get the data from there, though I do not know much about SLK editing :S

Edit!

I have been reading up on IssueNeutralImmediateOrder and it seems there are a few conditions.
  • There is a unit within' the range of the specified neutral building.
  • The player who wants to buy it must have an ample amount of gold/lumber.
  • The widget that is going to be bought must be available for the owner (such as a hero's requirement for Altar).
  • The widget must be available at the shop.

You could try 'n use this to detect whether or not the function returns true/false, just make sure that the other conditions are always going to be true, so you know that the returned value is a result of the neutral building not having the desired unit. Since you specified that it is a Goblin Laboratory that you are concerned about you can use IssueNeutralTargetOrder to order the Laboratory to reveal an area, as is available in melee games.

For instance, at map initialization you could try giving Neutral Hostile an indistinguishable amount of gold/lumber and then run through typical buy-able units. I'm pretty sure there are only a few that are available in melee games.

Last edited by xombie : 03-07-2009 at 09:34 PM.
xombie is offline   Reply With Quote
Old 03-08-2009, 07:47 PM   #7
daPanda
User
 
Join Date: Jan 2009
Posts: 28

daPanda has little to show at this moment (0)

Default

Quote:
Originally Posted by DioD
You can add units\item to shop on runtime without any problems.
if your goblin shop have proper "market skills".

Checking every possible unit is lame, keep data base.
This will be easy if you set units to sell in game, not OE.
This has to work on existing melee maps so I can't define what units to sell. I need to determine what units are already for sale. Obviously I would just create a boolean var during initialization to indicate whether the zep was available, if I could find a way to determine this.


xombie,
Thanks for taking the time to look into this further. But the problem is that this would require having a unit type which points to the GobLab itself in order to issue any commands on a unit. From within AI files, ForEach or FirstOfGroup etc do not work and thus I can't use any of the Enum functions to determine if there are any GobLabs on the map, let alone get a unit type handle to one.

Given this has to work in any existing melee map, I can't add any map trigger code either (and trigger code doesn't work in an .ai file).

I'm not sure how SLK files work either, but it sounds like something I may have to look into as my choices are getting pretty slim at the moment. Thanks for the suggestions.
daPanda is offline   Reply With Quote
Old 03-09-2009, 12:08 AM   #8
xombie
Banned
 
Join Date: Oct 2006
Posts: 858

xombie has a spectacular aura about (79)xombie has a spectacular aura about (79)xombie has a spectacular aura about (79)

Default

I was not aware you had to specifically use .ai functions, I thought you were creating the AI with triggers.

Last edited by xombie : 03-09-2009 at 12:09 AM.
xombie 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 08:31 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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