RuneStorm
http://www.runestorm.com/forums/

Some Help about BW and Unrealscript
http://www.runestorm.com/forums/viewtopic.php?f=69&t=77670
Page 1 of 1

Author:  Parapeplum [ Mon Apr 29, 2013 1:25 pm ]
Post subject:  Some Help about BW and Unrealscript

Hi there,
I'm trying to create a new gameplay (http://www.runestorm.com/forums/viewtopic.php?f=95&t=77665) based on BW.

I would restrict the behaviour to have BW features, should I turn all the xPawn into BallisticPawn with BallisticPawn(***.Pawn) or I need more things? ( maybe use Ballistic Player?).

I can compile my gametype class without errors and start a game but my log is full of warnings and I have less errors(4).

the errors:

Function BwHunterGame.BwHunterGame.PostBeginPlay:00B0) Accessed array 'PlayerStatus' out of bounds (0/0)

edit :
What I tried to do.

when the game starts I initialize/fill an array with the controllers in game to give them a extra attribute to know if it a Hunter or not.
when its done I pick randomly 2 players in that array and turn them into Hunters, make them invisible and give them weapons.

I made that instead of using teams to have a score for each player like in DM.


Code:
var array<HunterPlayerStatus> PlayerStatus;
// ============================================================================
//   Just after the game starts
//   - Select randomly 2 HUNTERS among players
//   - Turn HUNTER Invisible
//   - Load HUNTER Inventory with Melee Weapons 
//   - Give HUNTED Weapons
//============================================================================
function PostBeginPlay()
{

   //Initialize PlayerStatus array with all controller in the level    

   InitStatusArray(PlayerStatus);
   
   //Select Randomly 2 Hunters and fill the Players Status
   HunterIndex1 = Rand(PlayerStatus.Length);
   HunterIndex2=  Rand(PlayerStatus.Length);
         
   Log("HunterIndex1");
   Log("HunterIndex2");
   
   //In case we picked the same Hunter two times
   /*if (HunterIndex1 == HunterIndex2)
   {
      //pick another hunter randomly until its different from the first one
      do {
            HunterIndex2=  Rand(PlayerStatus.Length);
 
      } until (HunterIndex2 != HunterIndex1);
   }*/

   //Turn all the other player into Hunted

   for (CurrentIndex=0; CurrentIndex < PlayerStatus.Length; CurrentIndex++ )
   {
      If (CurrentIndex != HunterIndex1 || CurrentIndex != HunterIndex1  )
         PlayerStatus[CurrentIndex].isHunter =false;
   }
   //Turn Invisible Hunters

   SetHunter(PlayerStatus[HunterIndex1].Player, BallisticPawn(PlayerStatus[HunterIndex1].Player.Pawn));
   SetHunter(PlayerStatus[HunterIndex2].Player, BallisticPawn(PlayerStatus[HunterIndex1].Player.Pawn));

   //Give Hunters Melee Weapons
   EquipHunter(BallisticPawn(PlayerStatus[HunterIndex1].Player.Pawn));
   EquipHunter(BallisticPawn(PlayerStatus[HunterIndex2].Player.Pawn));
}
// ============================================================================
//   Initialize the Status array
============================================================================

function InitStatusArray(array<HunterPlayerStatus> ArrayToInitialize)
{
   local controller P;
   local int i;
   
   i=0;
   for(P = Level.ControllerList; P != None; P = P.nextController)
   {
      //if (P != Level.controllerList && P != None )
      //{
         ArrayToInitialize[i].Player= P;
         ArrayToInitialize[i].isHunter =false;
         i++;
      //}
   }

}

