| Home Page | Recent Changes | Preferences

Help Desk/Archive

This page is for any questions on the Help Desk that have already been answered. Use the quick navigation at the top to find the help topic you want. If you refactor the question, leave a link so people know where you put the answers to that question.

Health Mutator

I want a mutator to edit the healing amount of my Health Pickup class. The code below is what I have but it doesn't seem to be working... :( Can someone help me make this work ?

//=============================================================================
// MORHP
//=============================================================================
class MORHP extends TournamentPickup;

#exec OBJ LOAD FILE=MORMESHES.usx

defaultproperties
{
     HealingAmount=25
     PickupSound=Sound'PickupSounds.HealthPack'
     PickupForce="HealthPack"
     Physics=PHYS_Rotating
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'MORMESHES.MORHP'
     DrawScale=1.000000
     ScaleGlow=0.600000
     Style=STY_AlphaZ
     RotationRate=(Yaw=24000)
}

The Health Pickup

Class CONFIGHP extends Mutator Config(User);

var() config int HA;

function ModifyPickup(TournamentHealth Other)
{
    local MORHP x;
    x = MORHP(Other);

    if(x != None)
    {
        x.HealingAmount = HA;
    }
}

defaultproperties
{
    IconMaterialName="MutatorArt.nosym"
    ConfigMenuClassName="Mor.HPCONFIG"
    GroupName="Jumping"
    FriendlyName="MOR| Health Config"
    Description="Configure The Amount of Health."
}

The Mutator

Dragonmaw: From what I can tell you should make the code stand-alone, which means not relying on the TournamentHealth Pickup class, and instead creating a Class of your own, such as MORHealth and extending it to the TournamentPickup class. See if that helps

MythOpus: Well I've tried so many things to replace that , that i'm under the impression that I have bad code :(

GRAF1K: You probably shouldn't extend TournamentPickup, I think that's a generic pickup class, not health.

GRAF1K: Ah, yes, extends TournamentPickup...

Your mutator modifies TornamentHealth. ;-)

Replacing a Weapon

