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

Creature Factory and "Drop when Killed"

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
Krull0r
Global Moderator
Posts: 543
Joined: Sun Jul 01, 2007 4:07 pm

Creature Factory and "Drop when Killed"

Post by Krull0r »

Hi there :)

I have map specific random item lists as Inventory actors and I don't like to create for every map and each monster a separate pawn class...

Pawns do have an option called "drop when killed" in the properties where I can define an Inventory actor.

Is it possible to modify a creature factory so that I can to tell the fabricated monsters in the Creature Factories properties what item they should drop after dying?


I have no clue how to achieve that :(
Image
User avatar
yrex .
OldUnreal Member
Posts: 291
Joined: Wed May 06, 2015 6:46 am

Re: Creature Factory and "Drop when Killed"

Post by yrex . »

Code: Select all

class MyCreatureFactory extends CreatureFactory;

var() class DropWhenKilled;

Code: Select all

class MySpawnPoint extends SpawnPoint;

function bool Create()
{
      local pawn newcreature;
      local MyCreatureFactory pawnFactory; //
My work | contact: ampoyrex at wp dot pl
User avatar
Krull0r
Global Moderator
Posts: 543
Joined: Sun Jul 01, 2007 4:07 pm

Re: Creature Factory and "Drop when Killed"

Post by Krull0r »


Not tested

It works perfectly :) Thanks alot yrex!!!! :)

I only had to add this lines to the new Creature Factory

Code: Select all

function PostBeginPlay()
{
      local MySpawnpoint newspot;

      Super.PostBeginPlay();
      backup_capacity = capacity;
      numspots = 0;
      numitems = 0;
      foreach AllActors( class 'MySpawnpoint', newspot, tag )
      {
            if (numspots < 16)
            {
                  spawnspot[numspots] = newspot;
                  newspot.factory = self;
                  numspots += 1;
            }
      }
}
otherwise the factory will only spawn creatures at the original spawnpoints
Image

Return to “UScript Board”