The Hazardous Realm
The Hazardous Realm

Bloody Mess: Adding more than one type of Victims

All topics related to the game 'Die by the Sword' and it's add-on 'Limb from Limb' go into this board!

Bloody Mess: Adding more than one type of Victims

Postby ChessCheese1 » 09 Sep 2013 17:46

Hi, in the bloody mess mode, I managed to change the victims spawned to be hexlers with weapons, making a cool big battle mode. But I wanted to make them not only helxers, but many different creatures (for example: one the_hero, one orc, one ogre and one minotaur). I tried to work with the code inside moddata/gametypes, but when I tried to add more of the command world.spawnactor, I never manage to make it spawn more then one type of creature, instead it doesn't spawn anything.

Please help me on how to make Bloody Mess spawn creatures of more than one type. I appreciate any help.
ChessCheese1
Peasant
Peasant
 
Posts: 7
Joined: 03 Sep 2013 13:44

Re: Bloody Mess: Adding more than one type of Victims

Postby Hazard » 28 Sep 2013 04:35

Nothing spawning at all probably means that an error in the script prevents it from running. The xwindie.XRLD3D.log file contains script error messages.

Here's a version of the gamemode script that spawns different enemies:

Code: Select all
   class BloodyMessScript : Script {

      List<Actor> Victims = new List<Actor>();
      static readonly string[] ENEMIES = new string[] { "the_hero", "orc", "ogre", "minotaur" };

      public BloodyMessScript() {
         this.Tick += MyScript_Tick; // subscribe to the Tick event

         for (int i = 0; i < Game.Players.Count; i++ ) {
            var a = Game.Players[i].Actor;
            if (a != null && a.Exists()) {
               for (int iv = 0; iv < ENEMIES.Length; iv++) {
                  float rot = (float)(Math.PI * 2 / (ENEMIES.Length + 1)) * iv;
                  var v = World.SpawnActor(ENEMIES[iv], a.Position + new Vector3((float)Math.Cos(rot), 0f, (float)Math.Sin(rot)), 1);
                  if (v != null) Victims.Add(v);
               }
            }
         }
      }

      private void MyScript_Tick(object sender, EventArgs e) {
         for (int i = 0; i < Victims.Count; i++) {
            if (!Victims[i].IsAlive) {
               var a = Victims[i].LastAgressor;
               if (a != null) {
                  Victims[i].LastAgressor = null;
                  a.AwardPoint();
               }
            }
         }
         Wait(200);
      }

   }
Link
- < !!! Be Hazardous !!! > -
User avatar
Hazard
Hazardous Code Monkey
 
Posts: 185
Joined: 05 Jan 2006 19:49

Re: Bloody Mess: Adding more than one type of Victims

Postby ChessCheese1 » 20 Oct 2013 11:34

Thank you, Hazard. I copy-pasted it into bloodymess.cs but no one spawned :(. Maybe I did something wrong, but not sure what was it.
ChessCheese1
Peasant
Peasant
 
Posts: 7
Joined: 03 Sep 2013 13:44


Return to 'Die by the Sword' Fan and Modding Community



cron