For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Grab array in actor, but two different actors

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
Post Reply
User avatar
LannFyre
OldUnreal Member
Posts: 157
Joined: Fri Mar 13, 2015 7:01 am

Grab array in actor, but two different actors

Post by LannFyre »

I have two actors that both have arrays that, if inserted, have 4 elements:

Code: Select all

struct Animations
{
      var array Stand;
      var array Walk;
      var array Jump;
      var array Run;
};
var private array Sprites;
And they are in two actors (DummyAnimActor,RPG_PlatformPawn), the first is a subclass of Actor and the second is a subclass of playerpawn.  I need a way to determine who my input actor is into a function, if it isn't either of these then return, but otherwise output these actors as a selected, in-game actor.  But I need either of them to be under a catch-all actor title (a name or string, not sure honestly) and modify the array (Sprites).

Here is an idea for how to do this, is this going the right way?

Code: Select all

function DetermineActor(actor Target, out string targStr)
{
 if(Target == class) {targStr = string(Target);}
 else if(Target == class) {targStr = string(Target);}
 [SANITY CHECKS ETC. GO HERE]
 return targStr;
}
I've read that typecasting an actor as a string will give me the package name.actor name[number] (eg. "RPG_Game_dev.DummyAnimActor0").

If I do this, the problem becomes typecasting back into a class and being able to do something like

Code: Select all

classTitle.Sprite[i].Walk[i]
because if I make classTitle "class" then I could get issues with not finding this array in class actor.

I'm working on a parser that goes through .int files to assign textures to these arrays for the directional sprite thing.  I have most of that written, but this is the last piece before I can test it.
Last edited by LannFyre on Fri May 26, 2017 10:15 pm, edited 1 time in total.
i tryin'a be a gud boi
User avatar
.:..:
OldUnreal Member
Posts: 1634
Joined: Tue Aug 16, 2005 4:35 am

Re: Grab array in actor, but two different actors

Post by .:..: »

Technically it kinda works but you'd have to use FindObject and do a separate check for both different actor types and it would be rather inefficient.

A more clean approach would be to use an object to contain your array:

Code: Select all

class MyAnimations extends Object;

struct Animations
{
      var array Stand;
      var array Walk;
      var array Jump;
      var array Run;
};
var private array Sprites;

final function Bitmap SomeAccessor( int a, int b )
{
      return Sprites[a].Stand[b];
}
final function InitBitmaps()
{
      // Read int files...
}

Code: Select all

class MyActor extends Actor;

var MyAnimations Animator;

defaultproperties
{
      Begin Object Class=MyAnimations Name=MyAnimObj
            Sprites.Add((
                              Stand=(Texture'A',Texture'B'),
                              Walk=(Texture'C',Texture'D')
                              ))
      End Object
      Animator=MyAnimObj
}
Then you can simply access either MyActor.Animator or MyPawn.Animator reference then use a common code base to process the animations.
Last edited by .:..: on Sat May 27, 2017 6:43 am, edited 1 time in total.
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)
Post Reply

Return to “UScript Board”