Skript icon indicating copy to clipboard operation
Skript copied to clipboard

EffForceAttack Damage Entity By Amount

Open Absolutionism opened this issue 7 months ago • 3 comments

Problem

No support for having an entity damage another entity by a specific amount.

Solution

Updates EffForceAttack by adding 2 new patterns to add this support

Testing Completed

CODE
command /emptyhand:
	trigger:
		spawn a zombie at test-location:
			set {_attacker} to entity
		spawn a villager at test-location:
			set {_victim} to entity
		make {_attacker} attack {_victim}
		clear entity within {_attacker}
		clear entity within {_victim}

command /swordhand:
	trigger:
		spawn a zombie at test-location:
			set {_attacker} to entity
			set the tool of {_attacker} to a netherite sword
		spawn a villager at test-location:
			set {_victim} to entity
		make {_attacker} attack {_victim}
		clear entity within {_attacker}
		clear entity within {_victim}

command /damage [<num: number = 1>]:
	trigger:
		spawn a zombie at test-location:
			set {_attacker} to entity
		spawn a villager at test-location:
			set {_victim} to entity
		make {_attacker} damage {_victim} by {_num}
		clear entity within {_attacker}
		clear entity within {_victim}

on damage:
	broadcast "Damage %damage%"
	broadcast "Final: %final damage%"
	broadcast "Attacker: %attacker%"

Completes: #1729 Related: none

Absolutionism avatar May 18 '25 22:05 Absolutionism

should have some test scripts

I did attempt making a test script but there seemed to be some discrepancies for the test (quickTest) versus a started up server (skriptTestDev) Such as, having a zombie equipped with a netherite sword was still dealing the same amount of damage as with no sword, on the test. But actually starting it up and testing manually it worked fine.

So I took advantage of your new PR template to provide the code I used to test manually.

Absolutionism avatar May 19 '25 11:05 Absolutionism

I did attempt making a test script but there seemed to be some discrepancies for the test (quickTest) versus a started up server (skriptTestDev) Such as, having a zombie equipped with a netherite sword was still dealing the same amount of damage as with no sword, on the test. But actually starting it up and testing manually it worked fine.

Test what does work, though. It's understandable that it might not update items but you should be able to test the newly added syntax just fine.

sovdeeth avatar May 19 '25 17:05 sovdeeth

tests failing

I know -> https://github.com/SkriptLang/Skript/issues/7921

Absolutionism avatar Jun 15 '25 17:06 Absolutionism