zabo: (yes, i'm an uscript noob) I want to replace a weapon, the shieldgun, with my own one.

because every player spawns with that weapon, replacing pickups or weaponbase wont work.

i tried this function:

 function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
 {
    if ( Weapon(Other) != None ) {
         if (string(Other.class) == "XWeapons.ShieldGun")
	     ReplaceWith( Other, "mymutator.MyShieldGun");
    }
    return true;
 }    

but it seems to have no effect. the weapon is still the same :(

i copied the code from http://wiki.beyondunreal.com/wiki/Weapon_Mutator_Tutorial and modified it,

but weapon is quite a big class, and i didnt find any weapontype for Weapon :(


Update:

Well, I managed to replace the weapons.

I tried three different ways to replace the shieldgun:

1) via

 if ( Other.IsA('xPawn') ) {
   xPawn(Other).RequiredEquipment[1] = "mymutator.MyShieldGun";

2) via getinventoryclassoverride

3) via defaultweaponname

everytime the same result:

it worked perfectly fine offline, but online i only spawned with biorifle in warmup mode and with assaultrifle ingame. i couldnt pick up any other weapons, they just dissappeared when i walked over them.

I seriously need some help here :(

Mysterial: UTClassic changes the default equipment using #1 (in CheckReplacement()) and it works fine offline and online. Since you mention warmup mode it's likely TTM is interfering. Try UTClassic with TTM and see if it works. If it does, I'm not sure what the problem is, but if it doesn't it's definately TTM, and you should probably talk to Pakman about it.


I just tried to replace the shieldgun with modifyPlayer.

again, same result.

my own shieldguncode just contains two changed functions ( checkreflect & adjustplayerdamage), nothing more

I dont see how this leads to those strange results.

i uploaded the code:

http://www.zaboron.de/ShieldGrenBioFix.uc

http://www.zaboron.de/NerfedShieldGun.uc

i'm really desperate here :(

thanks in advance,

zabo

Foxpaw: The best way to change the weapons is using CheckReplacement.. that seems to work pretty good.

Melaneus: I usually get the "can't pick up other weapons online" and other related stuff when I don't have a weapon package in the ServerPackages= lines of UT2003.ini. Did you place your custom shieldgun package there?

EntropicLqd: If you want to use a mutator in an on-line game then you musthave the package that the mutator is contained within in your ServerPackages= list on the server. Otherwise it won't work currectly. An exception to this may be a server side only mutator - but I've never tried it without having it specified in the Serverackages= list on the game server.

MythOpus: There's still something I don't understand. I can replace the xWeapon bases with my new weapon... but I can't replace the default weapons like The Assault Rifle or the Shield Gun.... Pweese Help ;)

Melaneus: One way to do this is to use GetInventoryClassOverride in the mutator to do this.

function string GetInventoryClassOverride(string InventoryClassName) {
    if ( InventoryClassName == "XWeapons.AssaultRifle") {
          InventoryClassName = "Replacement.Weapon1";
    }
    if ( InventoryClassName == "XWeapons.ShieldGun") {
          InventoryClassName = "Replacement.Weapon2";
    }
    if ( NextMutator != None )
        return NextMutator.GetInventoryClassOverride(InventoryClassName);
    return InventoryClassName;
}

MythOpus: Thx :) Thats helped me a great deal :D

Just a question

When you reference an "asset," such as a texture, material, sound, etc.. does this just make a pointer to the same asset or does it act like the "templates" created through the use of the begin object syntax. EG:

  var1 = Texture'Package.Tex';
  var2 = Texture'Package.Tex';

  var2.someproperty = bBoolean;

Does this affect the texture everywhere that it is used, or only that "instance" of the texture in var2?

Wormbo: You are referencing to the same object twice that way. var1.someproperty will be set to bBoolean in your example. What's more important is that if you modify anything that way it will remain changed until you quit the game, at least that's the case for classes.

Best place for mutator-friendly physics modifying? (2003-01-12)

I'm playing around with a mutator to apply damage from high-speed wall collisions(like Plunge). I'm just not sure of the best place to hack this in. Maintaining Compatibility page has a start by overloading PlayerController, but that doesn't seem like the best place for physics stuff–xPawn seems better, but I've no idea exactly where to slip it in. Along the same lines, how should this(and the PlayerController example) be started from a mutator properly?

Soldat: mutators have a thing called GameRules. look at mutators like MutVampire? and such. GameRules allow you to modify damage, prevent deaths, and all sorts of useful things. in this case, however, where you want to add damage code where there is presently none.. you have to think to yourself a few things....

first of all, if you are creating a new game type, then subclassing PlayerController and Bot? will do better. As a little note, in ut2k3's current code the hitwall and landed code is being procesed in the Controller code anyway. Besides, it gives more compatibility because mutators can't subclass PlayerController that I know of, so your new gametype will be the only one.

second of all, if you are creating a new mutator, then the only way you can do it is to subclass xPawn?. basically, you can replace it in the ModifyPawn function in the Mutator class. i'm sure you can find out how somewhere. then, you have to specify to the xPawn that you are deciding to handle your own hitwall and such. it's one of the properties. finally, this is less compatible because if you have a mutator that also subclasses Pawn, then you're basically screwed.

finally, i'm unsure, but you might be able to get away with putting HitWall code somewhere else like in the user's weapon. well, happy crashing.

Foxpaw: Soldat's advice is probrably the best. If those don't work, (I expect they will) you can use a mutator to attach a special actor to every player. This actor would be set to not block actors or traces, but to collide with the world and with actors. (for static mesh collisions) I don't remember the name of the function that is called when you touch BSP, but it's there somewhere. You can use Touch for collisions with static meshes. You can find the velocity if it is not provided by the function by storing the Delta from the Tick() function, and using (OldLocation - Location) / StoredDelta (OldLocation is the location of the actor last tick, and is stored in the actor class' Tick function. This was a bit erratic of an explanation. Let me know if you need clarification.

How do I apply an impulse/force to an Actor? (01-17-03)

AlphaOne: I know that there is a function KAddImpulse, but how does it work? Does it apply a force relative to the Actor or relative to the world space? Also, which is the best way to get something to rotate around one of it's axis? (thanks for help)

Chazums: For rotation you can spin a Actor around using SetRotation() and SetRelativeRotation()

Foxpaw: KAddImpulse takes two parameters, both vectors. The first is the direction and intensity of the impulse, made into a vector. The second is a vector indicating the point where the impulse should be applied, relative to the center of the object in question.

How to use modifcations? (2003-01-11)

Since I am an absolutele newbie to unrealscript, I've started playing around with weapons (as most do, I guess ;). Trystan/11 17 02c has a nice intro to that, I've also found a way to compile my new FlakRedeemer (thanks to umake), but I have no idea how to test it ingame...

Wormbo: You can use UT2k3's built-in Arena mutator. Just create an INT File for your weapon. Open xWeapons.int for an example.

How to trigger an emitter

Amstelbier: (n00b mode on:) I want to let an emitter emmit smoke at irregular intervals... How can i do this in UT2003? Also, i can't figure out how to attach a light to a mover... it should work, but doesn't for some reason. I tried setting 'Movable' to thrue and attached it's movertag to a mover but no light moving...

ZxAnPhOrIaN: ...

  1. Copy Light in editor.
  2. Paste into notepad.
  3. Add, without quotes, "bStatic=False" into the properties.
  4. Select all the text
  5. Copy it.
  6. Paste it into the editor.
  7. Delete the first light.
  8. If that works your done! ;) If that doesn't continue with the steps.
  9. Add a triggerlight.
  10. Set true the "bInitallyOn" function to "True".
  11. Go on from there.

ZxAnPhOrIaN: Update: tutorial on Movable Lights! :)

