2000 - Settenvini Matteo. All rights reserved.
SCM Development Center

MENU
-- DOODADS
-- TRIGGERS AND AISCRIPTS
-- TERRAIN
-- BRIEFING
-- DOWNLOADS
-- FORCES AND UNIT UPGRADES
-- CHAT
-- E-MAIL
END OF MENU

"An overwiev about scripting" --> Back to index

	This is an overview about scripting, it is thinked for advanced
	users and it hasn't been written by me. I'm sure you'll find it
	pretty interesting... CLICK HERE TO READ THE ARTICLE
	Don't read it if you're new in programming, wait to know more 
	about scripting thanks your field-experience.


AI SCRIPTS


Well, most of problems related the use of the Starcraft Campaign Editor are about the use of AI Scripts. The first question a SCM freak must think is:

"What's an AI Script?" --> Back to index
	OK, man, let's explain some things. "AI" is the acronym of Artificial
	Intelligence. In fact, Starcraft moves the units in a missions following a 
	well-thinked plan. So, to contrast your Marines, the computer will create Zergling,
	for example, or, if the AI Script says so, Ultralisk to directly annihilate them.
 	Also, if you create Devourers, that cannot shot air-to-ground, the AI will create
	Dragoon. However, there are different AI Scripts for different situations, so you 
	must chose what do you want to obtain. The better way to use AI S. is mixing different
	of them with different computer players.


"How many types of AI S. there are?" --> Back to index
	Simply too much to know at perfection all of them. In the first version of Sc 
	there where the following:
		- TERRAN AI SCRIPT 'EASY' 
		- TERRAN AI SCRIPT 'MEDIUM'
		- TERRAN AI SCRIPT 'DIFFICULT'
		- TERRAN AI SCRIPT 'CUSTOM'
	Those AI Script there where, and there are, also for Protoss and Zerg. They can
	be find in the 'Run Ai Script at Location' Action Trigger.
	They are with the following:
		- TERRAN AREA TOWN
	Which is used to force the computer player only build SCVs and gather minerals, and 
		- ENTER CLOSEST BUNKER
	which is used to force some unit in a restrict area to enter the nearest bunker 
	(only the terran units, of course). The
		- VALUE THIS AREA HIGHER
	tell a computer player to build units and send them to a location to defend it. 
	However, the computer won't send ALL his unit to this area. You can also make a 
	location on a enemy base to force the computer to attack costantly. And the 
		- SET PLAYER TO ALLY
		- SET PLAYER TO ENEMY
	force a player to become ally or enemy of another. The principal uses of those
	triggers are three:
		// At the beginning, if you want a player to start allied to another,
		   also with a computer player
		// During the battle, with a preserve trigger, to prevent players to 
		   create alliances
		// To make a computer player to combat another computer player. This is 
		   the more interesting way to use it. Well, to do that, place a location
		   called 'Player X start location' over the start location of a computer 
		   player (for ex. the number '2'), and create the following script:
			
			PLAYER: 3  (Attention here to use the correct player!!!)
			CONDITION: 'Always'
			ACTION: 'Run AI Script at Location' Run Ai Script -Set player to 
				enemy- at location -Player 2 (!!!) start location-
		   
		   after it make a trigger like the above changing the number of the two 
		   computer players. If those are both computer players, they will fight
		   one each other! Amazing!



"What about the new AI Scripts?" --> Back to index
	Well, the first interesting AI Script is the INSANE AI SCRIPT one. If 
	you want the complete slaughter of your troops, try it. The second is 
	the Enter in the near transport, or the exit one. Those are best used
	on neutral players to make animations like those in the original Brood 
	War missions. Also, there are the Expansion Ai S. These are studied to
	make the computer build all the new Brood War units and use correct 
	them. If you use a normal Ai Script the Medic, for example, won't be trained. 


"How a 'Campaign AI Script works'? (Make the computer player react)" --> Back to index
	Those triggers are done to let the computer build units and attack.
	They are rigid AI Script: the first attack a terran computer will send 
	you Marines, the second Marines and Firebat, the third Vultures...
	To arrive to build Battlecruisers and, in rare cases, at Nukes. However, a Campaign
	AI Script is written to let you beat the computer, so it isn't so aggressive.
	The Melee AI is done with a CUSTOM AI SCRIPT.
	Here is an example of trigger used to force the computer build and gather
	on a Zerg base.

		The following steps are very important to make a correct trigger.
		//One: place the location over the enemy Start Location! Elsewhere
			your trigger won't work correctly. It's better if over the
			Start Location there is also the Command Center or the Hive or
			the Nexus owned by the computer.
			Do the Location bigger than the start Location, but don't
			forget that it must be centered over the Start L.
		//Two: place some SCVs or Drone or Probe, at least four. Elsewhere
			the computer won't gather and build.
		//Three: never, and, I repeat, never, place the minerals and the 
			Vespene Gayser too near at the base: for a Zerg Base, for
			example, place them out of the creep. And let a little
			space between gas and minerals! 
		//Four: have the minerals surrounding the enemy base, but let some spaces 
			for the enemy units passage.
		//Five: for the Zerg bases, give the computer an Overlord.
	
	Here is a example trigger:
	
		PLAYER: 2 (the computer player. To set a computer player go to the 
			Unit and Upgrades section)
		CONDITION: 'Elapsed time' Elapsed scenario time is -0 or more- seconds
		ACTION:	'Set resources' Set resources to -3000 gas and ore- for -player 2- 
			'Run AI script at Location' Run AI Script -Terran Campaign Difficult-
			at location labeled -Player 2 terran enemy base-

	This will work. I hope. Ah, remember to give the computer players money at 
	start. However, don't do so with the CUSTOM AI SCRIPTS.


