Could be asleep, typing random messages instead.

UScript: Chat, Questions, Discussion

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: ividyon, Semfry, zYnthetic

User avatar MrLoathsome
Skaarj Lord Skaarj Lord
Posts: 151
Joined: 01 Jan 2009, 08:24
Location: MrLoathsome fell out of the world!

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 01 May 2012, 06:15

You could try having them find a new enemy soon as they infect their object.

I have a similar sort of thing happening for the next version of BadNews.

This bit is in MutatorTakeDamage, and causes InstigatedBy to find a new enemy, and
also sets the new enemy's Enemy to be the InstigatedBy pawn.

This gets called if the Victim is about to die...

Code: Select all

      if (InstigatedBy.IsA('ScriptedPawn'))
      {
         if (Victim.bIsPlayer) Victim.PlayerReplicationInfo.Deaths += 1;
         foreach RadiusActors(class'Pawn', aVictim, attackRadius, InstigatedBy.Location)
         {
            if ((!aVictim.isA('PlayerPawn')) && (aVictim != Victim) && (aVictim.Health > 0)
                && (InstigatedBy.Enemy != aVictim)&& (InstigatedBy != aVictim))
            {
               racnt++;
               InstigatedBy.Enemy = aVictim;
               if (aVictim.bIsPlayer) aVictim.Enemy = InstigatedBy;
                    else if (ScriptedPawn(aVictim) != None)
                    {
                     ScriptedPawn(aVictim).OldEnemy = aVictim.Enemy;
                     aVictim.Enemy = InstigatedBy;
                     ScriptedPawn(aVictim).Hated = InstigatedBy;
                     if (ScriptedPawn(aVictim).SetEnemy(InstigatedBy)) { ScriptedPawn(aVictim).GotoState('Attacking'); }
                    }
               if ((ScriptedPawn(InstigatedBy).SetEnemy(aVictim)) || (aVictim.bIsPlayer))
               {
                  if (InstigatedBy.Enemy != None) InstigatedBy.gotostate('Attacking'); else InstigatedBy.gotostate('Wandering');
                  break;
               }
            }
         }
         if (racnt == 0) attackRadius += attackRadius * 0.25; else attackRadius -= attackRadius * 0.25;
         FClamp(attackRadius, 20.0, 12000.0);
//         log("MTD --> attackRadius: "[email protected]" racnt: "$racnt);
      }


Been working very well in testing so far, with both bots and scriptedpawns.
Mooo !

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 01 May 2012, 10:54

the freeze is probably caused by an infinite state loop. In the morning I'll check it out, for now it's time to sleep(random_sleep_skew())

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 01 May 2012, 19:40

Seems this fixes it. It goes into state attacking and avoids the state loop plus reassesses enemy status with attitude to.. assuming UT's scripted pawn code is unchanged that is!

Code: Select all

function WhipDamageTarget()
{
   local BrussalidInfection B;

   if( target!=none )
   {
      if( Target.bIsPawn && bCanInfect(Target) )
      {
         B = Target.Spawn(Class'BrussalidInfection', Target);
         if(B!=none)
         {
            B.Instigator = self;
            GoToState('Attacking');
          }
      }
   }
   PlaySound(PistolWhip, SLOT_Interact,,,, 0.75);
}


edit: Target = None shouldn't be there after some checking the code

User avatar Buff Skeleton
>:E >:E
Posts: 4160
Joined: 15 Dec 2007, 00:46

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 01 May 2012, 20:38

Ah! Yes, I shoulda known that. I've run into this same problem a few times before with custom attack states. And I'm sure that will take care of it, thanks.

I may have to do some more fenangling to get them to attack (but not infect) any already-infected or uninfectable targets that attack them first, however. Wouldn't want the Brussalid to ignore a Charger just because the Charger got infected! That would be a deadly mistake.

DEUDLY WHACKS



I take it the attack-on-sight behavior is limited to just playerpawns, then, at least under UT? I thought 227 introduced a variable that allows pawns to be set up to hate on sight other pawns, but that might be native code I don't have access to here :<
Image

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 01 May 2012, 22:54

Not possible to edit for UT, you have to do a hack with foreach visiblecollidingactors and SetEnemy over them in order until it returns true. Shit sucks.

User avatar Buff Skeleton
>:E >:E
Posts: 4160
Joined: 15 Dec 2007, 00:46

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 01 May 2012, 23:08

Blargh! Well, I will try that out and see if it's feasible without massive slowdown (do you know what Lavagiant with over 500 Brussalids runs like?), but may just have to scrap that! Thanks for the help though, it is very much appreciated.

New query:

Pawn Tags. I want to do this for EXUScriptedPawn so I can configure multiple different strings for each pawn and make it easier to categorize them (and do things to certain categories, such as in the Brussalids' case, make them unable to infect Bugs or Robots).

Right now, I have var String PawnTags, but I'm not sure if this will allow me to separate tags by commas or whatever. I'm also unsure how I would be able to check to see if a Pawn has one tag while ignoring other tags it may have regardless of their order, like if I have a FlyingPawn,Boss,Robot,Bug all in one PawnTags list for some kind of mech fly or something, how would I check only for the Robot tag, or check for both the Robot & Bug tags or either of them?

Once I get something like this working, I can imagine some pretty cool specialized projectiles, like a gas grenade that kills all Bugs (RAID!) regardless of what CLASS they actually are. Would save a lot of conditional if/else comparisons and make checking conditions very fast, I imagine.

I could also see things like grouping Pupae, Queens, Warlords, Skaarj, and Slith under the SkaarjFamily tag. Even though they're disparate classes and different species, they could all be effected by a similar neurotoxin or something along those lines. I could also make anti-air weapons that shoot down all AirUnit pawns, whether they be Mantas, Gasbags, Warlords, or Archdemons (Titans)! I'd also expand this system to EXUGenericProjectiles and have Ballistic, Energy, Missile, etc. type weapons, so you could easily create anti-missile systems that work for ALL missile types, even custom ones (so long as the modder specifies the proper tag).
Image

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 01:34

Easiest way I can think of {since it will be static for the majority} is make something like var() name PawnTags[64]; and fill them individually/check individually, you really shouldn't need to parse a string for something like that unless it's really dynamic like adding prefix/suffix to things. Besides, that makes it a bit easier with the a for loop checking each array index individually until you find a 'None' entry.. since I'm assuming all of this madness will be hard coded to check against. i.e. Pawn X can do something against pawn Z but not pawn Y because Y has a similar flag to X but it doesn't to Z, but then Z could later gain the similar flag, but X isn't changing what it's searching for. Make sense?

tl;dr shit is situational but this is doable no matter how you want it

User avatar Buff Skeleton
>:E >:E
Posts: 4160
Joined: 15 Dec 2007, 00:46

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 04:01

OK, that makes sense. I'll do that! I guess just iterating through the list of tags every time you want to check a condition would be alright, especially since I don't see this happening very often ingame (except for things like specialized gas grenades, but still).

[Edit] Update: PawnTags are in, and they work beautifully! I made an EXUStaticFuncs static function for checking, so it can be accessed anywhere. Hell yeah


Now, PLEASE tell me there is a less godawful way to do this:

Code: Select all

   if(   Pawn(Other).FindInventoryType(class'EXUShieldBelt')!=none ||
      Pawn(Other).FindInventoryType(class'HeavyShieldBelt')!=none ||
      Pawn(Other).FindInventoryType(class'UltraBelt')!=none ||
      Pawn(Other).FindInventoryType(class'UT_ShieldBelt')!=none ||
      Pawn(Other).FindInventoryType(class'PowerShield')!=none ||
      Pawn(Other).FindInventoryType(class'ShieldBelt')!=none )
      return false;   // There HAS to be a way to look for subclasses, not just individual classes for this, right?


I'm adding a shieldbelt check to bCanInfect in the Brussalid, so if the player has a shield it can't get infected. When I check for JUST the parent classes (EXUShieldBelt, UT_Shieldbelt, and Shieldbelt) it of course only looks for those specific classes.

Could I at least use some kind of foreach, maybe childactors? I don't know if inventory count as childactors when they are attached to a pawn, though.

Also, unrelated but, is there a way to REMOTELY force a pawn to always gib? I have a takedamage call when a new Brussalid spawns that does the owner.default.health * 100000 (no kidding, that didnt work) but it doesn't always gib the carcass(!). I could probably use a shitty hack, like a small hurtradius2 that does a billion damage and only affects carcasses within a tiny radius, but that's silly.
Image

User avatar Pcube
Banned Banned
Posts: 45
Joined: 10 Mar 2009, 10:55
Contact:

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 07:11

Automation is one of the cornerstones of computing. Where you see redundancy there is always opportunity for automation...

Code: Select all

Pawn(Other).FindInventoryType(class'EXUShieldBelt')!=none ||
Pawn(Other).FindInventoryType(class'HeavyShieldBelt')!=none ||
Pawn(Other).FindInventoryType(class'UltraBelt')!=none ||
Pawn(Other).FindInventoryType(class'UT_ShieldBelt')!=none ||
Pawn(Other).FindInventoryType(class'PowerShield')!=none ||
Pawn(Other).FindInventoryType(class'ShieldBelt')!=none )


Pawn(Other).FindInventoryType( X ) != None is the key here.

You could do something like this:

Code: Select all

function bool blah()
{
local class<actor> check_classes[8];
local int iter;
local bool pcubes_post;

check_classes[0] = class'exushieldbelt';
check_classes[1] = ...
...
check_classes[7] = class'shieldbelt';

  pcubes_post = false;
  for( iter = 0; iter < arraycount(check_classes); iter++ )
  {
     pcubes_post |= pawn(other).findinventorytype( check_classes[iter] );
  }

  return pcubes_post;
}


Note that the above can be optimized. It's left as |= to mimic the original code.
Coder/Mapper for the UDHQ Development Team

Check out the latest in Unreal 1 Development at the Unreal Development Headquarters -- Bringing new and exciting content to Unreal for over 5 years!
Image
The UDHQ Website

