Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

How to setup Hitmasks

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    Grouppawn:

    Code:
    class GroupPawn extends UTPawn;
    
    var bool NoDodge;
    var float CurSpeed;
    var bool NeedREffect;
    var ParticleSystemComponent BigFireEffect;
    var bool IsFireEffect;
    var bool XRayMode;
    var array<MaterialInterface> XRayMatCopy;
    var array<MaterialInterface> OriginalMats;
    var string ClassGroup;//Enemy,Friend,Partner,Player...
    var bool todel;
    var bool showhealthbar;
    var bool PawnSel;
    var ActorComponent Mark;
    var ActorComponent NightLight;
    var ActorComponent LightXRay;
    var bool IsNightLight;
    struct EffectDef
    {
     var string nm;
     var string ttl;
     var int tm;
     var float power;
     var Actor act;//instigator
    };
    struct PersonState
    {
    	var int invulnerability;
    	var int friendship;
    	var int friendshipmin;
    	var int friendshipmax;
    	var float RegenTime;
    	var float healthreg;
    	var int mana;
    	var int manamax;
    	var int manareg;//mana regeneration
    	var int stamina;
    	var int staminamax;
    	var int staminareg;//stamina regeneration
    	var int energy;
    	var int energymax;
    	var int energyreg;//energy regeneration
    	var int armor;
    	var int defence;
    	var array<EffectDef> EffectsList;
    };
    var PersonState perspoints;
    var float CamOffsetDistance;
    var float IsoCamAngle;
    var vector StratViewLoc;var rotator StratViewRot;
    var string AfterInv;//Body inventory
    var int PawnId;//Custom number...
    var string PawnTitle;//Custom name...
    var SoundCue SpeakSnd;//
    var string SpeakText;
    var bool iskilled;//Iskilled flag...
    var string AfterInvTitle;//Body inventory title...
    var string shopitems;
    var int shopmoney;
    var float shopbuy;
    var float shopsell;
    var string shoptitle;
    var bool istrader;
    var bool istalker;
    var bool isdialogable;
    var string curdialog;
    var float ElapsedRegenTime;//Regeneration vars
    
    var float camdistscale;//Camera Distance multiplier for third person camera
    
    struct PartDef
    {
    	var SkeletalMesh mesh;
    	var array<MaterialInterface> tex;
    };
    struct PartsSaveDef
    {
    	var array<PartDef> parts;
    	var SkeletalMeshComponent DefMesh;
    };
    var int CurGrenadeType;
    var bool bCanThrowGrenade;
    var array<int> GrenadeCount;
    var bool bThrowingGrenade;
    var float ThrowTime;
    var float SpawnGrenTime;
    var int CurThrowed;
    function int AddGrenades(int tp,int n)
    {
    	local int n1,i;
    	if(tp>=GrenadeCount.length)
    	{
    		n1=GrenadeCount.length;
    		GrenadeCount.length=tp+1;
    		for(i=n1;i<=tp;i++)GrenadeCount[i]=0;
    	}
    	GrenadeCount[tp]+=n;
    	return 0;
    }
    
    
    function AddFriendship(int val)
    {
    	perspoints.friendship+=val;
    	if(perspoints.friendship<perspoints.friendshipmin) perspoints.friendship=perspoints.friendshipmin;
    	if(perspoints.friendship>perspoints.friendshipmax) perspoints.friendship=perspoints.friendshipmax;
    }
    
    //Grenade Throw function
    function ThrowGrenade()
    {
    	local AnimNodePlayCustomAnim cust;
    	if(!bCanThrowGrenade||bThrowingGrenade||GrenadeCount[CurGrenadeType]<=0)return;
    	bThrowingGrenade=true;
    	if(GrenadeCount[CurGrenadeType]>0)
    	{
    		cust=AnimNodePlayCustomAnim(Mesh.FindAnimNode('CustomAnim'));
    		cust.PlayCustomAnim('ThrowGrenade',1.0,0.1f,0.1f,false,true);
    		SetTimer(SpawnGrenTime,false,'CreateGrenade');
    		CurThrowed=CurGrenadeType;
    	  SetTimer(ThrowTime,false,'DecreaseGrenades');
    	}
    }
    simulated function DecreaseGrenades()
    {
        if(GrenadeCount[CurThrowed]>=0)GrenadeCount[CurThrowed]--;else GrenadeCount[CurThrowed]=0;
        bThrowingGrenade=false;
    }
    
    simulated function CreateGrenade()
    {
    	local Projectile SpawnedGrenade;
    	local float theta;
    	local vector SpreadVector;
    	local rotator Aim;
    
    	Aim=Rotation;//Weapon.GetAdjustedAim(Location);			// get fire aim direction
    	// Give the grenade some gradual spread.
    	theta = FRand()/10.0;
    	SpreadVector.X=Cos(theta);
    	SpreadVector.Y=Sin(theta);
    	SpreadVector.Z=0.0;
    	SpawnedGrenade = Spawn(Class 'UTProj_Grenade',,,Location,Rotator(SpreadVector>>Aim));
    	UTProjectile(SpawnedGrenade).TossZ+=(FRand()*250-50);
    	SpawnedGrenade.Init(SpreadVector>>Aim);
    }
    
    function PartsSaveDef DoSave()
    {
    	local PartsSaveDef p;
    	return p;
    }
    function DoLoad(PartsSaveDef p)
    {
    }
    
    function ClearEffects()
    {
    	local int i;
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		DelEffect(0);
    	}
    	perspoints.EffectsList.length=0;RestartEffects();
    }
    function float SumEffect(string nm)
    {
    	local int i;local float sum;sum=0;
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		if(perspoints.EffectsList[i].nm==nm) {sum+=perspoints.EffectsList[i].power;}
    	}
    	return sum;
    }
    function bool IsEffect(string nm)
    {
    	local int i;
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		if(perspoints.EffectsList[i].nm==nm) return true;
    	}
    	return false;
    }
    function AddEffect(string nm,string ttl,int tm,float pw,Actor act)
    {
    	local int n;
    	if(nm=="despell") {perspoints.EffectsList.length=0;RestartEffects();return;}
    	if(nm=="despelllong") {perspoints.EffectsList.length=0;}else {if(IsEffect("despelllong"))return;}
    	n=perspoints.EffectsList.length;
    	perspoints.EffectsList.length=n+1;
    	perspoints.EffectsList[n].nm=nm;
    	perspoints.EffectsList[n].ttl=ttl;
    	perspoints.EffectsList[n].tm=tm;
    	perspoints.EffectsList[n].power=pw;
    	perspoints.EffectsList[n].act=act;
    	//You can add manual adding visual effect and return after it or use RestartEffect
    	RestartEffects();
    }
    function TexturesClear()
    {
    	local int i;
    	for(i=0;i<Mesh.Materials.length;i++)
    	{
    		if(i>=OriginalMats.length){Mesh.SetMaterial(i,None);continue;}
    		Mesh.SetMaterial(i,OriginalMats[i]);
    	}
    }
    function TurnFrostOn()
    {
    	local int i;
    	for(i=0;i<Mesh.Materials.length;i++)
    	{
    		Mesh.SetMaterial(i,Material'Envy_Level_Effects_2.Materials.M_VH_Snow');//material must has a Used with skeletal mesh checkbox enabled this is not by default
    	}
    }
    function TurnStoneOn()
    {
    	local int i;
    	for(i=0;i<Mesh.Materials.length;i++)
    	{
    		Mesh.SetMaterial(i,Material'phystest_resources.ClothMaterial');
    	}
    }
    function TurnInvisibilityOn()
    {
    	local int i;
    	for(i=0;i<Mesh.Materials.length;i++)
    	{
    		Mesh.SetMaterial(i,Material'HU_Deck.SM.Materials.M_HU_Deck_SM_Fwindow_Glassbroken2_Mat');//material must has Used with a skeletal mesh checkbox enabled this is not by default
    	}
    }
    function TurnStasisOn()
    {
    	local int i;
    	for(i=0;i<Mesh.Materials.length;i++)
    	{
    		Mesh.SetMaterial(i,Material'UN_Misc.BSP.Materials.M_UN_Misc_BSP_FlourescentLight01');//material must has Used with a skeletal mesh checkbox enabled this is not by default
    	}
    }
    function TickEffects()
    {
    	local int i;local float spd;
    	spd=CurSpeed;
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		if(perspoints.EffectsList[i].nm=="speed")spd+=perspoints.EffectsList[i].power;
    		if(perspoints.EffectsList[i].nm=="relspeed")spd*=perspoints.EffectsList[i].power;
    	}
    	GroundSpeed=spd;AirSpeed=spd;
    }
    
    function RestartEffects()
    {
    	local int i;local bool xr;
    	//All functions delete all effects and add it again
    	xr=XRayMode;
    	//Turn off all effects
    	XRayInt(false);
    	TexturesClear();//Original textures
    	TurnFireMode(false);
    	CustomTimeDilation=1.0;
    	//Turn on new effects
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		if(perspoints.EffectsList[i].nm=="fire")TurnFireMode(true);
    		if(perspoints.EffectsList[i].nm=="frost")TurnFrostOn();
    		if(perspoints.EffectsList[i].nm=="invisibility")TurnInvisibilityOn();
    		if(perspoints.EffectsList[i].nm=="stasis")TurnStasisOn();
    		if(perspoints.EffectsList[i].nm=="stone")TurnStoneOn();
    		if(perspoints.EffectsList[i].nm=="freeze")CustomTimeDilation=0.0;
    	}
    	XRayInt(xr);TickEffects();
    }
    function int DelEffect(int n)
    {
     //You can add delete effect code here (return 1 if there is proceed)
    	perspoints.EffectsList.Remove(n,1);
    	return 0;
    }
    function DelEffectName(string nm)
    {
    	local int i;
     //You can add delete effect code here (return 1 if there is proceed)
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		if(perspoints.EffectsList[i].nm==nm){perspoints.EffectsList.Remove(i,1);i--;}
    	}
    	RestartEffects();
    	return;
    }
    function DecEffects()
    {
    	local int i,fl;fl=0;
    	for(i=0;i<perspoints.EffectsList.length;i++)
    	{
    		if(perspoints.EffectsList[i].tm==-1)continue;//infinite effect
    		if(perspoints.EffectsList[i].tm<=1){if(DelEffect(i)==0) fl=1;i--;continue;}
    		perspoints.EffectsList[i].tm--;
    	}
    	if(fl==1)RestartEffects();
    }
    function SecondsTimer()
    {
    	local float pw;local vector hit,mom;
    	if(perspoints.invulnerability>0)perspoints.invulnerability--;
    	DecEffects();
    	pw=SumEffect("fire")+SumEffect("frost")+SumEffect("stone")+SumEffect("stasis")+SumEffect("invisibility");
    	if(pw>0)TakeDamage(pw,Controller,hit,mom,class'DamageType');
    	perspoints.stamina=Clamp(perspoints.stamina-SumEffect("drainstamina"),0,perspoints.staminamax);
    	perspoints.mana=Clamp(perspoints.mana-SumEffect("drainmana"),0,perspoints.manamax);
    	perspoints.energy=Clamp(perspoints.energy-SumEffect("drainenergy"),0,perspoints.energymax);
    }
    
    function GiveInvulnerability(int sec)
    {
    	perspoints.invulnerability=max(perspoints.invulnerability,sec);
    }
    
    simulated function PostBeginPlay()
    {
    	super.PostBeginPlay();
     perspoints.invulnerability=0;
     perspoints.RegenTime=1;
     perspoints.healthreg=1;
     perspoints.mana=100;
     perspoints.manamax=200;
     perspoints.manareg=2;
     perspoints.stamina=50;
     perspoints.staminamax=100;
     perspoints.staminareg=3;
     perspoints.energy=10;
     perspoints.energymax=20;
     perspoints.energyreg=4;
     perspoints.armor=0;
     perspoints.defence=0;
     perspoints.friendship=0;
     perspoints.friendshipmin=-100;
     perspoints.friendshipmax=100;
    	//SetTimer(1.0, true, 'SecondsTimer');
    	OriginalMats=Mesh.Materials;
    	NeedREffect=true;
    }
    
    function BeginTrade(GameHUD hd,UserPawn pwn,GroupPawn shop)
    {
    	hd.BeginTrade(pwn,shop);
    }
    function EndTrade(GameHUD hd)
    {
    	hd.EndTrade();
    }
    
    function bool ProceedUseInventory(PlayerController pcon)
    {
    	
    	if(iskilled)
    	{
    
    		return true;
    	}
    
    	return false;
    }
    
    function OnUseCommand()
    {
    	local PlayerController pcon;
    	pcon=GetALocalPlayerController();
    	if(pcon==None)return;
    	if(ProceedUseInventory(pcon)==true) return;
    	if(isdialogable) {GameHUD(pcon.myhud).EnterDialog(curdialog,UserPawn(pcon.Pawn),self);}
    	if(CanTalk())
    	{
    		PlaySound(SpeakSnd);
    		GameHUD(GetALocalPlayerController().myhud).SetMsgText(SpeakText);
    	}
    }
    
    function bool CanReceive()
    {
    	return true;
    }
    
    function bool CanTalk()
    {
    	return istalker;
    }
    
    function OnReceive(Pawn from,string obj)
    {
    
    }
    
    function bool Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
    {
    	iskilled=true;
    	return Super.Died(Killer, DamageType, HitLocation);
    }
    
    simulated function bool CalcTopDownCam( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
       out_CamLoc=Location;
       out_CamLoc.Z+=CamOffsetDistance;
       out_CamRot.Pitch=-16384;
       out_CamRot.Yaw=0;
       out_CamRot.Roll=0;
       return true;
    }
    
    simulated function bool CalcTopDownCamFollow(float fDeltaTime,out vector out_CamLoc,out rotator out_CamRot,out float out_FOV)
    {
       out_CamLoc=Location;
       out_CamLoc.Z+=CamOffsetDistance;
       out_CamRot.Pitch=-16384;
       out_CamRot.Yaw=Rotation.Yaw;
       out_CamRot.Roll=0;
       return true;
    }
    
    simulated function bool CalcSideScrollerCam(float fDeltaTime,out vector out_CamLoc,out rotator out_CamRot,out float out_FOV)
    {
       out_CamLoc=Location;
       out_CamLoc.Y=-CamOffsetDistance;
       out_CamRot.Pitch=0;
       out_CamRot.Yaw=16384;
       out_CamRot.Roll=0;
       return true;
    }
    
    simulated function bool CalcIsometricCam(float fDeltaTime,out vector out_CamLoc,out rotator out_CamRot,out float out_FOV)
    {
       out_CamLoc=Location;
       out_CamLoc.X-=Cos(IsoCamAngle*UnrRotToRad)*CamOffsetDistance;
       out_CamLoc.Z+=Sin(IsoCamAngle*UnrRotToRad)*CamOffsetDistance;
       out_CamRot.Pitch=-IsoCamAngle;
       out_CamRot.Yaw=0;
       out_CamRot.Roll=0;
       return true;
    }
    
    simulated function bool CalcCamera(float fDeltaTime,out vector out_CamLoc,out rotator out_CamRot,out float out_FOV)
    {
    	local string cam;
    	if(Controller==None||PC(Controller)==None)return true;
    	cam=PC(Controller).CurCameraMode;
    	switch(cam)
      {
    		case "fixed":
       		out_CamLoc=StratViewLoc;out_CamRot=StratViewRot;break;
    		case "strategy":
       		out_CamLoc=StratViewLoc;out_CamRot=StratViewRot;break;
    		case "behind":
    			CalcThirdPersonCam(fDeltaTime,out_CamLoc,out_CamRot,out_FOV);break;
    		case "topdown":
          CalcTopDownCam(fDeltaTime,out_CamLoc,out_CamRot,out_FOV);break;
        case "topdownfollow":
          CalcTopDownCamFollow(fDeltaTime,out_CamLoc,out_CamRot,out_FOV);break;
        case "sidescroller":
          CalcSideScrollerCam(fDeltaTime,out_CamLoc,out_CamRot,out_FOV);break;
        case "isometric":
          CalcIsometricCam(fDeltaTime,out_CamLoc,out_CamRot,out_FOV);break;
        case "firstperson":
          GetActorEyesViewPoint(out_CamLoc,out_CamRot);break;
    		default:// By default, we view through the Pawn's eyes..
          GetActorEyesViewPoint(out_CamLoc,out_CamRot);
    	}
     if(UTWeapon(Weapon)!=none)
     {
        UTWeapon(Weapon).WeaponCalcCamera(fDeltaTime,out_CamLoc,out_CamRot);
     }
     return true;
    }
    
    simulated singular event Rotator GetBaseAimRotation()
    {
    	local vector POVLoc;
    	local rotator POVRot,tempRot;
    	local string cam;
    	cam=PC(Controller).CurCameraMode;
    		if(cam=="topdown"||cam=="topdownfollow"||cam=="isometric"||cam=="fixed"||cam=="strategy")
    		{
    			tempRot=Rotation;
    			tempRot.Pitch=0;
    			SetRotation(tempRot);
    			POVRot=Rotation;
    			POVRot.Pitch=0;
    			return POVRot;
    		}
    		if(cam=="sidescroller")
    		{
         POVRot=Rotation;
         if((Rotation.Yaw%65535>16384&&Rotation.Yaw%65535<49560)||(Rotation.Yaw%65535<-16384&& Rotation.Yaw%65535>-49560))POVRot.Yaw=32768;else POVRot.Yaw=0;
         if(POVRot.Pitch==0)POVRot.Pitch=RemoteViewPitch<<8;
    			return POVRot;
    		}
    		if(Controller!=None&&!InFreeCam())
    		{
    			Controller.GetPlayerViewPoint(POVLoc, POVRot);
          return POVRot;
    		}
    		POVRot=Rotation;
    		if(POVRot.Pitch==0)POVRot.Pitch=RemoteViewPitch<<8;
    		return POVRot;
    }
    
    simulated event BecomeViewTarget(PlayerController PC)
    {
    	PC(Controller).SetCurCamera();
    }
    
    simulated function PlayDying(class<DamageType> DamageType, vector HitLoc)
    {
    	local vector ApplyImpulse, ShotDir;
    	local TraceHitInfo HitInfo;
    	local PlayerController PC;
    	local bool bPlayersRagdoll, bUseHipSpring;
    	local class<UTDamageType> UTDamageType;
    	local RB_BodyInstance HipBodyInst;
    	local int HipBoneIndex;
    	local matrix HipMatrix;
    	local class<UDKEmitCameraEffect> CameraEffect;
    	local name HeadShotSocketName;
    	local SkeletalMeshSocket SMS;
    	if(AfterInv==""){Super.PlayDying(DamageType,HitLoc);return;}
    	bCanTeleport = false;
    	bReplicateMovement = false;
    	bTearOff = true;
    	bPlayedDeath = true;
    	bForcedFeignDeath = false;
    	bPlayingFeignDeathRecovery = false;
    
    	HitDamageType = DamageType; // these are replicated to other clients
    	TakeHitLocation = HitLoc;
    
    	// make sure I don't have an active weaponattachment
    	CurrentWeaponAttachmentClass = None;
    	WeaponAttachmentChanged();
    
    	if ( WorldInfo.NetMode == NM_DedicatedServer )
    	{
     		UTDamageType = class<UTDamageType>(DamageType);
    		// tell clients whether to gib
    		bTearOffGibs = (UTDamageType != None && ShouldGib(UTDamageType));
    		bGibbed = bGibbed || bTearOffGibs;
    		GotoState('Dying');
    		return;
    	}
    
    	// Is this the local player's ragdoll?
    	ForEach LocalPlayerControllers(class'PlayerController', PC)
    	{
    		if( pc.ViewTarget == self )
    		{
    			if ( UTHud(pc.MyHud)!=none )
    				UTHud(pc.MyHud).DisplayHit(HitLoc, 100, DamageType);
    			bPlayersRagdoll = true;
    			break;
    		}
    	}
    	if ( (WorldInfo.TimeSeconds - LastRenderTime > 3) && !bPlayersRagdoll )
    	{
    		if (WorldInfo.NetMode == NM_ListenServer || WorldInfo.IsRecordingDemo())
    		{
    			if (WorldInfo.Game.NumPlayers + WorldInfo.Game.NumSpectators < 2 && !WorldInfo.IsRecordingDemo())
    			{
    				//Destroy();
    				return;
    			}
    			bHideOnListenServer = true;
    
    			// check if should gib (for clients)
    			UTDamageType = class<UTDamageType>(DamageType);
    			if (UTDamageType != None && ShouldGib(UTDamageType))
    			{
    				bTearOffGibs = true;
    				bGibbed = true;
    			}
    			TurnOffPawn();
    			return;
    		}
    		else
    		{
    			// if we were not just controlling this pawn,
    			// and it has not been rendered in 3 seconds, just destroy it.
    			//Destroy();
    			return;
    		}
    	}
    
    	UTDamageType = class<UTDamageType>(DamageType);
    	if (UTDamageType != None && !class'UTGame'.static.UseLowGore(WorldInfo) && ShouldGib(UTDamageType))
    	{
    		SpawnGibs(UTDamageType, HitLoc);
    	}
    	else
    	{
    		CheckHitInfo( HitInfo, Mesh, Normal(TearOffMomentum), TakeHitLocation );
    
    		// check to see if we should do a CustomDamage Effect
    		if( UTDamageType != None )
    		{
    			if( UTDamageType.default.bUseDamageBasedDeathEffects )
    			{
    				UTDamageType.static.DoCustomDamageEffects(self, UTDamageType, HitInfo, TakeHitLocation);
    			}
    
    			if( UTPlayerController(PC) != none )
    			{
    				CameraEffect = UTDamageType.static.GetDeathCameraEffectVictim(self);
    				if (CameraEffect != None)
    				{
    					UTPlayerController(PC).ClientSpawnCameraEffect(CameraEffect);
    				}
    			}
    		}
    
    		bBlendOutTakeHitPhysics = false;
    
    		// Turn off hand IK when dead.
    		SetHandIKEnabled(false);
    
    		// if we had some other rigid body thing going on, cancel it
    		if (Physics == PHYS_RigidBody)
    		{
    			setPhysics(PHYS_Falling);
    		}
    
    		PreRagdollCollisionComponent = CollisionComponent;
    		CollisionComponent = Mesh;
    
    		Mesh.MinDistFactorForKinematicUpdate = 0.f;
    
    		// If we had stopped updating kinematic bodies on this character due to distance from camera, force an update of bones now.
    		if( Mesh.bNotUpdatingKinematicDueToDistance )
    		{
    			Mesh.ForceSkelUpdate();
    			Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
    		}
    
    		Mesh.PhysicsWeight = 1.0;
    
    		if(UTDamageType != None && UTDamageType.default.DeathAnim != '' && (FRand() > 0.5) )
    		{
    			// Don't want to use stop player and use hip-spring if in the air (eg PHYS_Falling)
    			if(Physics == PHYS_Walking && UTDamageType.default.bAnimateHipsForDeathAnim)
    			{
    				SetPhysics(PHYS_None);
    				bUseHipSpring=true;
    			}
    			else
    			{
    				SetPhysics(PHYS_RigidBody);
    				// We only want to turn on 'ragdoll' collision when we are not using a hip spring, otherwise we could push stuff around.
    				SetPawnRBChannels(TRUE);
    			}
    
    			Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
    
    			// Turn on angular motors on skeleton.
    			Mesh.bUpdateJointsFromAnimation = TRUE;
    			Mesh.PhysicsAssetInstance.SetNamedMotorsAngularPositionDrive(false, false, NoDriveBodies, Mesh, true);
    			Mesh.PhysicsAssetInstance.SetAngularDriveScale(1.0f, 1.0f, 0.0f);
    
    			// If desired, turn on hip spring to keep physics character upright
    			if(bUseHipSpring)
    			{
    				HipBodyInst = Mesh.PhysicsAssetInstance.FindBodyInstance('b_Hips', Mesh.PhysicsAsset);
    				HipBoneIndex = Mesh.MatchRefBone('b_Hips');
    				HipMatrix = Mesh.GetBoneMatrix(HipBoneIndex);
    				HipBodyInst.SetBoneSpringParams(DeathHipLinSpring, DeathHipLinDamp, DeathHipAngSpring, DeathHipAngDamp);
    				HipBodyInst.bMakeSpringToBaseCollisionComponent = FALSE;
    				HipBodyInst.EnableBoneSpring(TRUE, TRUE, HipMatrix);
    				HipBodyInst.bDisableOnOverextension = TRUE;
    				HipBodyInst.OverextensionThreshold = 100.f;
    			}
    
    			FullBodyAnimSlot.PlayCustomAnim(UTDamageType.default.DeathAnim, UTDamageType.default.DeathAnimRate, 0.05, -1.0, false, false);
    			SetTimer(0.1, true, 'DoingDeathAnim');
    			StartDeathAnimTime = WorldInfo.TimeSeconds;
    			TimeLastTookDeathAnimDamage = WorldInfo.TimeSeconds;
    			DeathAnimDamageType = UTDamageType;
    		}
    		else
    		{
    			SetPhysics(PHYS_RigidBody);
    			Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
    			SetPawnRBChannels(TRUE);
    
    			if( TearOffMomentum != vect(0,0,0) )
    			{
    				ShotDir = normal(TearOffMomentum);
    				ApplyImpulse = ShotDir * DamageType.default.KDamageImpulse;
    
    				// If not moving downwards - give extra upward kick
    				if ( Velocity.Z > -10 )
    				{
    					ApplyImpulse += Vect(0,0,1)*DamageType.default.KDeathUpKick;
    				}
    				Mesh.AddImpulse(ApplyImpulse, TakeHitLocation, HitInfo.BoneName, true);
    			}
    		}
    		GotoState('Dying');
    
    		if (WorldInfo.NetMode != NM_DedicatedServer && UTDamageType != None && UTDamageType.default.bSeversHead && !bDeleteMe)
    		{
    			SpawnHeadGib(UTDamageType, HitLoc);
    
    			if ( !class'UTGame'.Static.UseLowGore(WorldInfo) )
    			{
    				HeadShotSocketName = GetFamilyInfo().default.HeadShotGoreSocketName;
    				SMS = Mesh.GetSocketByName( HeadShotSocketName );
    				if( SMS != none )
    				{
    					HeadshotNeckAttachment = new(self) class'StaticMeshComponent';
    					HeadshotNeckAttachment.SetActorCollision( FALSE, FALSE );
    					HeadshotNeckAttachment.SetBlockRigidBody( FALSE );
    
    					Mesh.AttachComponentToSocket( HeadshotNeckAttachment, HeadShotSocketName );
    					HeadshotNeckAttachment.SetStaticMesh( GetFamilyInfo().default.HeadShotNeckGoreAttachment );
    					HeadshotNeckAttachment.SetLightEnvironment( LightEnvironment );
    				}
    			}
    		}
    	}
    }
    
    
    simulated State Dying
    {
    	event Timer()
    	{
    		local PlayerController PC;
    		local bool bBehindAllPlayers;
    		local vector ViewLocation;
    		local rotator ViewRotation;
    		if(AfterInv==""){Super.Timer();return;}
    		// let the dead bodies stay if the game is over
    		if (WorldInfo.GRI != None && WorldInfo.GRI.bMatchIsOver)
    		{
    			LifeSpan = 0.0;
    			return;
    		}
    
    		if ( !PlayerCanSeeMe() )
    		{
    			//Destroy();
    			return;
    		}
    		// go away if not viewtarget
    		bBehindAllPlayers = true;
    		ForEach LocalPlayerControllers(class'PlayerController', PC)
    		{
    			if ( (PC.ViewTarget == self) || (PC.ViewTarget == Base) )
    			{
    				if ( LifeSpan < 3.5 )
    					LifeSpan = 3.5;
    				SetTimer(2.0, false);
    				return;
    			}
    
    			PC.GetPlayerViewPoint( ViewLocation, ViewRotation );
    			if ( ((Location - ViewLocation) dot vector(ViewRotation) > 0) )
    			{
    				bBehindAllPlayers = false;
    				break;
    			}
    		}
    		if ( bBehindAllPlayers )
    		{
    			//Destroy();
    			return;
    		}
    		SetTimer(2.0, false);
    	}
    }
    
    function DestroyBodyTimer()
    {
    	if(WorldInfo.TimeSeconds-LastRenderTime>3){ClearTimer('DestroyBodyTimer');destroy();}
    }
    
    function DestroyBody()
    {
    	SetTimer(1.0,true,'DestroyBodyTimer');
    }
    event Tick(float DeltaTime)
    {
    	local vector hit,mom;
    	super.Tick(DeltaTime);
    	TickEffects();
    	if(NeedREffect)
    	{
    		NeedREffect=false;
    		RestartEffects();
    	}
    	if(GameHUD(GetALocalPlayerController().myhud).cin==1)return;
    	//Proceed regeneration
       ElapsedRegenTime+=DeltaTime;//calculate elapsed time
       if(ElapsedRegenTime>=perspoints.RegenTime)//has enough time elapsed?
       {
          if(perspoints.healthreg>0)HealDamage(perspoints.healthreg, Controller, class'DamageType');//heal the Pawn and reset elapsed time
          if(perspoints.healthreg<0)TakeDamage(-perspoints.healthreg*2, Controller, hit,mom,class'DamageType');//heal the Pawn and reset elapsed time
          if(perspoints.manareg>0)perspoints.mana=min(perspoints.mana+perspoints.manareg,perspoints.manamax);
          if(perspoints.manareg<0)perspoints.mana=max(perspoints.mana+perspoints.manareg,0);
          if(perspoints.staminareg>0)perspoints.stamina=min(perspoints.stamina+perspoints.staminareg,perspoints.staminamax);
          if(perspoints.staminareg<0)perspoints.stamina=max(perspoints.stamina+perspoints.staminareg,0);
          if(perspoints.energyreg>0)perspoints.energy=min(perspoints.energy+perspoints.energyreg,perspoints.energymax);
          if(perspoints.energyreg<0)perspoints.energy=max(perspoints.energy+perspoints.energyreg,0);
          ElapsedRegenTime=0.0f;
       }
    	return;
    }
    
    
    function XRayInt(bool mde)
    {
    	local int i;
    	if(mde==XRayMode)return;
    	XRayMode=mde;
    	if(mde){AttachComponent(LightXRay);Mesh.SetDepthPriorityGroup(SDPG_Foreground);}else {DetachComponent(LightXRay);Mesh.SetDepthPriorityGroup(SDPG_World);}
    	if(mde)
    	{
    		for(i=0;i<Mesh.Materials.length;i++)
    		{
    			Mesh.SetMaterial(i,Material'EngineDebugMaterials.TangentColorMaterial');
    		}
    	}
    	else
    	{
    		for(i=0;i<Mesh.Materials.length;i++)
    		{
    			Mesh.SetMaterial(i,OriginalMats[i]);
    		}
    	}
    }
    
    function XRay(bool mde)
    {
    	XRayInt(mde);
    	RestartEffects();
    }
    
    function PawnNightOn()
    {
    	if(IsNightLight==false) AttachComponent(NightLight);
    	IsNightLight=true;
    }
    
    function PawnNightOff()
    {
    	if(IsNightLight==true)DetachComponent(NightLight);
    	IsNightLight=false;
    }
    function PawnSelect()
    {
    	if(PawnSel==false) AttachComponent(Mark);
    	PawnSel=true;
    }
    
    function PawnDeselect()
    {
    	if(PawnSel==true)DetachComponent(Mark);
    	PawnSel=false;
    }
    
    event TakeDamage(int Damage, Controller InstigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    	local int d;
    	if(perspoints.invulnerability>0) return;
    	if(IsEffect("invulnerability")) return;
    	Damage-=perspoints.armor+SumEffect("armoradd");
    	if(Damage<=0)return;
    	d=perspoints.defence+SumEffect("defenceadd");if(d>90) d=90;
    	Damage-=(Damage*d)/100.0;
    	if(Damage<=0)return;
    	Super.TakeDamage(Damage,InstigatedBy,HitLocation,Momentum,DamageType,HitInfo,DamageCauser);
    }
    
    function TurnFireMode(bool fl)
    {
    	if(IsFireEffect==fl) return;
    	IsFireEffect=fl;
    	if(fl)AttachComponent(BigFireEffect);
    	if(!fl)DetachComponent(BigFireEffect);
    }
    
    function bool Dodge(eDoubleClickDir DoubleClickMove)
    {
    	if(NoDodge) return false;
    	return super.Dodge(DoubleClickMove);
    }
    
    function CallRemoteEvent(string nm)
    {
      local int i;
      local Sequence GameSeq;
      local array<SequenceObject> AllSeqEvents;
      GameSeq=WorldInfo.GetGameSequence();
      if(GameSeq==None)return;
      GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent',true,AllSeqEvents);
      for(i=0;i<AllSeqEvents.Length;i++)
      {
         //if(AllSeqEvents[i].EventName!=name(nm)) continue;
         if(AllSeqEvents[i].ObjName!=nm) continue;
         SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(WorldInfo, None);
      }
    }
    defaultproperties
    {
    
    	ClassGroup="Enemy"
    	PawnId=-1
    	PawnTitle="Unnamed Pawn"
    	NoDodge=false
    	SpeakSnd=SoundCue'KismetGame_Assets.Sounds.Jazz_Chatter_Happy_Cue'
    	SpeakText="Hello."
    	iskilled=false
    	AfterInv="chicken;1;wings;2;pistol;3;money;100;chicken;1;wings;2;pistol;3;chicken;1;wings;2;pistol;3"
    	AfterInvTitle="Things"
    	CamOffsetDistance=384.0
    	IsoCamAngle=6420 //35.264 degrees
    	StratViewLoc=(x=0,y=0,z=256)
    	StratViewRot=(Yaw=0,Roll=0,Pitch=0)
    	RagdollLifespan=9999999999999999
    	shopitems="chicken;1;ammo;5"
    	shopmoney=100
    	shopbuy=0.9
    	shopsell=1.0
    	shoptitle="Unknown shop"
    	istrader=true
    	istalker=true
    	isdialogable=true
    	curdialog="test"
    	todel=false
    	showhealthbar=true
    
    	bThrowingGrenade=false
    	bCanThrowGrenade=true
    	GrenadeCount(0)=3
    	ThrowTime=1.0
    	SpawnGrenTime=0.5
    	CurGrenadeType=0
    	Begin Object class=PointLightComponent name=LightN
    	        LightColor=(R=0,G=255,B=0)
    	        CastShadows=false
    	        bEnabled=true
    	        Radius=7500.000000
    	        FalloffExponent=3.000000
    	        Brightness=1.900000
    	        CastStaticShadows=False
    	        CastDynamicShadows=False
    	        bCastCompositeShadow=False
    	        bAffectCompositeShadowDirection=False
    	    End Object
    	NightLight=LightN
    	IsNightLight=false
    	Begin Object class=PointLightComponent name=LightX
    	        LightColor=(R=0,G=0,B=255)
    	        CastShadows=false
    	        bEnabled=true
    	        Radius=250.000000
    	        FalloffExponent=3.000000
    	        Brightness=1.900000
    	        CastStaticShadows=False
    	        CastDynamicShadows=False
    	        bCastCompositeShadow=False
    	        bAffectCompositeShadowDirection=False
    	    End Object
    	LightXRay=LightX
    
      Begin Object Class=StaticMeshComponent Name=SelectionMark
      //Gray rosette
      		StaticMesh=StaticMesh'Pickups.Health_Large.Mesh.S_Pickups_Base_Health_Large'
      		Translation=(X=0,Y=0,Z=-40)
      		Rotation=(Roll=0,Yaw=0)
      		Materials(0)=Material'jw_lighteffects.Materials.M_CloudShadow'
      		Scale3D=(X=1,Y=1,Z=0.1)
    	End Object
    		Mark=SelectionMark
    		PawnSel=false
    	Begin Object Class=UTParticleSystemComponent Name=FireComp
       Template=ParticleSystem'GenericFoliage01.Ruins.FX.P_UDK_TorchFire01'
    		Translation=(Z=-50.0)
    		SecondsBeforeInactive=0.0f
    		Scale3D=(X=3,Y=3,Z=2)
    		CustomTimeDilation=2.f
    	End Object
    	BigFireEffect=FireComp
    	IsFireEffect=false
    	CurSpeed=440
    }
    You're talking about Launch.Log right?

    Comment


      #47
      your class seems fine

      I'm talking about putting a line that says `log("hello 1"); where I said. once the code reaches that part you'll see it output "hello 1" in the output window (and launch.log if you open it as well). you are running UDK.exe -log, right?

      Comment


        #48
        Ok, I didnt see anything at runtime (when I launched the map, or shot the characters)
        But Theres this line in Launch.log:
        [0256.28] Cmd: SETSOUNDMODE Default
        [0256.30] ScriptLog: START MATCH
        [0257.88] ScriptLog: Post begin play, Baby!
        [0257.88] ScriptLog: MIC Set Param Val Valid
        [0257.88] ScriptWarning: Accessed None 'Pawn'

        Comment


          #49
          So well after redoing the achievement classes i got my own working but the hit mask issue persists, it now logs my mesh properly but the hit mask is not drawn :/

          Code:
          class SVWeaponAttachment extends SkeletalMeshActorSpawnable
          abstract
          	dependson(tfpPawn);
          
          var PhysicsAsset PhysAsset;
          
          var() SceneCapture2DHitMaskComponent HitMaskComponent;
          var TextureRenderTarget2D MaskTexture;
          
          function InitHitmask()
          {
          local MaterialInstanceConstant MIC;
          `log("hm test now");
          
          	MaskTexture = class'TextureRenderTarget2D'.static.Create( 2048, 2048, PF_G8, MakeLinearColor( 0, 0, 0, 1 ) );
          
          	if( MaskTexture != None )
          	{
          		HitMaskComponent.SetCaptureTargetTexture( MaskTexture );
          
          		MIC = SkeletalMeshComponent.CreateAndSetMaterialInstanceConstant( 0 );
          		if( MIC != None )
          		{
          			MIC.SetTextureParameterValue( 'FilterMask', MaskTexture );
          		}
          	}
          	
          
          test();
          
          }
          
          function test()
          {
          HitMaskComponent.SetCaptureParameters(Instigator.Location,990,Instigator.Location,FALSE);
          DrawDebugSphere(Instigator.Location,990,20,255,0,0,true);
          `log("test function");
          `Log("mesh is"$HitMaskComponent.SkeletalMeshComp.SkeletalMesh);
          
          }
          
          
          
          
          
          
          
          
          
          
          defaultproperties
          {
          
           Begin Object class=UTAnimNodeSequence Name=MeshSequenceA
          	End Object
           
           Begin Object Name=SkeletalMeshComponent0
          		//bOwnerNoSee=true
          		//bOnlyOwnerSee=false
          		//CollideActors=false
          		//AlwaysLoadOnClient=true
          		//AlwaysLoadOnServer=true
          		//MaxDrawDistance=4000
          		//bForceRefPose=1
          		//bUpdateSkelWhenNotRendered=false
          		//bIgnoreControllersWhenNotRendered=true
          		//bOverrideAttachmentOwnerVisibility=true
          		//bAcceptsDynamicDecals=true
          		//Animations=MeshSequenceA
          		//CastShadow=true
          		//bCastDynamicShadow=true
          		//bPerBoneMotionBlur=true
          	End Object
          	
          	Begin Object Class=SceneCapture2DHitMaskComponent Name=HitMaskComp
          	End Object
          	HitMaskComponent=HitMaskComp
          	Components.Add(HitMaskComp)
          
          
          
          }
          took out non relevant functions and code

          ok just tested in a placeable actor that extended skeletalmeshactor only added a skeletal mesh component, and the hit mask code and yet it dident worked!

          im not sure if this is an issue in my own,UDK or someting else now

          the functions gets called(mesh turns black,logging hitmask component mesh returns my mesh wich is great but again it never gets drawn)

          maybe becouse im extending skeletalmeshactorspawnable instead of skeletalmeshactor?

          Comment


            #50
            Kelt'ar: no idea. try following the tutorial once again on a fresh class, that's all I can think of

            Alvaro: I got it to work extending SkeletalMeshActor. I don't see why it wouldn't work on the spawnable version but one can never know. again, try it on SkeletalMeshActor and set some really big paint radius?

            Comment


              #51
              Yep, tried also with a placeable actor that extends skeletalmeshactor and the result was the same

              also tried different skeletal meshes from UDK but nothing happened

              im just really confused now

              Comment


                #52
                In mobile, it doesnot work
                why? somebody give me advice

                Comment


                  #53
                  in short: won't work on mobile, period.

                  long explanation: mobile uses 'flattened' materials which can't be changed dynamically by altering parameters. if you've read about mobile materials by now you'll know the material nodes aren't used at all once you're running on mobile. as such, you can't use a feature that relies on material nodes to work

                  Comment


                    #54
                    Thanks! Got it to work!!!

                    Comment


                      #55
                      WOULD IT be possible to use this in conjuction with this tutorial?:
                      http://forums.epicgames.com/threads/...l-Effect/page2

                      Comment


                        #56
                        Excellent, thanks for this, just got it working. Wouldn't normally necro a thread just to thank, but did you manage to combine this effect with the dissolve effect, Kelt'ar?

                        Comment


                          #57
                          No. Sorry.


                          Sent from my iPhone using Tapatalk

                          Comment


                            #58
                            As shown in the image of the first post "How to setup Hitmasks", the circle does not come in a solid color. How to fix that?
                            Here is an example of hitmask in solid color: http://www.sanzpont.com/chosker/elium/hitmask-blood/

                            Comment

                            Working...
                            X