"And the AI Scripts without a location?" --> Back to index
	There are a few other AI Scripts which you must know. Those are:
		- SEND ALL UNITS ON STRATEGIC SUICIDE MISSION
		- SEND ALL UNITS ON RANDOM SUICIDE MISSION
		- SWITCH A COMPUTER PLAYER TO RESCUE PASSIVE
	The first trigger send all units, ALSO THE HEROES, to a suicide mission. 
	The SCV will probabily stop gathering and will go to attack your base.
	Also the computer heroes, who are passive also if attacked, will come to
	attack. I used this trigger on a burrowed Zerg hero hidden in a angle map, 
	that has immediately run to my base. Also the second trigger works so, but 
	the SCV or other units can attack their building. It is pretty funny see
	an SCV repairing a Command Center while one another try to destruct it!
	This trigger is interesting if the computer player hasn't other structures.
	But remeber:

		These triggers have a limited time-effect! If you want them to work
		all the time you must use a PRESERVE TRIGGER!
	
	Okay, the third trigger is pretty easy to use. Simply use it, for example, 
	if you want that, finished to destroy the buildings of a player, the other
	unit become rescuable.
		
		Remember to use these triggers selecting the COMPUTER player you want
		to become rescuable or the suiciding one in the	Select Player window if
		there is a time condition!

"What's the difference between Custom AIS. and the Campaign ones?" --> Back to index
	The principal difference is that Custom AI Scripts will work as that of the Melee 
	Maps and the computer will start with the same money as you (or lower, if you set so).
	While the Campaign AI S. are done to permit a human to easily win, a 
	Custom AI S. is much more aggressive. Also, you can't use other triggers 
	than the Custom one for that computer player, like Enter closest bunker, or more 
	Campaign AI S. It is very suggested to provide a lot of resources if
	using the Campaign AI Scripts, like 6000 gas and minerals or more.


