Using custom AIs in a mod

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
Scoryth
Posts: 11
Joined: Wed Oct 07, 2009 9:52 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Using custom AIs in a mod

Postby Scoryth » Wed Oct 07, 2009 9:56 pm

I'm creating a mod that adds new units to each race in a sort of "faction" style format. Like if you pick Terran you can have one of three different types of SCVs depending on what faction you choose. Anyway, I want to make an AI that is just as strong as the normal "Insane" AI, but I want it to support the customized units. Is this possible, and how do I go about doing it? The names of the units will be different, so I'm worried that the AI won't understand. Does my question make sense and is this possible? Thanks.
Equalizer
Posts: 83
Joined: Wed Sep 23, 2009 3:49 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Equalizer » Wed Oct 07, 2009 10:54 pm

The ai uses a unit code that represents the each unit (the names in ai editors is just from the editor translating the unit codes so that it's legible).

Assuming that you are modifying pre-existing units, to the ai they can be addressed the same as before from what I understand.

I don't know a lot about mods but if you were to create a new unit that didn't exist before (I'm not sure if this is even possible) then the ai would have no way to address the unit because the new unit wouldn't have any unit code that the ai knows about. However the unitdef.* of ai editors can be modified to support units that normally the ai can't handle (ex. heroes), so perhaps something similar could work for a mod that introduced units that don't exist normally.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby IskatuMesk » Thu Oct 08, 2009 10:47 pm

You can't add totally new units or anything like that to Starcraft.

There's a txt file in the base directory of the AI editor that contains the id listing of all of the units. Copy those into your unitdef.txt (iirc that's what it's called, anyway), and name them appropriately. Then reference them in sc. As long as the race flags are set correctly in units.dat and they have requirements in firegraft, you're good to go.
Symmetry
Posts: 78
Joined: Mon May 07, 2007 10:57 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Symmetry » Thu Oct 08, 2009 11:16 pm

It's an .ini file, not a .txt file (edit it as you would a .txt though).
Scoryth
Posts: 11
Joined: Wed Oct 07, 2009 9:52 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Scoryth » Sun Oct 25, 2009 1:25 pm

Well when I say I'm adding new units, I'm basically moving units around. For example, I'm making three different Goliaths, and I'm putting the two "new" ones in place of the Siege Tank (Siege Mode) and Wraith. Will that still work?
User avatar
poiuy_qwert
Posts: 548
Joined: Sun Jan 13, 2008 2:14 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby poiuy_qwert » Sun Oct 25, 2009 5:26 pm

[quote name='Symmetry' post='7700' date='Oct 8 2009, 07:16 PM']It's an .ini file, not a .txt file (edit it as you would a .txt though).[/quote]
For SCAIEdit thats true, PyAI just uses a txt file.

The only thing you have to be aware of when adding new units is spells (and some special abilities). Only the units that originally had the spell will use it. So if you made copies of the ghost only the original ghost will use its spells, the duplicates will only attack.

Also PyAI has advanced errors and warnings that work with mods if you go into the settings and load your .dat files.
Scoryth
Posts: 11
Joined: Wed Oct 07, 2009 9:52 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Scoryth » Sun Oct 25, 2009 6:54 pm

Okay, I don't know if I need to make a new thread for this or not. If so, I apologize for misposting. Anyway, I am a VERY raw noob at scripting. I started from scratch using a template to understand the jargon, but I wrote a very short script.

The object of the script is for the AI to build 5 SCVs, then build a Barracks and train 3 Marines. I used the Astral Balance map and added a Command Center, 4 SCVs, 75 minerals, and the script with location to the map, then saved and ran it. The AI only mines with the 4 SCVs and does nothing else. What is wrong?

; ASC3 File generated by ScAIEdit III
;
; Script name : Terran Custom Level

script_name Terran Custom Level
script_id TMCu

start_campaign
wait 1

start_town
defaultbuild_off
default_min 0
wait 1

build 1 command_center 150
build 5 scv 80
wait_buildstart 5 scv
build 1 barracks 80
wait_build 1 barracks
train 3 glancer

:loop
wait 1500

goto loop

The "glancer" is the command line used for the Marine. "Lancer" is the Marine name in my mod.
User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Archon_Wing » Sun Oct 25, 2009 6:56 pm

Scoryth
Posts: 11
Joined: Wed Oct 07, 2009 9:52 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Scoryth » Sun Oct 25, 2009 7:22 pm

Why would that make a difference? I modified the script flag to run in BW.
User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Archon_Wing » Sun Oct 25, 2009 7:26 pm

Oh I don't know, just checking if you have the right script selected for your map.

You can try posting your edited map and exe, so people can see exactly what's wrong. There's really nothing wrong with that script.

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 1 guest