• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Projectile Indexing

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
So lately I've been working on indexing projectiles in wc3, but I've run into a couple of problems.

The design I've decided upon creates a queue for each unit on the map and queues up each attack they do. Because attacks on a specific target/coordinate typically happen in order, this design actually works. The only problem I have is if there is if a unit fires a slow projectile, runs in front of it, and then fires again at the exact same target. Upon impact, it'll treat projectile 2 as projectile 1 and projectile 1 as projectile 2.

Keep in mind when I say projectiles, I am talking about warcraft 3 projectiles, not custom projectiles. There is no way to actually reference these projectiles. My technique uses probability to determine which projectile actually hit a unit (also works on melee). The probability happens to be 100% in every case but the one I mentioned.

So, does anyone have any ideas for dealing with that last case, or should I just work on the system and say maps cannot have projectiles that move slower than the movement speed of the unit that fired it and a map cannot have attacks that shoot projectiles at differing speeds at the same target.

Tx.
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
U HAZ 666 POSTS D:

Well, what you said about not allowing units to have too low projectile speed is the only solution for that problem of yours. At least if you want to use the wc3 projectiles.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
you could make a few orb effects and change them every time a unit attacks (orb effects are required for damage detection anyway since spells would trigger it, too)
this would not solve it in all cases but makes it very unlikely to happen

also your problem might occur with knockbacks or teleport-type spells

that's true and would probably be easier than orders.. just compare orb effects instead.

I'd need like 100 spellbook abilities and 100 orb abilities tho : P.
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
that's true and would probably be easier than orders.. just compare orb effects instead.

I'd need like 100 spellbook abilities and 100 orb abilities tho : P.

two or three would be enough I think
just do your indexing stuff and check if the orb effect buff is equal to the orb effect ability

all in all it might look like this:
1. unit starts attacking
2. replace orb effect ability 1 with 2
3. save orb effect ability 2 with unit and data and so on
4. unit blinks to target
5. unit attacks again
6. replace orb effect ability 2 with 1
7. save stuff again (to 1 this time)
8. second missile hits (which creates a buff of type 1)
9. check and remove buff added by missile and choose saved data 1
10. first missile hits (which creates a buff of type 2)
11. check and remove buff 2 and choose data 2

rather unlikely that many more missiles will still be in the air (except very very slow missiles)

evasion still is a problem
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
So, does anyone have any ideas for dealing with that last case, or should I just work on the system and say maps cannot have projectiles that move slower than the movement speed of the unit that fired it and a map cannot have attacks that shoot projectiles at differing speeds at the same target.

Are you sure you've considered all possibilities? There are a hell of a lot, and unit movement speed definitely isn't the only thing that can cause this queue to malfunction. For example (this is just off the top of my head) if you Blink in front of your attack and attack again you could potentially screw up the queue, or let's say the target moves in such a way that the second projectile fired hits him before the first projectile (this is easier to visualize if you give the unit Blink).

From the sound of it you're simply detecting when a unit follows through with an attack (which would require a system in itself) and when an attack has been followed through (the only logical solution to this is with damage-detection) so I'm really curious as to how things like evasion are not a problem.
 
Well, there is only a few natives which are used for skills/abilities to get the missile data and other.
I'll list them here.
JASS:
native AddSpellEffect               takes string abilityString, effecttype t, real x, real y returns effect
native AddSpellEffectLoc            takes string abilityString, effecttype t,location where returns effect
native AddSpellEffectById           takes integer abilityId, effecttype t,real x, real y returns effect
native AddSpellEffectByIdLoc        takes integer abilityId, effecttype t,location where returns effect
native AddSpellEffectTarget         takes string modelName, effecttype t, widget targetWidget, string attachPoint returns effect
native AddSpellEffectTargetById     takes integer abilityId, effecttype t, widget targetWidget, string attachPoint returns effect

native GetAbilityEffect             takes string abilityString, effecttype t, integer index returns string
native GetAbilityEffectById         takes integer abilityId, effecttype t, integer index returns string
native GetAbilitySound              takes string abilityString, soundtype t returns string
native GetAbilitySoundById          takes integer abilityId, soundtype t returns string

Attack's ID = 'Aatk'
Movement's ID = 'Amov'
/Sidenote: I have no idea how to use them!
 
Last edited:
Level 18
Joined
Jan 21, 2006
Messages
2,552
OffGraphic, first of all they're "natives" not "nations" and second of all those natives you listed are all for non-projectile related data associated with an ability, namely the effects which are simply special effects that are played at various points in the spell.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Berb, I'm thinking the only way to properly index them is by adding effects to the attacking unit on each attack (add/remove)... but that'd require a huge binary if thingie... I don't think it's worth it at this point... well, it might be.

The overhead on moving projectiles to a position would still probably be much larger than all of the crazy indexing to index reg attacks.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
OffGraphic, I've used them before; that is how I can tell you what they do. It is an alternative to declaring constant strings that reference model paths, rather than having the user have to manually change the string you can just use:

JASS:
local string modelPath = GetAbilityEffectById('A000', EFFECT_TYPE_SPECIAL, 0)

The first parameter is the raw-code of the ability. The second parameter is the type of effect you are trying to reference from the ability; alternatives to EFFECT_TYPE_SPECIAL include EFFECT_TYPE_TARGET and others (they're not hard to diffuse from the object editor). The last parameter is the index of the effect you would like to reference. As you probably know, you can have more than one effect for the same effect-type (such as Bloodlust, Berserk, etc).

JASS:
EFFECT_TYPE_AREA_EFFECT
EFFECT_TYPE_CASTER
EFFECT_TYPE_EFFECT
EFFECT_TYPE_LIGHTNING
EFFECT_TYPE_MISSILE
EFFECT_TYPE_SPECIAL
EFFECT_TYPE_TARGET

By the way I know what you're thinking, and no EFFECT_TYPE_MISSILE doesn't help.
 
Level 1
Joined
Nov 6, 2010
Messages
1
Naval Combat is a map with custom battleships-like projectiles which can target units. Unfortunatly the version I have is protected.
 
Status
Not open for further replies.
Top