Foxpaw: As far as the emitter goes, it depends on what exactly you're looking for. Do you want smoke of varying density, an occasional geyser that will be gone long before the next one should go off, or random puffs being emitted here and there?

Changing a weapon in UT

Darthlore: I'm making a level that has alot of warp zones in it and want to know how to change the default weapon from the enforcer to the dispersion pistol just for my level wit no mod as it will work through the warp zones

ZxAnPhOrIaN: You could make a custom playerstart that changes the active weapon.

Darthlore: hmm if i could find where it gives it to you i was looking around for it but all i found is where you get given the impact hammer and it is in the actual game type under default weapon but no mention of the enforcer also for the custom playerstart i would not have the fogest where to start on it as i said need to find where it is given to u

Darthlore: Reading through the sub sub pages of the wiki I found in in the page for the enforcer that it is given to u by the game type death match plus and said that this could be intercepted using a SpawnNotify but it is not explaned how to link it to the actor that u want it to intercept does anyone know more about these

Foxpaw: You could use a mutator that is forced to load on that specific map. Using CheckReplacement in the mutator you could change all enforcers to dispersion pistols. If you still want the enforcer to be pickupable, you can still use CheckReplacement but you will have to probrably track the enforcer to find out if it is about to go on a player who just spawned before replacing it.

Chez: I could be off here, but I'm thinking you are wanting to know about Embedding Code or Writing And Using An Embedded Mutator into your map that will set the default weapon that all players spawn with. This is covered in the latter linked page as well.

GRAF1K: This would be my solution:

class myGame extends DeathMatchGame;

defaultproperties
{
    DefaultWeapon=(Your weapon)
}

Embed that in your map by opening your map and creating the class with myLevel in the package text box.

Trigonometry

I've been having difficulty figuring this out.. so I'm hoping that someone can give me an idea as to how it can be accomplished. I want to rotate a bone in a skeleton to cause another bone, connected to the first, to face a given direction. The problem being, bones use their own coordinate system that is unique to each bone. Therefore, it is not as simple as finding the difference in rotation between the two bones and the difference between the one bone and the rotation that I want it to have. I can determine the amount that the bone I want to rotate needs to be rotated by using the world coordinates.. but I have no idea how to turn this into the bone coordinates....

For example, I want to yaw a bone by 9000 URUs in the world coordinate system. However, that bone's coordinate system does not coincide with the world coordinate system. How can I calculate the equivalent rotation in the bone's coordinate system? EG the bone's "roll" is actually a "yaw" in the world coordinate system. (However, there is no way to know the actual transformation that must be made at compile time, so I'm looking for a coordinate rotation that will rotate a rotator.)

I hope that this is somewhat clear.. it's a bit difficult to explain. As an example you could lay your arm parallel to the ground. "rolling" it causes a "roll" in the "world coordinate system." If you crook your arm 90 degrees so your forearm points straight up, "rolling" it now produces a "yaw" in the "world coordinate system." I need a way to compute the opposite - given a rotation in world coordinates I need to convert that into the equivalent rotation in the bone's local coordinate system.

You need to use matrices to convert between different coordinate systems. Look up books on Linear Algebra. This sort of stuff is the first year of a university course, by the way. :)

Attaching Emitters and Lights to a Pawn

Trying to do two things and can't figure them out.

  1. I want to attach an emitter to a pawn. The emitter never shows up unless I turn on invisibility. Then I notice that the emitter IS showing up but that it's constrained to the mesh of the pawn (player). I'm looking at the glow for the Mutant gametype but haven't had much luck.
  2. I need to attach a light to a pawn. Exactly the way the flag carrier glows his color in CTF. I looked in CTFFlag, CTFGame, and even the various UDamage classes but don't ever see where a light is created and attached the the pawn's location. If there's a class I missed where this is demonstrated, please point it out to me...maybe my phrase for "find in files" was insufficient.

Worst case scenario, I'd at least like to attach a corona to the pawn's head...

Zxanphorian: Erm, look at the adreniline move's script, it might be there. I know speed makes emitters on there feet.

Kerlin: THANKS! I think that might be what I need...stay tuned... :) FYI: ComboSpeed attaches an emitter to each foot, SpeedTrail is the emitter definition.

Tarquin: You might want to note down what you learn on [Attaching to pawns]?. No need to write a full-blown tutorial, just put the basics if you can.

