BaseCharacter deives directly from ACharacter as you can see here
This is very weird because I can’t see any animmontage() called in my constructor.
I will try what you said , but never done that before, so I hope it isn’t too complicated.
Thanx for your help anyway
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
//#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Net/UnrealNetwork.h"
#include "Items/Pickable.h"
#include "Items/BaseWeapon.h"
#include "BaseCharacter.generated.h"
class ABaseWeapon;
class APickable;
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnBaseCharacterEquipWeapon, ABaseCharacter*, APickable* /* new */);
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnBaseCharacterUnEquipWeapon, ABaseCharacter*, APickable* /* old */);
UCLASS(Abstract)
class ABaseCharacter : public ACharacter
{
GENERATED_UCLASS_BODY()
/** Global notification when a character equips a weapon. Needed for replication graph. */
TACTICALOPS_API static FOnBaseCharacterEquipWeapon NotifyEquipWeapon;
/** Global notification when a character un-equips a weapon. Needed for replication graph. */
TACTICALOPS_API static FOnBaseCharacterUnEquipWeapon NotifyUnEquipWeapon;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
//virtual void Tick(float DeltaTime) override;
void DestroyInventory();
void Destroyed();
/** spawn inventory, setup initial variables */
virtual void PostInitializeComponents() override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
////////////////////////////////////////////////
//Inventory
/** weapons in inventory */
public:
UPROPERTY(BluePrintReadWrite,Transient, Replicated)
TArray<class APickable*> Inventory;
/** default inventory list */
UPROPERTY(EditDefaultsOnly, Category = Inventory)
TArray<TSubclassOf<class ABaseWeapon> > DefaultInventoryClasses;
/** currently equipped weapon */
UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
class ABaseWeapon* CurrentWeapon;
UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
class ABaseWeapon* PrimaryWeapon;
UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
class ABaseWeapon* SecondaryWeapon;
UPROPERTY(BluePrintReadWrite,Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
class ABaseWeapon* SideGun;
UPROPERTY(BluePrintReadWrite, Transient, Replicated/*Using = OnRep_CurrentWeapon*/)
class ABaseWeapon* Throwable;
void RemoveWeapon(class ABaseWeapon* weapon);
UFUNCTION(BlueprintCallable, Category = Inventory)
void AddPickable(class APickable* Picked);
void AddWeapon(class ABaseWeapon* weapon);
bool CanAddInventory(APickable* PickableToAdd);
void ThrowPickable(APickable* PickableThrow);
/** [server] spawns default inventory */
void SpawnDefaultInventory();
//Poids maximum de l'inventory
float MaxInventoryWeight;
float CurrentInventoryWeight;
//utilisé pour équiper une arme depuis l'inventaire
UFUNCTION(BlueprintCallable, Category = Inventory)
void EquipWeapon( EWeaponSlot WeaponSlot);
/** equip weapon */
UFUNCTION(reliable, server, WithValidation)
void ServerEquipWeapon( EWeaponSlot weaponslot);
void UnequipWeapon(ABaseWeapon* WeaponToUnequip);
UFUNCTION(BlueprintCallable, Category = Inventory)
void EquipPrimary();
UFUNCTION(BlueprintCallable, Category = Inventory)
void EquipSecondary();
UFUNCTION(BlueprintCallable, Category = Inventory)
void EquipSideGun();
UFUNCTION(BlueprintCallable, Category = Inventory)
void EquipThrowable();
UFUNCTION(BlueprintCallable, Category = Inventory)
void OnNextWeapon();
UFUNCTION(BlueprintCallable, Category = Inventory)
void OnPreviousWeapon();
/** current weapon rep handler */
UFUNCTION()
void OnRep_CurrentWeapon(class ABaseWeapon* LastWeapon);
///////////////////////////////////////////
//input
void MoveForward(float Val);
void MoveRight(float val);
/* Frame rate independent turn */
void TurnAtRate(float Val);
/* Frame rate independent lookup */
void LookUpAtRate(float Val);
/** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */
float BaseTurnRate;
/** Base lookup rate, in deg/sec. Other scaling may affect final lookup rate. */
float BaseLookUpRate;
void Jump()override;
void Vault();
/** get camera view type */
UFUNCTION(BlueprintCallable, Category = Mesh)
virtual bool IsFirstPerson() const;
public:
/** get weapon attach point */
FName GetWeaponAttachPoint() const;
//Socket au niveau de la main
UPROPERTY(EditAnywhere, Category = WeaponSocket)
FName WeaponAttachPoint;
//Socket au niveau du dos pour primary
UPROPERTY(EditAnywhere, Category = WeaponSocket)
FName PrimaryAttachPoint;
//Socket au niveau du dos pour secondary
UPROPERTY(EditAnywhere, Category = WeaponSocket)
FName SecondaryAttachPoint;
//Socket au niveau du dos pour secondary
UPROPERTY(EditAnywhere, Category = WeaponSocket)
FName SideGunAttachPoint;
USkeletalMeshComponent* GetPawnMesh() const;
/*
* Get either first or third person mesh.
*
* @param WantFirstPerson If true returns the first peron mesh, else returns the third
*/
USkeletalMeshComponent* GetSpecifcPawnMesh(bool WantFirstPerson) const;
/** check if pawn is still alive */
bool IsAlive() const;
//Health actuelle du player
UPROPERTY(BluePrintReadWrite, Replicated)
float Health;
//healthmax
float HealthMax;
UPROPERTY(BluePrintReadWrite)
bool Prone;
private:
/** pawn mesh: 1st person view */
UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
USkeletalMeshComponent* Mesh1P;
/** Take damage, handle death */
virtual float TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser) override;
/**
* Kills pawn. Server/authority only.
* @param KillingDamage - Damage amount of the killing blow
* @param DamageEvent - Damage event of the killing blow
* @param Killer - Who killed this pawn
* @param DamageCauser - the Actor that directly caused the damage (i.e. the Projectile that exploded, the Weapon that fired, etc)
* @returns true if allowed
*/
virtual bool Die(float KillingDamage, struct FDamageEvent const& DamageEvent, class AController* Killer, class AActor* DamageCauser);
public:
//////////////////////////////////////////////////////////////////////////
// Animations
/** play anim montage */
virtual float PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate = 1.f, FName StartSectionName = NAME_None) override;
/** stop playing montage */
virtual void StopAnimMontage(class UAnimMontage* AnimMontage) override;
/** stop playing all montages */
void StopAllAnimMontages();
//UAnimMontage VaultMontage;
////////////////////////////////////////////////////
//fIRE & weapon managements
void Fire();
void OnStopFire();
bool CanFire();
UFUNCTION(reliable, server, WithValidation)
void ServerFire();
bool IsReloading;
void ChangeFireMode();
bool TriggerPulled;
////////////////////////////////////
//Ammo
int8 GetAmmo(EAmmoKind Ammo );
void Reload();
UFUNCTION(reliable, server, WithValidation)
void ServerReload();
///////////////////////////////////////////////////
//Interaction
AActor InteractActor;
};