PDA

View Full Version : Vehicle kills the game on launch



aberghage
12-22-2007, 11:35 PM
Hey everyone,

For the past few days I've been working on a new vehicle. I've been able to get some measure of success by extending it from an existing epic vehicle (i.e. UTVehicle_Cicada) but if I try to make my own subclass of anything higher up the tree than that (like UTVehicle, UTAirVehicle, etc) the game crashes on launch. Even if I try just copying and pasting the code from an existing vehicle and changing the class name, I can compile fine, but the game dies on launch (the usual microsoft-y error which asks if you wanna report it etc, no specifics on what the error actually is). My most current attempt was to create a new subclass of UTVehicle using code from UTHoverVehicle, UTAirVehicle, and UTStealthVehicle, then subclass that using a combination of code from the cicada and the nightshade, same for the content classes. The source for that attempt is at http://watb.info/ut3/pelican/

If anybody's got any ideas, and/or previous experience please let me know.

Oh, also, I didn't have much success digging up a crashlog, if anyone has ideas there let me know too.

~aberghage

Geist
12-23-2007, 02:54 AM
Did you look in Launch.log yet for any error messages?

immortius
12-23-2007, 03:02 AM
When I tried summoning it I got this error in log:



ScriptLog: Fabricate pelican.utVehicle_Pelican_content
Critical: appError called:
Critical: Can't bind to native class pelican.UTCloakedFlyer
Critical: Windows GetLastError: The operation completed successfully. (0)


Which draws attention to how you are using the native keyword in the class declarations, which you shouldn't because the classes aren't native.
Removing the native parts of the class declarations fixes the crash.

aberghage
12-23-2007, 03:21 AM
Good catch, I assumed the native(Vehicle) was necessary for any vehicle class declaration just because it showed up in Epic's and I have no idea what it does (Sometimes I don't necessarily think that hard about those things before blindly saying "let's give it a shot!" particularly if it's a language I'm not terribly familiar with).


Okay, rebuilt with those natives cut out, things play nice (other than a bunch of things I haven't done yet, like letting the thing fly and killing the engine effect and contrail when cloaked) until the AI tries to target me, at which point the game hangs again. Now, 'native' is seeming more and more like a curse to me, because the culprit appears to be

native function bool IsInvisible(); which I snagged from UTStealthVehicle because of the comment above it:
/**
@RETURN true if pawn is invisible to AI
*/


I've now commented everything with the word 'native' from the code, which also included
native function float GetGravityZ();

I'll fiddle with it from here to see what happens. Thanks for the snappy replies & spotting my dumb mistakes :-).


~aberghage



EDIT: launch.log and launch2.log are online at http://watb.info/ut3/pelican/ with the current date/timestamp on them, if that's at all helpful to anybody else who runs into the same thing.

EntropicLqd
12-23-2007, 04:07 AM
The native keyword tells the UScript compiler that the function is actually written in C++. Since you cannot supply the C++ code it fails.

I'm sure you can override the native functions just be redeclaring them as normal functions within UScript though. e.g.



native function bool IsInvisible();
// Override in subclasses using
function bool IsInvisible();

aberghage
12-23-2007, 05:00 AM
Not to be a question troll, but I ran into two more questions which are probably beyond the scope of the thread, but:

First, anybody know where the controls for piloting a specific vehicle are stashed? For example, in raptors, cicadas and furies jump rises & crouch lowers. In a manta, space jumps, in a scorpion ctrl handbrakes. I have a growing suspicion it's done natively by those classes, but I'm wondering if anyone has any knowledge to the contrary.

Second, I've been working on a class which extends UTVehicle, and a vehicle which extends that class. At the moment all it amounts to is a mashing together of UTHoverVehicle, UTAirVehicle, and UTStealthVehicle content for the base class, and Cicada and Nightshade content for the vehicle. The AI doesn't respect cloaked status on the vehicle. Initially I thought this was because of the native function the nightshade calls (IsInvisible();) but I overrode it with the following uscript function:
function bool IsInvisible() {
if (!bIsVehicleCloaked){
return true; }
else {
return false; }
}

I've posted the current source files to http://watb.info/ut3/pelican in case anybody wants to take a peek.

Thanks again!

~aberghage

Geist
12-23-2007, 08:40 AM
Yeah, slightly outside the scope of this thread, but they're simple answers....

Look in the PlayerController class at the PlayerDriving state. In the ProcessDrive() function, the vars are passed in, and are sent to the vehicle's SetInputs() function. You'll also see a CheckJumpOrDuck( ) function called from here, as well. If you need to know where the vars are passed in from, search the script for ProcessDrive. Otherwise, go look at the SetInputs() functions in the vehicle classes to see how they affect jumping, boosting, etc.

As for your IsInvisible() function, it looks like your logic is backwards. As you have it, it's saying the vehicle is invisible if the vehicle is NOT cloaked (see the '!bIsVehicleCloaked'). You might want to just change it to something simpler anyway, to avoid this confusion...



function bool IsInvisible()
{
return bIsVehicleCloaked;
}

CaptainSnarf
12-23-2007, 01:30 PM
omg thanks for the 'native(vehicle)' fix. The mods would work in the editor but not when cooked. Gotta love those cut & paste errors.