"About Teleport : is there a way to force a Recall ability?" --> Back to index
	
	These are the steps to make an arbiter Recall some units with an AI Script. But first, 
	brief introduction. Starcraft programmers haven't permised you to choose some of their 
	AI Scripts, like the Recall Here we're going to examine, but also others less know, 
	like the Junk Yard Dog one (don't ask me what this do ;-) and the Unit Harass Here one.
	So, for us who are eternal unsatisfied Starcraft players, a solution to this hiding
	problem has been discovered. This is the file you can find here.
	Just follow the steps here:

	- Download the "*.trg" file: CLICK HERE.
	- Put this in a directory you can remember
	- Open a new map
	- Select Load Trigger from the Trigger window
	- Select the file NukeHere.trg from the directory you put this into
	- OK, now you have to create a Location for the AI Script. Call it 'Teletransport 1',
	for example
	- Double click on the strange trigger you just loaded
	- First choose the computer player you want. Obiuvsly, it must be a Protoss one.
	  If you want the trigger to function perfectly, you have to create a Computer Player 
	  only for place one Arbiter (remember to create a Start Location for they!) and the 
	  units to transport. In the Conditions use the conditions you want. Use the Actions
	  section of the same trigger to do so, but move they to the top, 'cause this AIS cannot
	  work without Arbiters!
	  In the action change only the Location from '(no location)' to 'Teletransport 1' and
	  activate all the trigger actions and conditions putting a thick near it. Don't touch 
	  any other. Probably you'll want to give the unit recalled to another player. Simply
	  use the - GIVE UNITS TO PLAYER - trigger, and put it under the two predefined Actions.
	  If you use the Original Starcraft you have to REMOVE and after CREATE the units you 
	  need. Finished!
	- Active, for the player we're talking about, the Recall ability: select from the menu 
	  Player, Settings, the Special Abilities tab, the Protoss link, the Recall ability and 
	  select the player we're using on the left, uncheck the Use Default for Player # thick 
	  and at last select Researched for Player #. Done!
	- I hope you'll be happy of the result. Good luck!


"How can I make a computer player Nuke on a selected location?" --> Back to index
	You must use the same trigger as the above, that you can download here. Only, give 
	it to a terran computer player and set as the location the target you want to 
	annihilate. It is better if you create an armed nuclear silo in a unused angle of 
	a map and a ghost cloaked near the target, and you remove it with a related 
	- REMOVE UNIT AT LOCATION - trigger, just after the use. 
	This for animations, else give a player the silo from the beginning (armed). For
	the usage of the file view the question above.
	
		You can use this file for three types of AI Script, without 
		modifing it: these are the Nuke Here one, to make a ghost call a Nuke to a 
		select location, a Disruption Web Here, only for Brood War, and a Recall Here, 
		to use a teletransport effect. THIS is an affair: you asked for one, and now 
		you have three!!




'CONDITIONS' TRIGGERS


"What is a Switch?" --> Back to index
	Switches are very very useful in Starcraft, and know what they do and how they are 
	setted is basilar. For whom have familiarity with programming, a switch is only a 
	boolean variable. So, this means a switch can have two values: TRUE or FALSE (1 or 0).
	Initially a switch is initialized with a FALSE (0) value, but you can change this 
	as you want. You see, the most important use of the switch is to watch if a thing had 
	happened, and to decide consequentially. You must learn how to set a switch first, 
	and how to manage them as a Condition Trigger after.


"How can I manage switches as a condition?" --> Back to index
	It is very simple: simple use the condition - SWITCH - to have the computer see the 
	switch value ("Cleared" == FALSE and "Set" == TRUE) and do something
	if the switch is setted (only if you setted this before) or not.
	It is particulary useful also to 'break' two triggers: if you reach the trigger
	limit in a window (you can insert only a certain number of action trigger), 
	you would insert a - SET SWITCH - trigger at last, setting e.g. Switch 13, and make 
	another trigger's window that continues the first, only using the same PLAYERS settings 
	and the - SWITCH - statement - Switch 13 is set - as condition.




'ACTIONS' TRIGGERS



"How can I change a switch's value?" --> Back to index
	When you start playing, all switches are automatically set to a FALSE value, which is 
	equal to a "Cleaned" status. If you have the first	version of Starcraft the Switches 
	are 32 and you cannot rename them: rename is useful beacause you will probabily forget 
	what a switch is used for, expecially making about-40-triggers-based maps! So you would 
	like to rename switches like to explain their function as :"Laboratory doors could 
	be opened" or "Enable the Zerg attack".
	The Brood War version has a lot more switches and has the possibility to change the name 
	of the switches themselves.
	To change a switch value you have to use the SET SWITCH trigger.
	Here you can select the switch you had to manipulate, give him a TRUE value("Set") 
	or a FALSE one ("Clear"). The Toggle function switches the switch value( ;-) ),
	so if the switch was setted now it is turned cleared, and if before it was cleared now 
	it is setted. OK?
	The new Random function allows you to select a casual value for a 
	switch, either 0 or 1, selected by the computer casually. This seems to interest 
	the current time, depending on the number of milliseconds: the switch take the value of 
	[Switch.Value = (Number of milliseconds) div 2]. However, this is only my idea and it 
	could 	be wrong. And also, it isn't so interesting... Here there is an example 
	of trigger that use a Random function to force some computer players to attack the 
	player on a well defined time interval. Ah, also changing the condition would be 
	interesting, like a - SUFFERED DEATHS - one.

		- First you have to set the AIScript to get the computer work as well. See the 
		appropriate section in this page.		
		- Write this trigger to set a switch when 15 minutes are elapsed:
		   PLAYER: 'All players'
		   CONDITION: 'Elapsed time' Elapsed scenario time is - 900 - sec
		   ACTION: 'Set switch' - Random - switch - Send to suicide 1 -
			|  'Set switch' - Random - switch - Send to suicide 2 -
			|  'Set switch' - Random - switch - Send to suicide 3 -
			|  ...
			|  'Set switch' - Random - switch - Send to suicide 7 -
			|
			O- This means to change the switch name with the Rename function!
			   If you cannot do this, mantain the 'Switch 1' (2, 3, ..., 7) name.
		- Write this trigger to send a computer player to suicide if his switch value
		is TRUE:
		   PLAYER: Select here the first computer player you have
		   CONDITION: 'Switch' - Send to suicide 1 - (or - Switch 1 -)
		   ACTION: 'Set AI Script' - Send all units on random suicide mission -
		- COPY this trigger and change the PLAYER from 'Player X' to the second 
		computer player, COPY again and change it with the third... and do so until 
		the last one. This trigger will work fine with more than 2 players. Also 
		remember to set the - Send to suicide 1 - switch to Player 1, - Send to suicide 2 
		- to Player 2 and so!!!
		(THE ORDER YOU SET THE SWITCHES ISN'T IMPORTANT, YOU CAN ASSIGN -Send to 
		suicide 7- TO Player 3 OR VICE-VERSA)
		- Et voilà! Your trigger will send a random amount of computer players
		to the slaughter, that will change every time you'll play that mission.



-->BACK TO THE INDEX

2000 - LordHawk
All rights reserved