HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Tripwire

11-29-2008, 02:24 AM#1
Anitarf
Click image for larger version

Name:	SRT_Tripwire.jpg
Views:	414
Size:	36.8 KB
ID:	38755
A spell that creates a tripwire between two target points. The first enemy ground unit to cross the wire will take damage and become stunned.

The spell requires the following resources:
TimerUtils, LineSegment, SimError, IsUnitSpellResistant, xe, ABuff

This spell was requested by Jazradel in the spell request thread.
Expand Spell code:
Attached Images
File type: jpgSRT_Tripwire.jpg (36.8 KB)
Attached Files
File type: w3xTripwire.w3x (110.7 KB)
11-29-2008, 03:13 AM#2
moyack
Could you post the code for the lazy people who don't want to open the WE.... like me... thanks :P
11-29-2008, 03:16 AM#3
Vexorian
Moyack, you should already have had WarCiTy in your system.
11-29-2008, 03:25 AM#4
Anitarf
Quote:
Originally Posted by moyack
Could you post the code for the lazy people who don't want to open the WE.... like me... thanks :P
Done.
11-29-2008, 03:41 AM#5
Jazradel
Very impressive.
11-29-2008, 04:07 AM#6
Ammorth
Quote:
//code shamelessly copied from Ammorth's Line Segments
Don't feel bad. In essence, all code is just a form of copying someone else's code.

Ps: for the record, you have permission :P
12-01-2008, 07:18 PM#7
Anitarf
Quote:
Originally Posted by Litany
The targeting itself doesn't seem to be very robust here either. It breaks without fail for me after selecting 3-4 invalid second targets.
That's odd, it works without fail for me; perhaps it's a framerate issue, have you tried increasing the CANCEL_MARGIN constant?
12-03-2008, 04:42 PM#8
Rising_Dusk
So why did you shamelessly copy Ammorth's line segments instead of just using it?
12-03-2008, 08:20 PM#9
Anitarf
I can't use it because his GroupEnumUnitsInRangeOfSeg function doesn't take unit's collision sizes into account and if I wanted to do that without inlining his code I'd have to deal with locations; so I inlined his code instead for the sake of efficiency.
12-04-2008, 02:07 AM#10
Ammorth
Not asking for you to not in-line it, but wouldn't adding the correction factor to the range accomplish the exact same thing?

Collapse JASS:
GetEnumUnitsInRangeOfSeg(arguments..., distance + collisionCorrection)

In-lining is totally fine with me as performance with spells is important.
12-04-2008, 05:09 AM#11
Rising_Dusk
CollisionCorrection as you have it would be unit-type dependent, something that can't be accessed in JASS without hardcoding it or using a processing-hog function. Performing IsUnitInRange..(...) checks guarantees that a unit's collision is properly factored.

Anyways, you should probably update LineSegments to include collision checks and I think Anitarf should then update this to use LineSegments. It seems counter-productive to shoot for modularity as a site scripting goal if we're just inlining other peoples' codes because they lack a very specific feature that they should have anyways.
12-15-2008, 09:39 PM#12
Flame_Phoenix
Impressive in deed. However I fail to understand why it doesn't work sometimes ....
When I tested the spell, there was a time I had a unit in the wire and yet nothing happened. Problem is that this "there was a time" gets repeated quite often ...

here is the replay, I hope it helps:
Attached Files
File type: w3gLastReplay.w3g (9.9 KB)
01-02-2009, 02:24 PM#13
Anitarf
Updated, the spell now uses the LineSegment library which also fixes the bug that Flame_Phoenix reported.
01-02-2009, 06:41 PM#14
Rising_Dusk
Good, then consider this approved.
08-04-2009, 10:18 PM#15
Anitarf
Updated the test map so it works in 1.24 (had to import the new Table and TimerUtils, everything else remains the same).