I'm creating a custom kismet node for dialogue boxes within my game. Logically, these nodes need to interact with my HUD class.
The only method I know of to connect the Kismet node to my custom HUD is to use the iterator foreach allActors(class'MyCustomHUD', out)
Right off the bat, I feel as if this is a terribly inefficient way to handle this; I feel as if there is a better method I am neglecting.
Granted, there will be only one instance of the HUD, so it should actually work whether efficient or not.
But I am also unsure about how to actually assign a consistent reference. The iterator is fine if I need it to only send one command or tweak one variable from the HUD, but it slows down the process if I have to do this more than once within my code. So I want the node class to have a set reference to the HUD. There are a couple issues I have with doing this.
The first is I wonder when it is good time to assign that reference. Knowing when the HUD will exist is one matter to itself, but I have no idea when the Kismet node will "exist;" I don't know if I can just throw this into the postbeginplay or such function and expect it to work like an actor placed in the level. So I ask, what gets called in a Kismet node before it gets activated by an earlier node, and what of such functions are called when there is a HUD to find?
The next thing I wonder is about the actual syntax I need to assign that variable. I need to declare a variable "Var MyHUD HUD;" to be referenced in the script, and likewise I need such a reference to use with the iterator. I wonder if I need two such variables, as it seems a little silly to create an identical variable just to copy to its clone. But even so, I wonder what the proper way to pass that reference on is. Do I just say "HUD = H" or is there a special way I pass reference variables?
And after all that, I am running into a compile error that is keeping me from testing this stuff. I keep getting "Error, 'ForEach': An iterator expression is required" from this code:
...which is really starting to tick me off. I've used foreach iterators before and I see nothing wrong with my syntax.Code:function FindHUD() { local ZCHUD H; foreach AllActors( class 'ZCHUD', H ) { HUD = H; } }



Reply With Quote



![Send a message via ICQ to Blade[UG]](images/styles/TwistedDark/misc/im_icq.gif)
![Send a message via AIM to Blade[UG]](images/styles/TwistedDark/misc/im_aim.gif)
![Send a message via MSN to Blade[UG]](images/styles/TwistedDark/misc/im_msn.gif)
![Send a message via Yahoo to Blade[UG]](images/styles/TwistedDark/misc/im_yahoo.gif)



Bookmarks