| Home Page | Recent Changes | Preferences

Setting Up VCPlusPlus/The UnrealScript Part

You'll need a header for your native C file. In this example, you'll implement a class (or a part of a class) in C++; in that case it's easiest (though NOT required) to have unreal create the header file for you.

First of all, open Unreal.ini or Deusex.ini and search for EditPackages= lines. Add a line containing the name of your Package.

Next, create a .uc file in $UNREALROOTDIR\SQLite\Classes\MyClass.uc

It must contain at least this line:

class MyClass extends Actor
    native;

Declare variables that you want to access from your C code as global variables

var bool bGenerateDebugInfo;

Declare static functions like that:

native final (1723) function MyStaticFunc(String s, int i);

Note the '1723'. This is a UNIQUE number that you have to manually assign to static functions. Unreal reserves numbers up to 1000. Deus Ex, for example, adds some beyond 1000; you're on your own in finding out which numbers are reserved and which are not.

Declare non-static functions like that:

native function MyNativeFunc (String s);

NOTE: do this only AFTER you have created a DLL that EXPORTS this function; otherwise the compilation will fail. This is a stupid behavior of the unreal engine; I don't know if it's present in the latest version of the engine, but I think it is. If you want to define non-static native functions, you'll have to declare them manually in the C++ file and add the UnrealScript definition later.

The only advantage this behavior has: You don't have to declare non-final native functions in UnrealScript at all; the engine is aware of their existence simply by reading the DLL file. Why then add it at all? Because it's easier for the US coder if he can see the functions declarations in the US file.

When you're done, go to $UNREALROOT\System . Delete your package .u file if it exists, then issue:

ucc make . When it's compiled your package without errors, it will ask you if you want to update the .h file. Choose yes. That's the header file you need to include in your DLL project.

Next step: /The CPP File

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In