Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In the Unreal Development Kit, when using the Material Editor, one can factorize frequently-used groups of nodes by creating a Material Function (content Browser → right-click → new matrial function, IIRC).

When defining the behaviour of some actor in Kismet, one can easily have a dozen nodes involved.

If I have many actors that share the same behaviour, then I'll copy-paste these nodes, and change the variables so they point to the other actors.

This leads to inconsistencies (a modification in the behaviour of an actor isn't propagated in the copy-pasted nodes), complexity (you end up with hundreds of nodes), and generally useless effort.

My question is : Can I create a "kismet function", just like a material function ?

Note: I'd rather avoid using UnrealScript.

  1. I don't even know where to type UnrealScripts, don't know where the documentation is and more generally don't have enough time to invest in learning UnrealScript.
  2. This "kismet function" feature must be usable by graphists (with little programming knowledge).
  3. If a (simple) script suffices to add this feature in the Kismet editor, so that one can create several "functions" without using UnrealScript, then fine, but I don't really want to have to write a script each time I want to factorize a few nodes.

Thanks for any information !

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can't make Kismet function in the sense that it will exists once in memory and can be called from several places at the same time. Every time you want to have the same piece of script, you must duplicate nodes.

However, you can use sub-sequences to clean-up a bit your Kismet canvas. A sub-sequence is a single node into your main sequence, which contains itself several nodes. It can have inputs, outputs and also variables.

At first, right-click on your Kismet canvas, and create a new sequence (which will actually be a sub-sequence. Now you can select the subsequence in the Sequence treeview. Do it and add some action nodes. You can create an input to this subsequence by adding an event "Sequence activated". You can expose variables (for exemple, actor references) by adding a variable "External variable" You can create an output by adding an action "Finish Sequence" (in the Misc category)

You can see the subsequence in the parent canvas with all the inputs/variables/outputs you created. When you're done, you can copy-paste it as much times as you want to make a copy of the same piece of script, and simply links the corrects input/variables/output to it.

But remember that if you want to modify this sub-sequence afterwards, your changes won't be propagated to the other copies. You have to modify one of them, then delete the other ones and re-do the copy-paste for every other instances. To be clear, this won't improbe the maintainability of your Kismet script, only the reading of it.

Finally, it is also possible to export a sub-sequence to a package to use it in different level. However, it won't be editable anymore after that (you can't open a Sequence from the Content Browser with Kismet), and by experience you may have trouble to import it in your kismet scripts if you do this.

share|improve this answer
    
"You have to modify one of them, then delete the other ones and re-do the copy-paste for every other instances." Some people re-invent the wheel. I wish they re-invented structured programming. Sigh. –  Georges Dupéron Dec 2 '12 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.