User avatar Buff Skeleton
>:E >:E
Posts: 4160
Joined: 15 Dec 2007, 00:46

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 07:16

That definitely is much better, though I take it there's no way to cover future subclasses? So if someone made a subclass of EXUShieldBelt to add charge to it or something, it would have to be specified manually? Too bad.

I'll definitely clean up that ugly pile of redundant code though, thanks.

Brussalids are pretty awesome now. I have it set up so that each child loses some health until it has passed 6 generations, at which point the 6th gen spawn gets reset back to the original amount. Means that you get nice big hordes, but only a handful of them are at full power, while many of them are weak end-of-the-line generations that are more easily dispatched \o/
Image

User avatar Pcube
Banned Banned
Posts: 45
Joined: 10 Mar 2009, 10:55
Contact:

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 07:29

Oh... sorry I didn't understand the original question.

FindInventoryType does some bullshit with ClassIsChildOf. You can easily roll yor own function that uses IsA (which will cover child classes like you say). Just traverse over the inventory list and use IsA, eventually returning true if you found an inventory in the chain that IsA whatever the input to the function is.

function PlayerHasInventorySubclass( name target )
{
// traverse it
for each inventory in player's list...

if inv.IsA(target) return true;

return false;
}
Coder/Mapper for the UDHQ Development Team

Check out the latest in Unreal 1 Development at the Unreal Development Headquarters -- Bringing new and exciting content to Unreal for over 5 years!
Image
The UDHQ Website

User avatar Buff Skeleton
>:E >:E
Posts: 4160
Joined: 15 Dec 2007, 00:46

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 07:32

Oh! That makes perfect sense! I'll get on that tomorrow. It's 1:30AM here now and I only got 5 hours of sleep last night. Time to change THAT.

Then again, I got so much stuff done after work today, I'm starting to wonder if 5 hours of sleep is more my style

(Literally haven't stopped coding/testing stuff since 4:30PM)
Image

User avatar Buff Skeleton
>:E >:E
Posts: 4160
Joined: 15 Dec 2007, 00:46

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 02 May 2012, 17:13

Sweet! Everything is working now, quite well in fact. Here's what I ended up doing:

[Edit2] OK this is still buggy in some spots, will update later

[Edit] Actually I got a bug, no ScriptedPawns are being infected. I think I know why. It's the tag checker; I think it's returning true no matter what. Fixing! Fixed

Thanks everyone for all your help so far! And other people, don't be afraid to ask your own questions if you have been ;)

[Edit] also we could really use syntax highlighting on these boards. Wonder if the code tags can be set up to do that?
Image

User avatar TheIronKnuckle
Gilded Claw Gilded Claw
Posts: 1966
Joined: 12 Nov 2007, 07:21
Location: Riding my bicycle from the highest hill in Sydney to these forums

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 04 May 2012, 16:56

I kinda prefer it without syntax highlighting tbh. would be cool if there was a toggle option
ImageIgnorance is knowing anything
And only idiots know everything

dizzy
Pupae Pupae
Posts: 1
Joined: 10 May 2012, 01:44

Subject: Re: UScript: Chat, Questions, Discussion

Post Posted: 10 May 2012, 01:50

Hi guys :)

I've spent the past few hours searching for a way to skip the "death animation" sequence a player makes when he dies. Specifically when the player types "suicide" in the console, I'd like them to instantly respawn instead of the death animation playing and having to click the mouse button to respawn again.

The hard part has been finding out how to skip the death animation. I THINK it's controlled by the function PlayDying() inside the PlayerPawn class and its subclasses, and I have a theory that if I can override that function with an empty function of my own, it might be skipped altogether. However I do not know how to override a function of PlayerPawn.

I would rather not replace every PlayerPawn in the game with my own custom Pawn class, because other mutators might barf at that. So... is there a way to skip the "PlayDying()" death animation sequence for a PlayerPawn?

My code so far (inside my main class file) is thus:

Code: Select all

function tick(float DeltaTime)
{   
   local PlayerPawn PP;
   local int i;
   Super.tick(DeltaTime);

   foreach AllActors(class 'PlayerPawn', PP) {
      if(PP.Player != None) {
         // Check if player is dead, and if so, respawn them
         if (PP.Health <= 0) {
// *************** Here is where we should somehow skip the death animation ******************
            ForceRespawn(PP);
         }
      }
   }
}

function ForceRespawn(PlayerPawn PP) {
   PP.Weapon.bCanThrow = False;
   Level.Game.DiscardInventory(PP);
   
   // Stop the player
   PP.AddVelocity(-PP.velocity);
   PP.Acceleration = vect(0, 0, 0);
   PP.SetPhysics(PHYS_None);

   // If not the end of game, teleport the player to the start point
   if(!Level.Game.bGameEnded)
   {
      Level.Game.PlayTeleportEffect(PP, True, True);
      PP.bHidden = True;
      PP.SoundDampening = 0.5;
      PP.GoToState('Dying');
      PP.ServerReStartPlayer();
   }
   return;
}


Thanks :)

Previous Next

Who is online

Users browsing this forum: No registered users and 3 guests

Copyright © 2001-2020 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited