I'm struggling to create a new script class


#1

Hi. How do I create a new script class for an actor?
For instance if I want to create a power up in the demo project. I created a new BP inheriting from Actor and called it PowerUp. Then I created a new script class called PowerUp as well, with the SkookumIDE but if I specify the new script class in the SkookumScriptComponent I get the following error message

Cannot find Script Class Name ‘PowerUp’ specified in SkookumScriptComponent of ‘PowerUp_C_1’. Misspelled?


#2

I think custom blueprint nodes are only possible if you add the script to the character not the enemy or hero class


#3

Hi @MatzeOGH and thanks for trying SkookumScript!

In order for a newly created class to be available in the engine it needs to be compiled in the IDE and loaded by the engine. You can either use the menu function Compile/Recompile Current Class (which will also hotload it into the engine) or Compile/Compile Project (but then you’d have to restart the engine to pick up the new binary files). [We are working on making this workflow smoother.] If after recompile/engine restart you still have this issue, let us know.

Regarding custom blueprint nodes - yes, this feature is still a work in progress. Currently you can add custom Blueprint nodes only to static engine classes such as Actor or Character, not Blueprint generated classes like Hero or Enemy. We are working with Epic to resolve this issue. Soon you will be able to create custom Blueprint nodes from Blueprint generated classes as well.


#4

you are right. restarting the engine after compiling the new script fixed the problem

  1. UE4 crashes if I execute !bob : 9

  2. If I want to use SkookumScript with my custom C++ code do I need to build the engine and pugins from GitHub?


#5

Whoops that bug must have crept in with the latest optimizations. We will post a fix shortly.

The plugin zip file also comes with all the source code you need to compile a C++ project, but we strongly recommend setting yourself up with our GitHub repository for the most up to date features and bug fixes.


#6

How do I setup my code project so that SkookumScript knows about my custom c++ classes?

I want to use a base class(c++) and child classes(BP) and control all of them via SK


#7

We have posted a new build with a number of bug fixes. Bob should be much happier now. Sorry for the trouble!


#8

C++ classes can be controlled via SkookumScript in different ways:

  1. If your class is derived from UObject and you use the UCLASS, UPROPERTY and UFUNCTION macros to reflect your class and its members, you can use SkookumScriptGenerator to automatically expose it to SkookumScript. Just add your custom C++ module as an +ScriptSupportedModules entry in Engine\Programs\UnrealHeaderTool\Config\DefaultEngine.ini, and the UnrealHeaderTool should pick it up and make it available to SkookumScript. Note that a class exposed to SkookumScript this way
  • cannot have custom SkookumScript data members, instead you would have to declare a UPROPERTY via UE4 and use the generated accessors to read/write it
  • cannot have SkookumScript-only subclasses as SkookumScript would not be able to recognize these
  1. If your class is derived from AActor you can do all of the above and more: You can attach a SkookumScript component to your actor, and in the component specify a custom SkookumScript class to use for this object. That means you can have a C++ class FlyingCreature and then derive SkookumScript-only Dragon and Vulture classes from it. With a SkookumScript component, you can also have data members which will be stored inside the component.

  2. If your class is merely a struct, look at SkTransform as an example on how to expose it to SkookumScript.

Hope this helps and let me know how it goes!


#9

so this isn’t working with the epic lancher engine plugin yet?


#10

Epic hasn’t released code plugins on their launcher yet.

They need to do some work on their install system to ensure that no tweaking of configuration files are needed after adding a code plugin like SkookumScript that uses the Unreal Header Tool.

Everything that we are putting up in the zip files and on GitHub should be the same as what you will get from the Unreal Marketplace.

Code plugins - including SkookumScript - could go live on the Marketplace any day now. Until then it will all work - just with a few more steps and hoops to jump through.


#11

Is it possible to add some c++ samples to the skookum demo project?


#12

The demo originally used to have some C++ examples. We removed the C++ out of the demo so people without Visual Studio can try SkookumScript right from the Epic Games Launcher.

We can create another demo with some C++ examples in the future.

The current demo is pretty simplistic - we will be making something more sophisticated and game-like as soon as possible.

The SkookumScript C++ API still has most of its comments in the .cpp files and they need to be moved to the .hpp files so that using the C++ side of SkookumScript is clearer.


#13

That would be really awesome.