Results 1 to 2 of 2
  1. #1

    Default 네트워크에서 무기 발사 관련해서 질문드려요

    안녕하세요

    네트워크 구현해서 무기 발사부분을 구현 중인데 잘 안되네요 ㅠㅠ

    weapon class가

    class NIUI_Ball extends Weapon;


    simulated event PostBeginPlay()
    {

    Super.PostBeginPlay();

    }

    simulated function AttachTo(NIUI_SamplePawn OwnerPawn)
    {
    if (OwnerPawn.Mesh != None)
    {
    if ( Mesh != None )
    {
    Mesh.SetShadowParent(OwnerPawn.Mesh);
    OwnerPawn.Mesh.AttachComponentToSocket(Mesh, 'ball');
    `log("잘붙었니");
    }
    }
    }

    simulated function FireAmmunition()
    {

    `log("CurrentFireMode:"$CurrentFireMode);
    `log("WeaponFireTypes[CurrentFireMode]:"$WeaponFireTypes[CurrentFireMode]);

    // Handle the different fire types
    `log("4번이다");
    switch( WeaponFireTypes[CurrentFireMode] )
    {
    case EWFT_InstantHit:
    InstantFire();
    break;

    case EWFT_Projectile:
    `log("프로젝타일 열리나?");
    ProjectileFire();
    break;

    case EWFT_Custom:
    CustomFire();
    break;
    }
    NotifyWeaponFired( CurrentFireMode);
    }

    simulated event vector GetPhysicalFireStartLoc(optional vector AimDir)
    {

    local SkeletalMeshComponent compo;
    local SkeletalMeshSocket socket;

    compo = SkeletalMeshComponent(Mesh);
    if (compo != none)
    {
    socket = compo.GetSocketByName('ball_ball');
    if (socket != none)
    {
    return compo.GetBoneLocation(socket.BoneName);
    }
    }
    }



    simulated function Projectile ProjectileFire()
    {
    local vector RealStartLoc;
    local Projectile SpawnedProjectile;


    IncrementFlashCount();

    if( Role == ROLE_Authority )
    {
    RealStartLoc = GetPhysicalFireStartLoc();

    SpawnedProjectile = Spawn(WeaponProjectiles[1],,, RealStartLoc);
    if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe )
    {
    SpawnedProjectile.Init( Vector(GetAdjustedAim( RealStartLoc )) );
    }

    return SpawnedProjectile;
    }

    return None;
    }



    DefaultProperties
    {
    WeaponFireTypes(0)=EWFT_Projectile
    WeaponFireTypes(1)=EWFT_Projectile
    //WeaponFireTypes(1)=EWFT_Custom
    WeaponProjectiles(0)=class'NIUI.Ballprojectile'
    WeaponProjectiles(1)=class'NIUI.Ballprojectile'

    Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
    bEnabled=TRUE
    End Object

    Begin Object class=SkeletalMeshComponent Name=BallMesh
    SkeletalMesh=SkeletalMesh'UDK_ProtoRig_03.p_ball'
    Translation=(X=0,Y=0,Z=0)

    end object

    Mesh=BallMesh
    FiringStatesArray(0)=WeaponFiring
    FiringStatesArray(1)=WeaponFiring
    FireInterval(1)=0.05
    Spread(1) = 0

    RemoteRole=ROLE_SimulatedProxy
    bReplicateInstigator=true
    bOnlyDirtyReplication=false
    bOnlyRelevantToOwner=true


    }
    그리고 pawn 클래스가

    /************************************************** ***************************
    * *
    * Natural Interaction Unreal Interface (NIUI) Alpha *
    * Copyright (C) 2011 Matthew Robbins *
    * *
    * This file is part of NIUI. *
    * *
    * NIUI is free software: you can redistribute it and/or modify *
    * it under the terms of the GNU Lesser General Public License as published *
    * by the Free Software Foundation, either version 3 of the License, or *
    * (at your option) any later version. *
    * *
    * NIUI is distributed in the hope that it will be useful, *
    * but WITHOUT ANY WARRANTY; without even the implied warranty of *
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
    * GNU Lesser General Public License for more details. *
    * *
    * You should have received a copy of the GNU Lesser General Public License *
    * along with NIUI. If not, see <http://www.gnu.org/licenses/>. *
    * *
    ************************************************** ***************************/

    /**
    *
    * NIUI_SamplePawn.uc
    *
    * Copyright (c) 2011 Matthew Robbins
    *
    * Author: Matthew Robbins
    * Created: 01/2011
    *
    * Desc:
    * Demonstrates how to create and configure the NIUI_SkeletalController.
    *
    */

    class NIUI_SamplePawn extends Pawn implements (NIUI_DependencyInterface);

    var private NIUI_SkeletalController NIUISkelControl;
    var NIUI_Core niuiCOre;

    // The bones that are going to be applying the OpenNI bone rotations to.
    // This should be a list of names matching the names of the NIUI_SkelControlSingleBone anim nodes in your anim-tree.
    var(NIUI) array<name> TargetBoneNames;

    // Our current userID.
    var int userID;

    // ------------------------------------------------------------------------------------
    // CUSTOM ANIMATION PLAYING

    // The blendlist used for swapping between standard blending and crossfade blending.
    var private AnimNodeBlendList AnimBlendList;

    // Our animation blending node for blending custom animations.
    var private AnimNodeBlend AnimationBlender;

    // THe physics branch of the animation tree.
    var private AnimNodeBlendByPhysics PhysicsNode;

    // OUr 2 custom animation nodes.
    var private array<AnimNodePlayCustomAnim> CustomAnimNodes;
    var private int CustomAnimationBlendlistIndex;
    var private int LastCustomAnimNodePlayIndex;
    // ------------------------------------------------------------------------------------

    var NIUI_Glove glove;
    var NIUI_Ball ball;
    var NIUI_Bat bat;
    var AnimNode_MultiBlendPerBone MultiBlendPerBone;


    replication
    {
    if(bNetDirty)
    niuiCOre;
    }


    simulated event Destroyed()
    {
    Super.Destroyed();


    }

    simulated function PostBeginPlay()
    {
    super.PostBeginPlay();
    AddDefaultInventory();

    // glove = Spawn(class'NIUI.NIUI_Glove');
    // glove.AttachTo(self);
    bat = Spawn(class'NIUI.NIUI_Bat');
    bat.AttachTo(self);
    //bat_p = Spawn(class'NIUI.bat_physics');
    //bat_p.AttachToPhysicsHand(self);

    ball = Spawn(class'NIUI.NIUI_Ball');
    ball.AttachTo(self);
    Weapon = ball;
    `log("무기가 공이냐"$Weapon == ball);

    }
    simulated event Tick(float DeltaTime)
    {
    super.Tick(DeltaTime);


    }

    simulated function StartFire(byte FireModeNum)
    {
    `log("qweqwewqe");
    Weapon.StartFire(FireModeNum);

    }



    function AddDefaultInventory()
    {
    InvManager.CreateInventory(class'NIUI.NIUI_Ball');
    }


    function OnNIUICoreStart(NIUI_Core TheCOre)
    {

    }

    function InitiliseNIUISkeletalControls(int NIUI_UserID, NIUI_Core core)
    {

    niuiCOre = core;
    userID = NIUI_UserID;

    if (NIUISkelControl.IsInitilisedFromRRF() == false)
    {
    NIUISkelControl.CacheRotations(Mesh, self.Rotation);

    // Export rotations.
    core.ExportReferenceRotations(Mesh, NIUISkelControl);

    StopTPose();
    }

    NIUISkelControl.Bind(core, NIUI_UserID);
    }

    simulated function PostInitAnimTree(SkeletalMeshComponent SkelComp)
    {

    super.PostInitAnimTree(SkelComp);

    NIUISkelControl = Spawn(class'NIUI_SkeletalController',,, Location);
    NIUISkelControl.CacheSkeletonControls(SkelComp, TargetBoneNames);

    `log(SkelComp.Name);
    `log(string(SkelComp.SkeletalMesh.Name));

    //assign our animation nodes so we can access them when we want to play an animation
    //requires them being set in an animation tree that is assigned to the pawn
    AnimBlendList = AnimNodeBlendList(Mesh.FindAnimNode('BlendList'));
    PhysicsNode = AnimNodeBlendByPhysics(Mesh.FindAnimNode('PhysicsN ode'));

    // FInd the base animation blender and the crossfade blender.
    AnimationBlender = AnimNodeBlend(AnimBlendList.FindAnimNode('CustomAn imationBlender'));

    // Find the custom animation players for the base animation blender.
    CustomAnimNodes[0] = AnimNodePlayCustomAnim(AnimationBlender.FindAnimNo de('BlendNode_1'));
    CustomAnimNodes[1] = AnimNodePlayCustomAnim(AnimationBlender.FindAnimNo de('BlendNode_2'));



    }

    function UpdateSkeletalControls(float DeltaTime)
    {

    niuiSkelCOntrol.UpdateBoneOverides(DeltaTIme, self.Rotation);
    }

    function OnNIUICoreShutdown()
    {
    }

    /**
    * Custom animation playing function derived from Dungeon Defense source code.
    */
    function float PlayAnim(name AnimName, optional float blendTimeIn=0.2, optional bool looping=false, optional float speed = 1.0f, optional float BlendOutTime=0.2, optional bool bOverride=false)
    {
    local float value;

    LastCustomAnimNodePlayIndex = (LastCustomAnimNodePlayIndex + 1)%CustomAnimNodes.Length;
    AnimBlendList.SetActiveChild(1, blendTimeIn);
    AnimationBlender.SetBlendTarget(LastCustomAnimNode PlayIndex,blendTimeIn);
    CustomAnimNodes[LastCustomAnimNodePlayIndex].PlayCustomAnim(AnimName,speed,blendTimeIn,BlendOu tTime,looping,false);
    value = CustomAnimNodes[LastCustomAnimNodePlayIndex].GetCustomAnimNodeSeq().GetAnimPlaybackLength();

    return value;
    }

    function OnCalibrationStart(NIUI_Core core)
    {

    // Try load a reference rotation file to remove the need for t-pose.
    if (core.PreloadReferenceRotations(Mesh, NIUISkelControl) == false)
    {
    ForceTPose();
    }
    }

    function ForceTPose()
    {

    PlayAnim('TPose', 0.0f, true);
    }

    // Restore from tpose.
    function StopTPose()
    {
    AnimBlendList.SetActiveChild(0, 0.3f);
    }



    DefaultProperties
    {
    WalkingPct=+0.4
    CrouchedPct=+0.4
    BaseEyeHeight=38.0
    EyeHeight=38.0
    GroundSpeed=440.0
    AirSpeed=440.0
    WaterSpeed=220.0
    AccelRate=2048.0
    JumpZ=322.0
    CrouchHeight=29.0
    CrouchRadius=21.0
    WalkableFloorZ=0.78


    Components.Remove(Sprite)
    //Setting up the light environment

    Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment

    //amount of time before a shadow will fade after being cast from a light source
    ModShadowFadeoutTime=0.25

    //minimum amount of time before a full update of the enivornment is done
    MinTimeBetweenFullUpdates=0.2

    //ambient glow added to the leve lighting
    AmbientGlow=(R=.01,G=.01,B=.01,A=1)

    //ambient colour of the shadow
    AmbientShadowColor=(R=0.15,G=0.15,B=0.15)
    //Type of shadows used

    LightShadowMode=LightShadow_ModulateBetter
    //Quality of the shadow

    ShadowFilterQuality=SFQ_High

    //not entierly sure, looks like a different method for generating shadows, higher quality but more performace required
    bSynthesizeSHLight=TRUE

    End Object
    //add our light environment to the components list
    Components.Add(MyLightEnvironment)

    //Set up the mesh and animset components
    Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh

    //wether to cast a shadow or not
    CastShadow = true;

    //wether to cast a dynamic shadow or not
    bCastDynamicShadow = true;

    //if the view actor is the same as the owner of this component it won't be visible
    bOwnerNoSee=false;

    //the light environment this pawn will use (using the environment we setup before)
    LightEnvironment = MyLightEnvironment;

    //wether collide against ridged bodies
    //bBlockRigidBody=true;

    //wether we collide with other actors
    CollideActors=true;

    //unsure - look this up
    BlockZeroExtent=true;
    Scale = 0.7;

    // bForceApplyToProjectiles = FALSE
    //what to change if you want to use own meshes and animation sets

    //the physics we will be using for this pawn
    PhysicsAsset=PhysicsAsset'UDK_ProtoRig_03.Player_P hysics'
    //the animation sets we will use for this pawn

    AnimSets(0)=AnimSet'UDK_ProtoRig_03.Player_Anims'

    AnimTreeTemplate=AnimTree'UDK_ProtoRig_03.P_Anim'

    //finally the mesh we are using for the pawn
    // SkeletalMesh=SkeletalMesh'UDK_ProtoRig_03.UDK_Prot o_03'
    SkeletalMesh=SkeletalMesh'UDK_ProtoRig_03.player'
    //

    End Object


    //Set our mesh to the one we just created...
    Mesh=InitialSkeletalMesh;
    //...and add it to our component list
    Components.Add(InitialSkeletalMesh);

    //then setup our collision for this pawn (pretty self explanitory this next section i think
    //as is most of this stuff with helpful tool tips on mouse hover)
    CollisionType=COLLIDE_BlockAll
    Begin Object Name=CollisionCylinder
    CollisionRadius=+035
    CollisionHeight=+057.000000
    End Object
    CylinderComponent=CollisionCylinder

    InventoryManagerClass=class'NIUI.NIUI_Inventory'



    bDirectHitWall=true


    }
    이렇게 구현했구요 ㅠ 지금 계속 나는 서버 측 오류 로그가




    이런 오류가 계속 나는데 어느부분인지 찾기가 너무 어려워서요 ㅠㅠ

    죄송하지만 답변 좀 부탁드릴게요 ㅠ

  2. #2
    MSgt. Shooter Person
    Join Date
    May 2011
    Location
    Busan Korea Republic of
    Posts
    277

    Default

    무기 State를 확인하십시오.

    Inactive 상태에서는 StartFire()가 호출되지 않습니다.

    http://udn.epicgames.com/Three/Weapo...44288;리
    Intel Core i5 2500K 4.0GHz O.C
    16GB RAM
    GeForce 560Ti O.C
    ASUS P67 Chipset
    Windows 7 Ultimate K 64bit


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.