I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:Evolution

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

My path to editing UScript began with a custom skin called Big Bird. I have no other coding experience or knowledge (other than HTML, JavaScript) so I had alot to learn when it came to UScript, which is a conglomeration of Java, JavaScript, and C++, among others.

The way that the custom skin came into play was that it would not work in the game. Simply would not work no matter what we did. It was actually a problem with the model itself, I realized much later, but at the time, I had no idea, and I was tired of asking other people what the problem could be based on the error messages we were receiving. I have always been a fix-it myself kind of guy, so I began performing Google searches for mapping, editing, and skinning tutorials.

Although coding tutorials were very very hard to find, as I got a little more experience with the lingo involved, I began to become more productive in my searches and finally found Chimeric's site. Now I had finally found other people that were in the same position as myself – wanting to learn more, but no resources to do so.

Around that time, I began my first project on my own - ColorInstaGib.


Hi & welcome to the Unreal Wiki :-) →Tarquin


Thanks :)

My latest work is SuperInstaGib, a mutator which enhances InstaGib combat in UnrealTournament. It is now on version 3, and since I haven't yet completed the updates to the website to include version 3, instead, you can see what it's about in the ModSquad forums at 125019.

I haven't done many projects, but I try to challenge myself constantly to improve my abilities. Although I haven't been coding long, I managed to spend some time with DarkByte, before UT2K3 went into final development, which increased my learning curve in leaps and bounds, no doubt. I'm presently working on a compendium of those lessons to post as a sort of journal in the style of a new scripter asking questions of a more experienced one. Hopefully, this interface will help some who still have questions about the intracacies of Uscript understand things a little more, as an alternate method of delivery than the standard FAQ or tutorial.


Tarquin: what happened to the stuff on replication that was on this page? that looked interesting (I know nothing about the subject. It looked simple and understandable :D )

DJPaul: Moved to Replication, I believe.


Tidbit #2:

This one is about using SpawnNotify. It is interesting to note exactly what is happening in a SpawnNotify. You must keep in mind that everything that you do inside of a SpawnNotify class is happening BEFORE the actor is returned to the calling Spawn() function for that actor. What this means is that anything that is set on that actor that is also set immediately after the Spawn call will be overridden. A perfect example was with FlagBase.

FlagBase spawns a CTFFlag using the following code:

	if ( Team == 0 )
	{
		Skin=texture'JpflagR';	
		myFlag = Spawn(class'RedFlag');
	}
	else if ( Team == 1 )
		myFlag = Spawn(class'CTFFlag');
 
	myFlag.HomeBase = self;
	myFlag.Team = Team;

Now, if I were to set myFlag.HomeBase inside of a SpawnNotify function, that would be overridden by the 'myFlag.HomeBase=self;' line following the Spawn() function. In execution, it would look like this:

Spawn(class'CTFFlag') calls SpawnNotify -

**** inside SpawnNotify *****

NOTE: this happens BEFORE the actor is actually spawned

CTFFlag(A).HomeBase = ThisOtherBase; <→ myFlag.HomeBase value is now 'ThisOtherBase'

return A; <---- When we return to the spawn function, THEN the actor is finally added to the level

***** back inside FlagBase *****

myFlag.HomeBase = self; <---- Now the value of HomeBase is overridden by this line anyway

EntropicLqd: Nice titbit. I've used spawn notify to create objects that reference the one being created - but altering attributes of the object being created always struck me as being a bit mad. As you so ably demonstrate above. Nice. :)


I've been tackling replication lately. I am determined to master every aspect of it, and whenever faced with a problematic replication issue, I've been tackling it head-on. This has led me to many discoveries about the Spawn() function, as well as the way the game travels through all of the different classes from start to finish. SuperInstaGib has been put on hold, for the time being (waiting for Silencer ;) ) so I've split off one of the features – the alternate team colors, into its own mutator - AllTeams. This mutator will allow you to play team games with all 4 team colors. Future versions will allow you to play with additional team colors (grey, purple, orange, brown)