Kerlin: I'd be glad to, Tarquin. I'm always a little uncertain as to whether or not what I figure out should go in the wiki or if it's common sense to everyone else. :)

Kerlin: :( I ripped out the combospeed's code for attaching an emitter to a bone but it never "emits" in my game. I did a few Log() for "about to show effect", "in show effect", and "back from show effect"; it all seems in order. I'm not getting into trouble with xPawn == None because I added an else { Log("xPawn is None!"); }.

Could it be that the "head" bone is inside of the mesh and that the mesh is blocking the particles? It's not my emitter because I decided, for development, to use the emitter config from SpeedTrail. (Just want to make sure I've got a good solid working emitter)

Lastly, I don't want to lose the possibility of attaching a light so if you've a suggestion here I'm all ears.

Foxpaw: I believe that the light effect on players carrying the flag is not a separate light attached to the player but simply the players own light settings being changed. (or possibly those of the flag) but I could be wrong. I would try attaching those emitters to the feet bones that the combospeed uses. For some reason lots of the bones defined in the skeletal animation don't work when you try to access them from UnrealScript. Unfortunately, an "invalid bone" doesn't generate any log warnings or anything so it can be difficult to tell if you've got the right bone name - some of them do not correspond to what the animation browser says, as far as I can tell.

Kerlin: Will try and advise. Thanks again!

Kerlin: I will refactor all of this once I get emitters back in. In the mean time, here's the short version for giving the player a glow similar to a flag carrier. It was really super easy as you can see:

class xMyPawn extends xPawn;

simulated function TickFX(float DeltaTime)
{
    LightHue=0; // red
    LightRadius=4.500000;
}

Not 100% certain that should be in TickFX but it's working for me. It would probably be much better to just have a call to your own LightsUp() and LightsDown() functions rather than adjusting color and radius every time TickFX is called.

GRAF1K: This is found in xPawn's TickFX function (notice if ( LeftMarker == None && !bInvis )):

    if ( LeftMarker == None && !bInvis )
    {
        LeftMarker = Spawn(class'PlayerLight',self,,Location);
        if( !AttachToBone(LeftMarker,'lshoulder') )
        {
            log( "Couldn't attach LeftMarker to lshoulder", 'Error' );
            LeftMarker.Destroy();
            return;
        }

        RightMarker = Spawn(class'PlayerLight',self,,Location);
        if( !AttachToBone(RightMarker,'rshoulder') )
        {
            log( "Couldn't attach RightMarker to rshoulder", 'Error' );
            RightMarker.Destroy();
            return;
        }
            
        LeftMarker.SetRelativeLocation(LeftOffset);
        RightMarker.SetRelativeLocation(RightOffset);
        if ( PlayerReplicationInfo.Team.TeamIndex == 0 )
        {
            RightMarker.Texture = Texture'RedMarker_t';
            LeftMarker.Texture = Texture'RedMarker_t';
        }
        else
        {
            RightMarker.Texture = Texture'BlueMarker_t';
            LeftMarker.Texture = Texture'BlueMarker_t';
        }
    }
    else if( LeftMarker != None && bInvis )
    {
        LeftMarker.Destroy();
        RightMarker.Destroy();
    }

Scoring

Yes, some of you will laugh at this, because I'm pretty sure that the answer is simple and it's right in front of me. Sigh. Okay, so I'm working on a gametype, and I want a point to be taken away from the team when someone on that team is killed. I'm working with the Killed() function.

function Killed( Controller Killer, Controller Killed, Pawn KilledPawn, class<DamageType> damageType )
{
    if ( (Killer != None) && Killer.bIsPlayer && Killed.bIsPlayer &&
         (Killer.PlayerReplicationInfo.Team != Killed.PlayerReplicationInfo.Team)
         && (xPawn(Killer.Pawn) != None) && (DisabledCountDown > 0))
    {
        Killer.AwardAdrenaline(ADR_MinorBonus);
        
        // take away a point from the killed person's team
        Killed.PlayerReplicationInfo.Team.Score -= 1;
    }

    Super.Killed(Killer, Killed, KilledPawn, damageType);
}

It's not working. I'm using WOTgreal, and when I type Killer. a context menu comes up. When I type Killed. nothing happens. They're both Controllers, so why am I getting a context menu for one but not the other? That's just a symptom of the problem, the problem being that Killed.PlayerReplicationInfo.Team.Score -= 1; isn't working at all. Any thoughts?

RDGDanClark: Okay, I figured it out :)

The problem was when the conditions in the if statement checked for (DisabledCountDown > 0)... it turns out that I had forgotten that I was no longer using DisabledCountDown but that I hadn't taken it completely out of the code, so it was being initialized to 0 and never changing to a different value. Hence, the if statement condition would always return false and the body would never execute.


The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In