Author:  Braethias [ Mon Apr 29, 2013 1:54 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

as that code is foreign to me, all I can suggest is spelling check and punctuation check. When I hear of coding issues that seems to be a fairly common one.

Author:  Parapeplum [ Mon Apr 29, 2013 2:24 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

Thanks.

I've checked all that could see on my own and completed all that UCC highlighted at compilation.

Maybe I missed something or a better way to do what I tried, I dont know....

Should I explain more precisely what I tried to do?

Author:  Braethias [ Mon Apr 29, 2013 10:47 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

I'm sure it would be helpful to someone that might be able to help you out better, but it wouldn't do me any good. :lol:

edit: perhaps write it out once more in a different way? Maybe you'll catch something that way?

Author:  Captain Xavious [ Tue Apr 30, 2013 9:34 am ]
Post subject:  Re: Some Help about BW and Unrealscript

Out of bounds for an Array means its looking for an item outside the bounds of the array, doesn't it? Maybe try moving the check a couple seconds into the game to account for players joining at different times, and maybe make sure you have a backup plan in case there isn't three or more players?

I'm not particularly good at code, I only know enough to get basic things sort of working, so my advice might not be 100% useful. I really want to see this game type working, sounds an awful lot like Halo's infection game type, which I would love to see for BW.

Author:  Parapeplum [ Tue Apr 30, 2013 11:09 am ]
Post subject:  Re: Some Help about BW and Unrealscript

Captain Xavious wrote:
Out of bounds for an Array means its looking for an item outside the bounds of the array, doesn't it?


sure. but I dont know how to interpret the whole message: the (0/0) at the end is confusing because index of an array
can go from 0 to numberOfElement-1 and I took care to start at 0...

Captain Xavious wrote:
Maybe try moving the check a couple seconds into the game to account for players joining at different times, and maybe make sure you have a backup plan in case there isn't three or more players?


great info! I not thought about it. the backup plan seems to be easy to make.

Author:  Captain Xavious [ Tue Apr 30, 2013 8:52 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

Well, I kinda expect that maybe the array isn't fully built yet due to timing perhaps? I don't think bots spawn in initially and actually spawn in immediately at round start, which would be after PostBeginPlay. But I'm not really sure to be honest. Having something in place for when there isn't enough players in play would probably clear it up.

Also maybe try moving some of it to PreBeginPlay?

Author:  Parapeplum [ Wed May 01, 2013 8:37 am ]
Post subject:  Re: Some Help about BW and Unrealscript

I change my way.

There is a function (StartMatch) called when we click to start the game after the 5s count.
I put my code here and it works.

I solved the array problem: the first time I declared and used an array without any slot in it :?
I just needed to add a new slot for any new player.

Author:  Captain Xavious [ Wed May 01, 2013 8:56 am ]
Post subject:  Re: Some Help about BW and Unrealscript

Oh cool!

Author:  Braethias [ Wed May 01, 2013 4:35 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

I helped! And if I didn't actually, I like to think I did! :dance:

Author:  Parapeplum [ Thu May 02, 2013 2:46 am ]
Post subject:  Re: Some Help about BW and Unrealscript

You did it and you will have others chances to do it again ;)
I'm at the really start of the work

Author:  Braethias [ Thu May 02, 2013 2:52 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

So what is this supposed to do? One guy is the predator, everyone else has to kill him?

Author:  Parapeplum [ Fri May 03, 2013 8:34 am ]
Post subject:  Re: Some Help about BW and Unrealscript

Braethias wrote:
So what is this supposed to do? One guy is the predator, everyone else has to kill him?


almost...
We have 2 type of players: hunters and hunteds. The hunteds have to survive the whole round duration.
Difficulty (especially for hunteds) goes up with time because the hunters have extra life, shield, abilities
(invisibility, maybe speed and other).Also they can always respawn and turn Hunted to Hunter by killing them.
Hunters are randomly chosen each round.

Author:  Braethias [ Fri May 03, 2013 3:03 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

Ooh. it's like that one game mode i know of but can't recall the name of. zombie infection or mutant or w/e

Author:  Captain Xavious [ Fri May 03, 2013 8:15 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

Pretty much Halo's Infection game type.

Hopefully when he gets more complete there'd be some options to maybe give the hunters alternatives to invisibility like regeneration, speed, or berserk so that you got some nice variety in the game play.

Either way, I have a pretty good feeling this will be pretty awesome once he gets it done.

Author:  Braethias [ Fri May 03, 2013 11:01 pm ]
Post subject:  Re: Some Help about BW and Unrealscript

that game has modes other than swords and rockets? what?

Huh.

Author:  Parapeplum [ Sun May 19, 2013 7:47 am ]
Post subject:  Re: Some Help about BW and Unrealscript

Hi guys.

Are you interested in testing? now I have a "playable" version that still need work
to be released as a beta and an external point of view is welcome.

Author:  Captain Xavious [ Sun May 19, 2013 8:42 am ]
Post subject:  Re: Some Help about BW and Unrealscript

Sign me up!

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/