CrazyOno
(Crazy Ono)
February 13, 2024, 3:06pm
1
Hey i am new in verse and followed a video about how to get the Player who damaged someone and the example in the video was how to send back damege to the Damage dealing Player with “FortCharacterInstigator.Damage(2.0)” and now i wanted my trackers value the Damage dealing player and used
HandlePlayerHit ( DamageResult : damage_result ) : void =
Target := DamageResult.Target
Amount := DamageResult.Amount
if (FortCharacterWhoWasHit := fort_character[Target]):
if (Instigator := DamageResult.Instigator?, Agent := Instigator.GetInstigatorAgent[], FortCharacterInstigator := Agent.GetFortCharacter[]):
TargetValue7 := Tracker8.GetValue(FortCharacterInstigator)
TargetValue6 := Tracker7.GetValue(FortCharacterInstigator)
TargetValue5 := Tracker6.GetValue(FortCharacterInstigator)
TargetValue4 := Tracker5.GetValue(FortCharacterInstigator)
TargetValue3 := Tracker4.GetValue(FortCharacterInstigator)
TargetValueNew := Tracker3.GetValue(FortCharacterInstigator)
TargetValue2 := Tracker2.GetValue(FortCharacterInstigator)
TargetValue := Tracker.GetValue(FortCharacterInstigator)"
for it but here FortCharacterInstigator is marked red. Would be happy over any reply
If you hover your mouse over the red error, what does it say the error is?
giovauefn
(giovauefn)
February 13, 2024, 8:10pm
3
The damage could be done by some world object, so you must tell him that it could not be an agent.
To do this, we use Option .
This is the fix:
HandlePlayerHit ( DamageResult : damage_result ) : void =
Target := DamageResult.Target
Amount := DamageResult.Amount
if (FortCharacterWhoWasHit := fort_character[Target]):
if (Instigator := DamageResult.Instigator?, Agent := Instigator?.GetInstigatorAgent[], FortCharacterInstigator := Agent.GetFortCharacter[]):
TargetValue7 := Tracker8.GetValue(FortCharacterInstigator)
TargetValue6 := Tracker7.GetValue(FortCharacterInstigator)
TargetValue5 := Tracker6.GetValue(FortCharacterInstigator)
TargetValue4 := Tracker5.GetValue(FortCharacterInstigator)
TargetValue3 := Tracker4.GetValue(FortCharacterInstigator)
TargetValueNew := Tracker3.GetValue(FortCharacterInstigator)
TargetValue2 := Tracker2.GetValue(FortCharacterInstigator)
TargetValue := Tracker.GetValue(FortCharacterInstigator)"
I have simply added a ? after Instigator:
Agent := Instigator?.GetInstigatorAgent[]
CrazyOno
(Crazy Ono)
February 16, 2024, 1:53pm
4
Hey this is the problem hope this helps you
CrazyOno
(Crazy Ono)
February 16, 2024, 1:54pm
5
Sorry for my late respond. I have checked your tip and added the “?” and now the “?” and the “FortCharacterInstigator” are marked red
The Tracker’s GetValue function expects an Agent, not a FortCharacter. So either give it a parameter of type Agent, or you could use the Player as well. Either one should work.
CrazyOno
(Crazy Ono)
February 16, 2024, 2:03pm
7
How do i need to rewrite my script to make the FortCharacter an Agent?
giovauefn
(giovauefn)
February 16, 2024, 5:05pm
8
My bad, didn’t see you put already the ? When defining Instigator. Revert that thing I said
giovauefn
(giovauefn)
February 16, 2024, 5:06pm
9
Just put Agent inside the brackets
TargetValue := Tracker.GetValue(Agent)