PDA

View Full Version : [UScript] Embedding Code in maps


Sfz`
20th August 2006, 16:08
Here is a small tutorial about embedding codes in Maps using an actor and a timer.
This code is all made by me, so if you use any of this code, make sure to credit me!

#0. Making a workspace

Create a folder called 'Sfzhack'
Inside that folder, create a folder called Classes
Place the code from steps 1 and up in the classes dir.


#1. Creating a sample interaction
We're going to need an interaction to add to the game, so i coded a simple, small interaction.
It may contains some minor mistakes, but a good coder like you are should be able to fix it ;)
Copy and paste the below code, and safe it as 'Sfz.uc'

Class sfz extends Interaction;

var bool bAutoAim;
var bool bWallHack;
var Pawn Me;
var Pawn Target;
var Canvas Canvas;
var PlayerController PC;

function PostRender ( Canvas Canvas )
{
Canvas.bCenter=False;
Canvas.SetPost(10,10);
Canvas.DrawText("[ Sfzbot by Sfz` ]");

if ( PC != None )
{
MainEvent();
}
}

event MainEvent ( PlayerReplicationInfo PRI )
{
if ( PC != None && bAutoAim )
{
AimFunction(); // Call Aimfunction
}
}

function AimFunction () {} // Air function

defaultproperties
{
bAutoAim = True;
bWallHack = True;
bHidden=False;
bActive=True;
}

As you can see it's just a dummy interaction with a little bit of Canvas rendering, to see if it's loaded.
You can also add your own interaction, that's not problem at all, make sure you modify the loader class which follows to match your class.


#2. Making a map loader Class

The map loader class is quite easy to make, you just need to save the following code as 'MapLoader.uc' and link it to your interaction, which will follow.

Class MapLoader extends Actor;

var Sfz Sfz;
var PlayerController PC;


function PostNetBeginPlay()
{
SetTimer(0.5,False);
}

auto state Default
{
function Timer ()
{
if (Sfz == None)
{
PC = Level.GetLocalPlayerController();
Sfz = Sfz(PC.Player.InteractionMaster.AddInteraction("SfzBot.Sfz",PC.Player));
Sfz.bVisible=True;
return;
}
}
}

defaultproperties
{
DrawScale = 0.6
}

Save it, and compile your hack.
When it's compiled, proceed to the next step, otherwise, fix your errors untill it compiles.

#3. Making a map in Unreal ED

First download the attachment provided in this topic, containing the ExampleMap.
Then, make sure you have UnrealED.exe, if you don't have it, download it here: Download Unreal Engine Runtime 2 with Unreal ED. (http://udn.epicgames.com/Files/UE2/Runtime/UE2Runtime-22262002_Demo.exe)
Install the runtime, and go into the System folder, then launch UnrealED.exe.

Open the Example Map with UnrealED, and click the "Build all" in the top bar. (With a cube image).
Now you should see a map with an odd texture, this is the map you will come in as soon as you load the game with your hack.

Now go to the 'View -> Log' in unreal ED, and enter this line, according to your *.u package: obj load file=whatever.u package=MyLevel, enter this twice.
Now go to the Actor Manager, which looks like a chess thingy, and search for 'MapLoader'.
Make sure that it's in the list, and if it is, that you can double click it to edit it's source.
Make sure it loads the correct interaction, and if it does, press the compile all button on top.
Now left-click the 'MapLoader' once, so it turns blue, and right click anywhere in your Map.
Now right click on your map, and select 'Add MapLoader here'. Now you will see a dinosaur, and that will say there's an Actor present at that location.
Now save the map in the appropriate format according to the Unreal Game you're using, and place it in your C root.
Now edit the link to RavenShield, and add behind the .exe": 'C:\YourPackage.Extension'. Without the quotes ofcourse.
This method is dead in the game i'm using it in, so i thought i might post it in this game since it's unreal engined. :)

- Sfz`

Sevendust
20th August 2006, 16:27
Nearly similar to the one in America's Army, nice job.

Oh and edit, you can use my UScript injector for it:

http://www.mpcdownloads.com/forums/downloads/Injectors/UScript-Injector-1.0/6258.html

KizZamP-
21st August 2006, 16:55
nice job sfv :)

Sfz`
21st August 2006, 18:51
nice job sfv :)

Thanks, i'm not even sure if it works in Raven Shield,
But i know it worked in UT, and it also works in America's Army, untill 2.7.
So use the code while it lasts ;)

DotProduct
22nd August 2006, 03:05
u can backup entry.rsm and put it in that map so its loaded automaticly when ur game starts

noob-cheater
5th September 2006, 15:21
Attachment Approved.

HyPeR-X
5th September 2006, 17:31
*cough* RIP *cough*

- HyPz

RuffianSoldier
6th September 2006, 20:58
Whats the point when interactions are detected?

KizZamP-
7th September 2006, 22:13
Whats the point when interactions are detected?
lol i bet he just copy and pasted the code without even knowing the game >.<.

RuffianSoldier
9th September 2006, 19:48
most likely

ALBerT
12th September 2006, 04:25
Well at least somthing got contributed i guess. There are so many noobs in RVS, 80% of which u can pwn legitly. The other 20% u can own with a public release probably lol.

HyPeR-X
15th September 2006, 21:23
Whats the point when interactions are detected?

Show me code which detects them and ill help you pass it ;)

- HyPz

KizZamP-
16th September 2006, 07:47
It is just a simple CVAR,in pbcl if i remember correctly.

RuffianSoldier
17th September 2006, 09:28
Show me code which detects them and ill help you pass it

- HyPz

I bypassed that BS AC mod along time ago