Summary
Using this script for NPC’s if you have the NPC as the instigator the npc will not do any damage
OnBegin< override>()< suspends>:void=
if:
NPCAgent := GetAgent[]
NPCChar := NPCAgent.GetFortCharacter[]
#Allows us to tell npcs to go to different place like the pathfinding service in roblox
NPCNav := NPCChar.GetNavigatable[]
#Control where npc is looking
NPCFocus := NPCChar.GetFocusInterface[]
#Control the npc's animations
NPCAnim := NPCChar.GetPlayAnimationController[]
DamageArgs := damage_args{Instigator := option{NPCChar}, Source := option{NPCChar}, Amount := NPCDamage}
then:
loop:
Sleep(0.1)
if (NewTarget := FindNearestTargetFromPos[NPCChar], NewAgent := NewTarget.GetAgent[]):
spawn{NPCFocus.MaintainFocus(NewAgent)}
NavTarget := MakeNavigationTarget(NewAgent)
GoToTarget(NPCChar, NavTarget)
DistanceDifference := Distance(NPCChar.GetTransform().Translation, NewTarget.GetTransform().Translation)
#Set to 500.0 for testing purposes
if (DistanceDifference < 500.0):
NewTarget.Damage(DamageArgs) #34.30 Did not fix
Sleep(1.0)
GoToTarget(NPC : fort_character, NavTarget : navigation_target)<suspends>:void=
race:
Sleep(5.0)
if(NPCNav := NPC.GetNavigatable[], NPCAnim := NPC.GetPlayAnimationController[]):
NPCNav.NavigateTo(NavTarget, ?MovementType := movement_types.Running, ?ReachRadius := 50.0)
Print("Reached NavTarget")
NPCAnim.Play(Attack1)
Sleep(DamageDelay)
Print("Broke Race")
FindNearestTargetFromPos(FortChar : fort_character)< decides>< transacts> : fort_character =
var MaybeTarget : ?fort_character = false
for(Player : GetGlobalPlayspace().GetPlayers(), FC := Player.Player.GetFortCharacter[]):
DistanceDifference := Distance(FortChar.GetTransform().Translation, FC.GetTransform().Translation)
if (DistanceDifference < CheckTargetRange and not FC = FortChar):
set MaybeTarget = option{FC}
return MaybeTarget?
Please select what you are reporting on:
Unreal Editor for Fortnite
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
create a NPC_Behavior script, create damage_args to set NPC as the instigator/source, have the NPC damage the player, put behavior script inside a NPC spawner, load in and start game
Expected Result
NPC should damage the player
Observed Result
NPC does not do any damage
Platform(s)
PC
Additional Notes
If you damage the player without an instigator then it counts as self damage and since a lot of maps with NPCs have damage amplifiers the player gets hit with the multiplier. Ex. NPC set to do 10 damage but player has a 4x multiplier if NPC is not the instigator the player will take 40 damage