Tidbit #3:

If you spawn an actor, be aware that the actor's PreBeginPlay, BeginPlay, and PostBeginPlay functions will ALL execute before the code continues in the class you are calling the Spawn() function from. Why is this important? Many reasons...actually, this is about the most important thing I've learned so far. ( Close tie with the nature of PostNetBeginPlay() )

Here is the evidence:

class ATControl extends Mutator config(AllTeams);
 
// Below code has been edited for space.  However, THE ORDER in which the code is executing has not been changed
function PreBeginPlay()
{
	if (debug)
		log(Class@"********** Beginning PreBeginPlay **********");
	if (Level.Game.bTeamGame)
		TeamGamePlus(Level.Game).RegisterMessageMutator(Self);
}
 
function PostBeginPlay()
{
	local int i;
 
	if (debug)
		log(Class@"********** Beginning PostBeginPlay **********");
	if (debug)
		log(Class@"Spawning ATRInfo");
 
	class'ATRInfo'.default.debug = debug;
	class'ATRInfo'.static.StaticSaveConfig();
 
	ATRI = Spawn(class'ATRInfo', Self);
	if (debug)
		log(Class@"Establishing HUDTypes & ScoreboardTypes");
 
	// lots of other misc code
	if (debug)
		log(class@"********** Finished PostBeginPlay **********");
}
class ATRInfo extends ReplicationInfo config(AllTeams);
function PostBeginPlay()
{
	if (debug)
	{
		log(class@"********** Beginning PostBeginPlay **********");
		log(class@"TeamIndex[0]="@TeamIndex[0]);
		log(class@"TeamIndex[1]="@TeamIndex[1]);
	}
	Super.PostBeginPlay();
	if (debug)
		log(class@"********** Finished PostBeginPlay **********");
}

And here is what that code logged (again, edited for space, but the order of the log statements has not been changed):

ScriptLog: AllTeams.ATControl ********** Beginning PreBeginPlay **********
ScriptLog: AllTeams.ATControl ********** Beginning PostBeginPlay **********
ScriptLog: AllTeams.ATControl Spawning ATRInfo
ScriptLog: AllTeams.ATRInfo ********** Beginning PostBeginPlay **********
ScriptLog: AllTeams.ATRInfo TeamIndex[0]= 2
ScriptLog: AllTeams.ATRInfo TeamIndex[1]= 3
NOTE: There was ALOT!!! of code in between the beginning of PostBeginPlay and the end of PostBeginPlay
ScriptLog: AllTeams.ATRInfo ********** Finished PostBeginPlay **********
ScriptLog: AllTeams.ATControl Establishing HUDTypes & ScoreboardTypes
ScriptLog: AllTeams.ATControl ********** Finished PostBeginPlay **********

Incidentally, I've been thinking about writing a set of commandlet mutator that will write out a log file that will essentially demonstrate the program flow of UScript (might even bundle it with a small java file to throw some XML around it hehe)

Oh, almost forgot. I've created a TextPad "SnackPack" for UT.

[1]

The syntax file can be used on all versions. However, the rest of the snackpack is contained in a .reg file. I have Windows2000, and although I *believe* this part of the registry is the same across OS's, you may want to open the brownies.reg in a text editor and make sure all the paths line up.

Includes

updated syntax definitions:

These are based on Ob1's original UC syntax definition file for TextPad. I've added hundreds of class names, members, and variables, as well as two seperate color schemes - one for editing, and one for printing. I've

included

  • tools
    • run the compiler, capture output, exception hyperlinks (to line number)
    • after placing cursor on class reference, opens a new window with a hyperlink to the class name (about as close as I could get to hyperlinked classnames)
  • preset workspace
    • for viewing
    • for printing

coming soon

  • uc script clip library

Kuhal: Are you the Evolution that recently worked on DarkByte's SemiAdmin? I've been trying to get hold of you :) Can you ICQ me please - 105626576