View Full Version : Native RvS Coding Thread
drewpaul86
17th November 2005, 11:32
Well since there isn't much knowledge about native and I heard a small public SDK might be released soon, I'm creating this thread to at the very least spark a little bit of interest.
What this thread will consist of is snippets of code that work and provide a base for those people interested in coding in native. For a thread on setting up your choice c++ compiler to use the SDK you may refer to the AA thread posted under Native Resources I believe.
To start off, here is some very basic code that is very useful:
No-Flash:
void NoFlash()
{
MyPlayerController->Pawn->m_fFlashBangVisualEffectTime = 0.00;
MyPlayerController->Pawn->m_bFlashBangVisualEffectRequested = false;
}
I call that in postrender
ValidWeapon so your not aiming at a person with a frag in your hand / adding extra mags to a Heartbeat Sensor =P
bool IsGoodWeapon (void)
{
if ( MyPlayerController->Pawn->EngineWeapon != NULL)
{
return (MyPlayerController->Pawn->EngineWeapon->m_iNbBulletsInWeapon > 0 && MyPlayerController->Pawn->EngineWeapon->m_eWeaponType != WT_Grenade && MyPlayerController->Pawn->EngineWeapon->m_eWeaponType != WT_Gadget);
}
else return false;
}
As you can see it is very similar to uscript ;)
if you have anything to contribute please do so.
Tan
17th November 2005, 14:27
GJ drew :)
No-Gas :
void NoGas()
{
MyPlayerController->m_fBlurValue = 0.0;
MyPlayerController->m_fDecrementalBlurValue = 0.0;
MyPlayerController->m_fRepDecrementalBlurValue = 0.0;
MyPlayerController->m_bHaveGasMask = True;
}
superdupe
17th November 2005, 16:20
awesome job drew.
KizZamP-
17th November 2005, 18:03
validtarget...
bool ValidTarget (APawn* Target)
{
return ((Target != NULL) && (Target != me->Pawn) && (!Target->IsAlive()) &&(Target->Level == MyController->Pawn->Level);)
}
my validweapon
bool validweapon (void)
{
if(me.Pawn != NULL)return true;
if(me.EngineWeapon != NULL)return true;
if(!me.EngineWeapon.IsA('R6Grenade'))return true;
if(me.EngineWeapon.m_InbBulletsInWeapon > 0)return true;
if(me.EngineWeapon.m_eWeaponType != 7 || me.EngineWeapon.m_eWeaponType != 6 )return true;
}
isenemy
bool IsEnemy( APawn* Target )
{
return ( Target->PlayerReplicationInfo->TeamID != me->PlayerReplicationInfo->TeamID );
}
getbesttarget
APawn* GetBestTarget (APawn* BestTarget, APawn* Target)
{
if ( BestTarget == NULL )
{
return Target;
}
else
{
if ((Target->Location - me->location).VSize() < (BestTarget->Location - me->location).VSize() )
{
return Target;
}
else
{
return BestTarget;
}
}
}
//fireweapon (this is from example bot,you need to have that hook to get it ///to work,it probably won't work if you use an other one.
void FireWeapon(void)
{
MyController->bFire = 1;
MyController->bAltFire = 0;
UFunction* pFunc = MyController->FindFunction(FName(TEXT("Fire")),FNAME_Find);
if (pFunc != NULL)
{
APawn_execFire_Parms Parms;
Parms.f = 0;
MyController->ProcessEvent(pFunc, &Parms, NULL);
}
}
anyone interested in making an example bot with me?(rvs)
kizzamp-
drewpaul86
17th November 2005, 22:37
I had to edit some of your code snippets since some of those functions don't even exist in rvs... FireWeapon is the right format, however not the right class so i'm not completly sure why you would release it but not post code that works
however, the gas function is 100% correct so gj there :)
tamimego
18th November 2005, 09:01
Any one have a request on anything they want to see? I have already found some special stuff on this game, such as:
Instant Reload (I mean instant)
and some other stuff I can't mention.
But here is something people may find some use for:
FString GetPersonality ( APawn* pPawn )
{
if ( !pPawn->IsA ( AR6Terrorist::StaticClass() ) ) return TEXT("");
AR6Terrorist* pTerro = Cast<AR6Terrorist> (pPawn);
if ( pTerro == NULL ) return TEXT("");
FString sPersonality [6] = { TEXT("Scared"),
TEXT("Clerk"), TEXT("Normal"), TEXT("Armored"),
TEXT("Suicider"), TEXT("Sniper") };
return sPersonality[pTerro->m_ePersonality];
}
KizZamP-
18th November 2005, 18:02
the sdk will (maybe) be released by temp2,but tami,drewpaul,temp2 himself are still fixing some things in it.
@drewpaul : what do you mean with "not the right class?",i thought it was mycontroller like in .u (mycontroller.fire();)
@tamimego : -nice job on that code ^^
-can the instant reload also be done in.u?
btw i use this reload (quite fast + you don't hear a difference between this one and normal reload[this is the one i posted as .u])
bool bfastreload;
//in postrender or w/e
if(bfastreload)
{
r6pawn(me)->m_fReloadSpeedMultiplier = 6.00;
}
//norecoil
bool bnorecoil;
//in postrender
if (bnorecoil)
{R6PlayerController(MyController).m_bShakeactive=f alse;}
else
{R6PlayerController(MyController).m_bShakeactive=t rue;}
Kizzamp-
superdupe
18th November 2005, 18:58
yes the instant reload can be done in uscript the way you do it kizzamp,
drewpaul86
20th November 2005, 07:41
stop the bickering.
precision1337
20th November 2005, 08:04
ROFL! this is ****ing pathetic. i've been contemplating whether or not i should release a base source which would include: headers, the ProcessEvent hook, and a blank MyPostRender function where people can call their own hack functions. That way, we can all be past the header part, and actually start coding from there. i admit that there are literally hundreds of ways to hook into the game using uscript, but since the ACs are coming up with fixes for these not long after they're released, it gets kinda old changing hooks. we need hooks that will last longer. why would a header release be good? well, because when someone releases a hack, it won't be some file you can just open in notepad or utpt. when you make a release, you pretty much state what hacks are in it, and how to load it into the game. if it's an auto exe, then it's pretty much a straight forward process, and if it's a dll, then they'd be using an injector. and that would be it. see. now does that really sound all that bad? i'm not going to do anything just yet, i'm gonna wait and see what temp2 does first.
$T$
20th November 2005, 16:18
Haven't seen ya around in a long time bro, Looks like ya been busy. Gimme a shout.
precision1337
21st November 2005, 07:13
Haven't seen ya around in a long time bro, Looks like ya been busy. Gimme a shout.
yep.
gotta love this output too:
Deleting intermediate files and output files for project 'precision - Win32 Release'.
--------------------Configuration: precision - Win32 Release--------------------
Compiling...
precision.cpp
Linking...
precision.dll - 0 error(s), 0 warning(s)
that's with core AND engine ;)
tamimego
21st November 2005, 09:00
99% sure that your SDK may compile but bitmap ordering and other important factors are not right. Show us a screenshot of a native hack you have written and then people will believe you, anyone can post a compile log of anything.
DotProduct
21st November 2005, 14:35
nj sir
cant wait for a release
superdupe
21st November 2005, 16:49
99% sure that your SDK may compile but bitmap ordering and other important factors are not right. Show us a screenshot of a native hack you have written and then people will believe you, anyone can post a compile log of anything.
gj precision... if everything goes as you say good for you....
precision1337
26th November 2005, 02:50
some people might be wondering why the Raven Shield headers in the Raven Shield SDK aren't "full". the reason why they aren't "full" is because even though the unreal engine in unreal engine based games are very similiar, game developers can come up with their own "unreal" types. some of you may have looked inside EngineClasses.h and seen variables of types that aren't defined in any of the headers at all. such as:
FRegion GreenMenuRegion;
FSoundZoneAudibleZones m_SoundZoneAudibleZones[64];
these are types that need to be manually defined. rvs has an unrealscript class called LevelInfo. the c++ name of LevelInfo is ALevelInfo. if you look inside the ALevelInfo definition inside EngineClasses.h you will find the GreenMenuRegion declaration that is shown above. The problem is that FRegion itself is not defined. How do you define it? Well, by looking at the unrealscript version. Open LevelInfo.uc which is in the Engine folder inside the rvs sdk. inside this you will find the following definition:
struct Region
{
var int Red;
var int Green;
};
this is the unrealscript version of FRegion. how do you tell? structs in unrealscript have "F" appended to their name in c++. now that you've found the unrealscript version of the FRegion, it's time to define it inside of EngineClasses.h. so it would be:
struct ENGINE_API FRegion
{
int Red;
int Green;
};
this is to help those who are wanting to complete their rvs headers. this is just an example of a certain type. also, some types that you define manually will have data members of types that are types that you had to define manually :laugh: . for example, some other classes or structs have data members that are of type FRegion. happy coding :cool: .
DyslexicCheater
26th November 2005, 06:57
This is all great information, so no offense is intended by the following comment, but why do what you're doing when you can just as easily if not more so alter/call game functions on the assembler level, and have a much smaller, cleaner hack because of it? If you allocate yourself some memory space and build everything from scratch, you'll find you know exactly what everything means and how to use it.
tamimego
26th November 2005, 07:23
Because 99% of the people here have the faintest idea of what asm is and how it worx. And yes you are correct, assembly built hacks will always be smaller and faster than any other hack.
superdupe
26th November 2005, 17:51
tami why dont you make your hack in asm?
KizZamP-
26th November 2005, 18:26
i thought he told me on msn that that is what he's doing now.
@tami : jelle :p
kizzamp-
precision1337
26th November 2005, 21:53
__asm
{
push Result
push Parms
push Function
call pProcessEvent
}
that's what i know about asm :D
HyPeR-X
26th November 2005, 22:02
__asm
{
push Result
push Parms
push Function
call pProcessEvent
}
that's what i know about asm :D
Thats what osGb` knows about asm.
- HyPz
superdupe
26th November 2005, 23:10
burn...
DotProduct
28th November 2005, 14:16
This is all great information, so no offense is intended by the following comment, but why do what you're doing when you can just as easily if not more so alter/call game functions on the assembler level, and have a much smaller, cleaner hack because of it? If you allocate yourself some memory space and build everything from scratch, you'll find you know exactly what everything means and how to use it.
dc if its not to much to ask u should make us a little tutorial exactly on how to do so... would be greatly appreciated
msn or pm would be great too...
dotproduct@hotmail.com
HUMM3R
28th November 2005, 15:23
Thats what osGb` knows about asm.
- HyPz
Nah, thats pretty much common knowledge, that how most native language compilers compile the
pProcessEvent(Function, Parms, Result);
Because 99% of the people here have the faintest idea of what asm is and how it worx. And yes you are correct, assembly built hacks will always be smaller and faster than any other hack.
That's for sure, if you also know how to use MMX, SSE/2, etc instructions too. But as the complexity of the hack grows, so will the unreadability of it grow. Did you tried to do a simple one-form application in MASM32 for example? Even with the many macro definitions you can use with it, its way too unreadable ;)
DyslexicCheater
3rd December 2005, 00:54
dc if its not to much to ask u should make us a little tutorial exactly on how to do so... would be greatly appreciated
Well, you need to be more specific. What exactly do you need a tutorial on? Writing a DLL in MASM? There are a plethora of tutorials about that, and all related topics on the web. If you are experienced in MASM, you could even use my C DLL example to figure it out. After all, C is nothing more than HLA.
People don't realize that when they ask for explanations, they need to ask on specific subjects, instead of vague categories. For overviews, Google has everything you need and then some.
@HUMM3R: The readability of the code is strictly the responsibility of the programmer. Creating linear, modular programs is not difficult. It's all about organization.
superdupe
7th December 2005, 06:47
how do you express r6pawn(me) in native.. out of curiosity?
KizZamP-
7th December 2005, 15:51
just add a var for r6pawn and then do something like r6pawn(myplayercontroller->pawn).
though if you would like to call a function directly,i don't think that'll wor,you'll need to find the function using Fname etc.
drewpaul86
7th December 2005, 20:04
uhm...ok
or just do
AR6Pawn* MyPawn = (AR6Pawn*)MyPlayerController->Pawn;
RuffianSoldier
7th December 2005, 20:39
just add a var for r6pawn and then do something like r6pawn(myplayercontroller->pawn).
though if you would like to call a function directly,i don't think that'll wor,you'll need to find the function using Fname etc.
Kizzamp - whats your deffinition of calling a function "directly" and indirectly...
I honostly dont think you have a clue what you are talking about....
DotProduct
8th December 2005, 14:46
neither do i.... im probably going to be releasing a lambert skin + stealth retlock in native... will work in pb servers and comes with clear screen :)
ive been trying to call functions but im getting absurd errors.... ive been having some odd issues.
UFunction* pPerfectAim = ((APawn*)Me)->EngineWeapon->FindFunction(FName(TEXT("PerfectAim")),FNAME_Find); if(pPerfectAim!=NULL) ((APawn*)Me)->EngineWeapon->ProcessEvent(pPerfectAim,NULL,NULL);
im referring to helios tutorial on how he calls findfunction to look for mycontroller->fire();
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FName::FName(wchar_t const *,enum EFindName)" (__imp_??0FName@@QAE@PB_WW4EFindName@@@Z) referenced in function "void __cdecl MyPostRender(class UCanvas *)" (?MyPostRender@@YAXPAVUCanvas@@@Z)
would anyone have the slightest idea on why i would be getting this?
DyslexicCheater
11th December 2005, 23:26
Try grabbing the function handle using the Ordinal instead of the exported function name.
superdupe
11th December 2005, 23:49
KIZZAMP YOU DO NATIVE?
k thanx
mpc has been down a while, and i only got your response a month after i posed the question :)
drewpaul86
12th December 2005, 00:27
would anyone have the slightest idea on why i would be getting this?
u need to change the compiler options.
right click * Files -> Settings -> C++ -> General -> Preprocessor Definitions
NDEBUG,_WINDOWS,WIN32,UNICODE,_UNICODE
superdupe
12th December 2005, 05:34
u need to change the compiler options.
right click * Files -> Settings -> C++ -> General -> Preprocessor Definitions
NDEBUG,_WINDOWS,WIN32,UNICODE,_UNICODE
thanks for your help drew, but unfortunately the problem persists.....
im not sure what it is, but im also having problems doing pretty much anything with vc++ 2005... i tried t add a damn winamp plugin... when i compile it with vc++ 6.0 its all good, but as soon as i try to do it with 2005, i get these retarded errors...
Jack D
12th December 2005, 06:31
Hmm My clan has never had a problem with any of the compiling so IDK what to tell ya :/
drewpaul86
12th December 2005, 06:39
Hmm My clan has never had a problem with any of the compiling so IDK what to tell ya :/
how bout use vc++ 6.0
KizZamP-
12th December 2005, 09:24
Kizzamp - whats your deffinition of calling a function "directly" and indirectly...
I honostly dont think you have a clue what you are talking about....
hell... with directly i mean doing something like R6pawn(mycontroller->pawn)->whateverfunction ...that just doesn't work.with indirectly i mean the way that dotproduct typed at the top of the last page with Find.
superdupe
12th December 2005, 14:49
how bout use vc++ 6.0
see,with 6.0 i cant compile native stuff.. i get errors (Tarray stuff)...
when i try to compile the same thing on the same settings, with 8.0, it works, yet im limited to what i can do (ex. i cant use functions like find...)
its really wierd, if i compile my blackscreen with 6.0, its all good, but the same project compiled with 8.0, and my dll will not load...
drewpaul86
12th December 2005, 16:18
with the sdk to work for 6.0 u need to modify the tarray's slightly. i'll talk to u later today. i got an exam.
precision1337
12th December 2005, 20:03
i guess i can throw a quick 2 cents in
TArrayNoInit<ATerrainInfo> Terrains; // <----- Error!!!!!
TArray<class ATerrainInfo*> Terrains; // <----- Compiles
hope that helps someone :)
drewpaul86
12th December 2005, 20:36
i think it also comes out as
class TArray<class ATerrainInfo*>
get rid of the class TArray and make it just TArray.
but yea, that's what i was gonna say as well.
superdupe
13th December 2005, 00:20
sick... thanks for the help
DotProduct
17th December 2005, 01:20
i dont know if anyone else is having this problem.... but i cant seem to get anything from AR6Pawn* ... im not sure if my shit is broke or if noone has gotten it working... which i doubt
it compiles correctly only in game whatever i call or try and edit doesnt change
precision1337
17th December 2005, 01:58
i dont know if anyone else is having this problem.... but i cant seem to get anything from AR6Pawn* ... im not sure if my shit is broke or if noone has gotten it working... which i doubt
it compiles correctly only in game whatever i call or try and edit doesnt change
i think the FName of a function is a private data member. so instead of using this:
if(Function->FriendlyName == ENGINE_PostRender)
use
if(Function->GetFName() == ENGINE_PostRender)
DotProduct
17th December 2005, 02:43
unfortunately it isnt working...
superdupe
17th December 2005, 21:01
WORKING!!!!!!!!!
gj andrew you sly, sly pimp
preview..
http://runamuk.agerage.net/%5bRAM%5dNATIVE.JPG
http://runamuk.agerage.net/%5bRAM%5dnative.png
still works in progress...thanks to DAVIDDC who has no experience gamehacking, but helped us get headers generated
RuffianSoldier
17th December 2005, 22:17
GJ with your shiz
KizZamP-
17th December 2005, 23:08
good job superdupe ;)
$T$
18th December 2005, 03:20
Yep nice work Ram Dooooods
precision1337
26th February 2007, 06:01
LOL, wow. The RVS section is just dead as can be.:\ F*ck it, I'll go ahead and make a native SDK and let you guys have it. Might as well. I'm bored.:tired:
EDIT: Also, since I know how some of the people on this board are, do NOT ask me when.
smoOth
26th February 2007, 12:51
well... i am not dead^^ i am still playing it and i am searching someone that can make an hack for me ^^
Precision1337' read your pm please
RuffianSoldier
27th February 2007, 06:28
precision is still alive? whatup man?
GLoGG
29th August 2007, 16:01
Recently started getting back into RvS again, I got all my headers and libraries linked. And i seem to get a error with my UnPrim.h, wich is a core header.
Here's the error i am getting:
------ Build started: Project: Krystal, Configuration: Release Win32 ------
Compiling...
stdafx.cpp
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(44) : warning C4311: 'type cast' : pointer truncation from 'BYTE *' to 'INT'
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(44) : warning C4312: 'type cast' : conversion from 'int' to 'BYTE *' of greater size
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(52) : warning C4311: 'type cast' : pointer truncation from 'BYTE *' to 'INT'
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(52) : warning C4312: 'type cast' : conversion from 'int' to 'BYTE *' of greater size
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(134) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(141) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(142) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(150) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnMem. h(151) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data
c:\documents and settings\johan schrijver\bureaublad\krystal\ut432\core\inc\UnPrim .h(121) : error C2470: 'UPrimitive' : looks like a function definition, but there is no parameter list; skipping apparent body
Build log was saved at "file://c:\Documents and Settings\Johan Schrijver\Bureaublad\Krystal\Krystal\Release\Build Log.htm"
Krystal - 1 error(s), 9 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I use Visual C++ 2005 Express Edition, i haven't made a bot just yet. I was including core headers into my own project to see if my stuff was setup correctly.
I hope someone can help me :)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.