• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Extending ROPawn issue

On what line does does your code start generating compiler errors?

I believe in the two examples below, that in both cases it was the "if" line, but I can double check when I get home. Interesting thing is, the compiler shows the error mentioned, but does not specify a line number like it does for all other errors that ive ever seen.

Code:
if ( FTPawnIntf(HitActor) != none)
{
     // do stuff here....
}

Code:
local FTPawnIntf myIntf;

myIntf = FTPawnIntf(HitActor);

if ( myIntf != none)
{
     // do stuff here....
}

I believe the 2nd example is definitely the correct usage (according to the tutorials ive read) and indeed it does work and "myIntf" is usable as an interface in my UDK version, so I can do myIntf.Testfunction.

I am happy to throw together a very simple project to demonstrate this and send it to you if you wish?
 
Last edited:
Upvote 0
Your aproach is wrong. Try this:

Code:
var FTPawnIntf myIntf;  // To set reference to your interface
 
if (myIntf(HitActor) != none)
{
     // do stuff here....
}

I know it looks odd, but this is how it should be done with interfaces.

The above code is the correct usage (as you say), it is what I am using, and it does not compile. It works fine in the UDK.
 
Upvote 0
OK, it was not a problem with the interface.

I basically had this code which should compile:

Code:
local FTPawnIntf myPawnIntf;

myPawnIntf = FTPawnIntf(HitActor);

// test if this actor implements our custom pawn interface...
if (myPawnIntf != none)
{
	`Log(">>> DEBUG : Actor has interface", , 'FTPlayerController');
}

But that results in the compile error:
Code:
Error, Missing opening '(' in Implements list


However, If I remove the log line (that I use everywhere!), and replace it with something else like below, it compiles and works.

Code:
local FTPawnIntf myPawnIntf;

myPawnIntf = FTPawnIntf(HitActor);

// test if this actor implements our custom pawn interface...
if (myPawnIntf != none)
{
	// we have a valid target to thaw!
	ClientMessage("Hit: Frozen Team Mate Detected");
	ClientMessage("Hit: "$HitActor$"  class: "$HitActor.class.outer.name$"."$HitActor.class);
	return ROPawn(HitActor);	
}

So the compile error, for some unknown reason, was caused by having a log statement inside my 'if' condition.

That would also be why it worked in the UDK version of my mod because I did not include the log line!
 
Last edited:
Upvote 0