Introduction
First of all, Credits and thanks to BPower, Dirac, and Vexorian for their missile systems at which I based this system upon, and to AGD for the help with effect orientation methods.
This is a Missile system that I put together initially to fulfill my resources needs. Very often while I was creating system, spells and maps I found myself in need of a such systems, but all the available options usually have a little flaw that forced me to used something else.
For example, let's say I wanted a missile that can arc and homing to a target, well there goes BPower's system. It can arc/curve but can't do homing with arc/curve natively. So the options left are Vexorian xemissile which can arc and do homing but cant curve, and Dirac's Missile system. Then again more problems with those, because Vexorian system do not have a lot of the useful events like Dirac's and BPower's systems. Dirac's system can arc/curve and do homing but it's T32 timer is never stopped and it do not have some useful events that the BPower system has. So I decided to get all three system together and build my own system with the stuff I think is useful and with the syntax I think is the most friendly, because I'm not a genius of vJASS myself.
What's different in this system?
Ok, so why it's called "Relativistic Missiles"? Well because mid development I realize that the way missiles were being processed could be optimized and the Einstein postulates about Time Dilation by Gravity gave the idea behind the implementation. Yeah, I know, WTH?
When it comes to Missile systems, performance is everything, and all missiles systems do basically the same thing when processing missiles instances, they loop every set period, which is usually 1/32, through all instances and do their calculations and event calls. The problem with it, is that the more instances existing at a given moment the greater will be the tanking of the game frame rate because the game will lower its fps so all that's need to be done before the next frame gets drawn have time to do so, and that's where the Einstein postulates gave me an idea.
See, when we study Relativity, we learn that gravity dilates time, the greater the gravitational potential (more or less mass) the slower time passes relative to an outside point of reference. Gravity in this analogy would be the amount of missiles instances currently existing, so instead of letting the game frame rate drops drastically to move all those instances, I make the missile instances have their time dilated.
Ok, but how?? Simple, first we need to find what I'll be calling the system Sweet Spot, which is the amount of missiles the game can handle without dropping to much performance per given period, which I found out to be between 150 and 200 missiles. Then we limit the amount of missiles processed per period to this sweet spot, and move the next missile in the line to be processed and all other behind it to the front, In terms of data structures, think of a circular list with a head and tail, and we move the head and tail to change the initial and final positions. I did it with arrays because they are a bit faster and because I'm lazy .
But that's not all, because by limiting the amount of missiles processed, we delay their next process call by (total amount)/(sweet spot), so now their speed needs to be corrected and relativity comes full circle now, because time dilation has it's relation with Length Contraction, so we increment the missiles speed by this factor.
Also, something very important is that this system is using only effects as missiles, thanks to the new natives introduced in 1.31, so no dummy units, no CreateUnit() and SetUnitFacing() blasphemy. I've included in the test map a version of this system that do use the dummy method for those that do not have the newer versions of the game. I Also included a version of this system that uses the usual process method, so processing all missiles in a single blow.
Results
I've taken the liberty to test this system against the king of Missile systems for some time, BPower's System. Below, there are 3 videos I make for stress test. The first from the left is BPower's Missile System reworked by AGD. Amazing job btw. You will be able to notice what I was talking about earlier about the sweet spot, when there are more than 150 or so missiles being processed, the fps goes basically to 0 and it freezes until the missiles are finished.
The video in the middle is my system in its normal version (not relativistic). It performs a little better (I've build it a little differently), but in the same way, when the missile count near 250, the fps starts to go down hill real quick.
The video in the right is the relativistic version, notice the missile count and fps compared to the 2 other system. At about 600 missiles fps get really low, but not so much because of the amount of missiles being processed but because of the amount of visual effects in the screen. If the screen was moved to the side where not so many stuff is visible, fps goes up. In my internal tests I was reaching more than 1200 missiles with about 16 fps but with no screen freezes.
And Last but not Least, a video with the examples.
vJASS:
event onPeriod takes nothing returns boolean
-> if declared will run whenever every missile period
event onHit takes unit hit returns boolean
-> if declared and collision is greater than 0
-> will run whenever the missile collides with a unit
event onMissile takes Missiles missile returns boolean
-> if declared and collision is greater than 0
-> will run whenever the missile collides with another missile
event onDestructable takes destructable dest returns boolean
-> if declared and collision is greater than 0
-> will run whenever the missile collides with a destructable
event onItem takes item i returns boolean
-> if declared and collision is greater than 0
-> will run whenever the missile collides with an item
event onCliff takes nothing returns boolean
-> if declared, will run whenever the missile collides with a cliff wall
-> with height greater than the current missile height
event onTerrain takes nothing returns boolean
-> if declared, will run whenever the missile collides with terrain
event onTileset takes nothing returns boolean
-> if declared, will run whenever the missile changes tileset types
event onFinish takes nothing returns boolean
-> if declared, will run when the missiles reaches its destination
event onBoundaries takes nothing returns boolean
-> if declared, will run whenever the missile tries to go out
-> of the map boundaries.
event onPause takes nothing returns boolean
-> if declared, will run when the missile is paused
event onResume takes nothing returns boolean
-> if declared, will run when the missile is unpaused
event onRemove takes nothing returns nothing
-> if declared, will run when the missile is removed
vJASS:
x -> The current x coordinate of the missile (readonly)
y -> The current y coordinate of the missile (readonly)
z -> The current z coordinate of the missile (readonly)
prevX -> The previous x coordinate of the missile (readonly)
prevY -> The previous y coordinate of the missile (readonly)
prevZ -> The previous z coordinate of the missile (readonly)
nextX -> The next x coordinate of the missile (readonly)
nextY -> The next y coordinate of the missile (readonly)
nextZ -> The next z coordinate of the missile (readonly)
travel -> The current traveled distance of the missile (readonly)
source -> The source unit for the missile (read and write)
target -> The target unit for the missile. If set the missile will be roaming (read and write)
owner -> The owning player of the missile (read and write)
vision -> The sight range of the missile (read and write)
collideZ -> If true, the missile will take into consideration the unit collision size, destructable oclusion height and item size when running the onHit, onDestructable, onItem events (read and write)
collision -> The collision size of the missile. If not set, the events onHit, onDestructable, onItem and onMissile will no run (read and write)
damage -> Stores the amount of damage to be used inside an event (read and write)
acceleration -> The missile acceleration (read and write)
data -> Stores information to be used inside any event (read and write)
model -> The model of the missile (read and write)
curve -> The curve of the missile (read and write)
arc -> The Arc of the missile (read and write)
scale -> The scale of the missile (read and write)
speed -> The speed of the missile (read and write)
duration -> Set the speed of the missile to match a duration (read and write)
roll -> If true, the missile will roll as well (1.31+ only) (read and write)
type -> Integer that can be used to diferentiate missiles (read and write)
paused -> True when the missile is paused, false otherwise (read and write)
tileset -> The current terrain type under the missile (readonly)
timeScale -> The time scale of the effect model (read and write) (1.31+ non dummmy version only)
alpha -> The effect model alpha value (read and write) (1.31+ non dummmy version only)
playerColor -> The effect model player color (read and write) (1.31+ non dummmy version only)
animation -> The effect model animation type (read and write) (1.31+ non dummmy version only)
impact -> The object representing the impact coordinates (x, y, z, angle, distance, square, slope, alpha) (read and write)
origin -> The object representing the origin coordinates (x, y, z, angle, distance, square, slope, alpha) (read and write)
effect -> The object representing the missile (size, yaw, pitch, roll, path, effect, attachments), and attachments has (x, y, z, size, yaw, pitch, roll, path, effect)
vJASS:
x -> The current x coordinate of the missile (readonly)
y -> The current y coordinate of the missile (readonly)
z -> The current z coordinate of the missile (readonly)
prevX -> The previous x coordinate of the missile (readonly)
prevY -> The previous y coordinate of the missile (readonly)
prevZ -> The previous z coordinate of the missile (readonly)
nextX -> The next x coordinate of the missile (readonly)
nextY -> The next y coordinate of the missile (readonly)
nextZ -> The next z coordinate of the missile (readonly)
travel -> The current traveled distance of the missile (readonly)
source -> The source unit for the missile (read and write)
target -> The target unit for the missile. If set the missile will be roaming (read and write)
owner -> The owning player of the missile (read and write)
collideZ -> If true, the missile will take into consideration the unit collision size, destructable oclusion height and item size when running the onHit, onDestructable, onItem events (read and write)
collision -> The collision size of the missile. If not set, the events onHit, onDestructable, onItem and onMissile will no run (read and write)
damage -> Stores the amount of damage to be used inside an event (read and write)
acceleration -> The missile acceleration (read and write)
data -> Stores information to be used inside any event (read and write)
model -> The model of the missile (to set use yourMissile:model(string), to get use yourMissile.Model)
curve -> The curve of the missile (to set use yourMissile:curve(real), to get use yourMissile.Curve)
arc -> The Arc of the missile (to set use yourMissile:arc(real), to get use yourMissile.Arc)
scale -> The scale of the missile (to set use yourMissile:scale(real), to get use yourMissile.Scale)
speed -> The speed of the missile (to set use yourMissile:speed(real), to get use yourMissile.Speed)
duration -> Set the speed of the missile to match a duration (to set use yourMissile:duration(real), to get use yourMissile.Duration)
vision -> The sight range of the missile (to set use yourMissile:vision(real), to get use yourMissile.Vision)
roll -> If true, the missile will roll as well (1.31+ only) (read and write)
type -> Integer that can be used to diferentiate missiles (read and write)
paused -> True when the missile is paused, false otherwise (read and write)
timeScale -> The time scale of the effect model (to set use yourMissile:timeScale(real), to get use yourMissile.TimeScale)
alpha -> The effect model alpha value (to set use yourMissile:alpha(integer), to get use yourMissile.Alpha)
playerColor -> The effect model player color (to set use yourMissile:playerColor(integer), to get use yourMissile.playercolor)
animation -> The effect model animation type (to set use yourMissile:animation(integer), to get use yourMissile.Animation)
tileset -> The current terrain type under the missile (readonly)
impact -> The object representing the impact coordinates (x, y, z, angle, distance, square, slope, alpha) (read and write)
origin -> The object representing the origin coordinates (x, y, z, angle, distance, square, slope, alpha) (read and write)
effect -> The object representing the missile (size, yaw, pitch, roll, path, effect, attachments), and attachments has (x, y, z, size, yaw, pitch, roll, path, effect)
vJASS:
Missile -> The missile
MissileDestroy -> Set this variable to true inside a missile event trigger to destroy the missile
MissileStart -> The starting point of the missile. Set this variable before running the MissileCreate trigger
MissileStartZ -> The starting Z of the missile. Set this variable before running the MissileCreate trigger
MissileFinish -> The end point of the missile. Set this variable before running the MissileCreate trigger
MissileFinishZ -> The end Z of the missile. Set this variable before running the MissileCreate trigger
MissileModel -> The missile model. Set this variable before running the MissileCreate trigger. You can set this varible to change the model at any point inside a missile event trigger
MissileScale -> The missile model scale. Set this variable before running the MissileCreate trigger. You can set this varible to change the scale at any point inside a missile event trigger
MissileSpeed -> The missile speed. Set this variable before running the MissileCreate trigger. You can set this varible to change the speed at any point inside a missile event trigger
MissileDuration -> The missile duration. Set this variable before running the MissileCreate trigger. You can set this varible to change the duration at any point inside a missile event trigger
MissileArc -> The missile arc. Set this variable before running the MissileCreate trigger. You can set this varible to change the arc at any point inside a missile event trigger
MissileCurve -> The missile curve. Set this variable before running the MissileCreate trigger. You can set this varible to change the curve at any point inside a missile event trigger
MissileVision -> The missile sight range. Set this variable before running the MissileCreate trigger. You can set this varible to change the sight range at any point inside a missile event trigger
MissileDamage -> Stores the damage. Set this variable before running the MissileCreate trigger. You can set this varible to change the damage at any point inside a missile event trigger
MissileCollision -> The missile collision size. Set this variable before running the MissileCreate trigger. You can set this varible to change the collision at any point inside a missile event trigger
MissileAcceleration -> The missile acceleration. Set this variable before running the MissileCreate trigger. You can set this varible to change the acceleration at any point inside a missile event trigger
MissileCollideZ -> If true, the missile will check Z height when colliding. Set this variable before running the MissileCreate trigger. You can set this varible to change the model at any point inside a missile event trigger
MissileSource -> The missile source unit. Set this variable before running the MissileCreate trigger. You can set this varible to change the source at any point inside a missile event trigger
MissileTarget -> The missile target unit. If set the missile will roam to the target. Set this variable before running the MissileCreate trigger. You can set this varible to change the target at any point inside a missile event trigger
MissileOwner -> The owner of the missile. Set this variable before running the MissileCreate trigger. You can set this varible to change the owner at any point inside a missile event trigger
MissilePaused -> True if the missile is paused, false otherwise
MissileRoll -> If true the missile will use roll (1.31+)
MissileType -> Set if you want to categorize the missile. Set this variable before running the MissileCreate trigger. You can set this varible to change the type at any point inside a missile event trigger
MissilePosition -> The current missile position
MissileZ -> The current missile Z
MissileLastPosition -> The last missile position
MissilePrevZ -> The last missile Z
MissileNextPosition -> The next missile position
MissileNextZ -> The next missile Z
MissileVelocity -> The missile velocity. Velocity is the speed over the system period.
MissileTravelled -> The missile travelled distance. It is reseted if you deflect or bounce the missile.
MissileRemoveLocations -> Set to true before running MissileCreate trigger to remove the MissileStart and MissileFinish points automatically.
MissileHitUnit -> The hitted unit inside an onHit event trigger
MissileHitDestructable -> The hitted destructable inside an onDestructable event trigger
MissileHitItem -> The hitted item inside an onItem event trigger
MissileHitMissile -> The hitted missile inside an onMissile event trigger
MissileTileset -> The terrain type under the missile
MissileData -> The missile data variable can be used to hold information (integer)
MissileTimeScale -> The missile effect time scale. Set this variable before running the MissileCreate trigger. You can set this varible to change the time scale at any point inside a missile event trigger (1.31+ non dummmy version only)
MissileAlpha -> The missile effect alpha value. Set this variable before running the MissileCreate trigger. You can set this varible to change the alpha value at any point inside a missile event trigger (1.31+ non dummmy version only)
MissilePlayerColor -> The missile effect player color. Set this variable before running the MissileCreate trigger. You can set this varible to change the player color of the effect at any point inside a missile event trigger (1.31+ non dummmy version only)
MissileAnimation -> The missile effect animation type. Set this variable before running the MissileCreate trigger. You can set this varible to change the animation type of the effect at any point inside a missile event trigger (1.31+ non dummmy version only)
MissileDeflectTarget -> Set this variable before running the MissileDeflectTarget trigger to deflect the missile to the unit assigned to this variable
MissileRed -> Set this variable (and green and blue) after the missile is created and then run the MissileColor trigger to change the missile effect color values (1.31+ non dummmy version only)
MissileGreen -> Set this variable (and red and blue) after the missile is created and then run the MissileColor trigger to change the missile effect color values (1.31+ non dummmy version only)
MissileBlue -> Set this variable (and red and green) after the missile is created and then run the MissileColor trigger to change the missile effect color values (1.31+ non dummmy version only)
Missile_onPeriod -> Set this variable to a trigger that you want to run on every missile period
Missile_onHit -> Set this variable to a trigger that you want to run when the missile hits an unit. Use the MissileHitUnit variable to access the hitted unit
Missile_onDestructable -> Set this variable to a trigger that you want to run when the missile hits a destructable. Use the MissileHitDestructable variable to access the hitted destructable
Missile_onItem -> Set this variable to a trigger that you want to run when the missile hits an item. Use the MissileHitItem variable to access the hitted item
Missile_onMissile -> Set this variable to a trigger that you want to run when the missile hits another Missile. Use the MissileHitMissile variable to access the hitted Missile
Missile_onCliff -> Set this variable to a trigger that you want to run when the missile collides with a cliff wall with height greater than the current missile height
Missile_onTerrain -> Set this variable to a trigger that you want to run when the missile collides with terrain
Missile_onTileset -> Set this variable to a trigger that you want to run when the missile changes tileset types
Missile_onFinish -> Set this variable to a trigger that you want to run when the missile reaches its destination
Missile_onBoundaries -> Set this variable to a trigger that you want to run when the missile tries to leave the map
Missile_onPause -> Set this variable to a trigger that you want to run when the missile is paused
Missile_onResume -> Set this variable to a trigger that you want to run when the missile is unpaused
Missile_onRemove -> Set this variable to a trigger that you want to run when the missile is removed
MissileEvent -> This variable represents which event is being executed. Compere it to one of the following variables inside a trigger to decide what to do in each event
MissileOnPeriod -> MissileEvent is set to the value of this variable when Missile_onPeriod is set to a trigger
MissileOnHit -> MissileEvent is set to the value of this variable when Missile_onHit is set to a trigger
MissileOnDestructable -> MissileEvent is set to the value of this variable when Missile_onDestructable is set to a trigger
MissileOnItem -> MissileEvent is set to the value of this variable when Missile_onItem is set to a trigger
MissileOnMissile -> MissileEvent is set to the value of this variable when Missile_onMissile is set to a trigger
MissileOnCliff -> MissileEvent is set to the value of this variable when Missile_onCliff is set to a trigger
MissileOnTerrain -> MissileEvent is set to the value of this variable when Missile_onTerrain is set to a trigger
MissileOnTileset -> MissileEvent is set to the value of this variable when Missile_onTileset is set to a trigger
MissileOnFinish -> MissileEvent is set to the value of this variable when Missile_onFinish is set to a trigger
MissileOnBoundaries -> MissileEvent is set to the value of this variable when Missile_onBoundaries is set to a trigger
MissileOnPause -> MissileEvent is set to the value of this variable when Missile_onPause is set to a trigger
MissileOnResume -> MissileEvent is set to the value of this variable when Missile_onResume is set to a trigger
MissileOnRemove -> MissileEvent is set to the value of this variable when Missile_onRemove is set to a trigger
vJASS:
method bounce takes nothing returns nothing
-> Bounces the missile, reseting angles
method deflect takes real x, real y, real z returns nothing
-> Deflects the missile to the x, y and z coordinates
method deflectTarget takes unit u returns nothing
-> Deflects the missile to a unit
method flushAll takes nothing returns nothing
-> Flushes the hit group for the missile
method flush takes widget w returns nothing
-> Remove a unit, destructable, item or missile from the hit group
method hitted takes widget w returns boolean
-> Returns true if the unit, destructable or item was hit by the missile
method attach takes string model, real dx, real dy, real dz, real scale returns effect
-> Attach an effect to the missile and return the effect attached
-> dx, dy, and dz are offsets from the main missile coordinates
method detach takes effect attachment returns nothing
-> Detach an effect attached to the missile
method pause takes boolean flag returns nothing
-> If true will pause the misisle, else will unpause it
method color takes integer red, integer green, integer blue returns nothing
-> Changes the missile effect model color (1.31+ non dummy version only)
vJASS:
MissileDeflectPosition
MissileDeflectZ
MissileDeflectTarget
Set the above variables then run the MissileDeflect or MissileDeflectTarget triggers to deflect the missile
MissileFlushUnit
Set the above variable then run the MissileFlush to make the set unit be able to be hitted again by the missile
MissileHittedUnit
MissileHitted
Set the MissileHittedUnit to a unit then run the MissileHitted trigger. After that you can use the MissileHitted varible to check if the unit was already hitted by the missile
MissileAttachModel
MissileAttachX
MissileAttachY
MissileAttachZ
MissileAttachScale
MissileDetachEffect
Set the above varibles then run the MissileAttach trigger to attach an effect to the missile with MissileAttach(Model, X, Y, Z, Scale)
MissileDetachEffect
Set the above variable to the effect that was previously attached to the missile then run the MissileDetach trigger
Run the MissileBounce trigger to bounce the missile and reset its travalled distance
Run the MissileFlushAll trigger flush all units hitted by the missile
Run the MissilePause trigger pause the missile
Run the MissileResume trigger unpause the missile
Run the MissileBounce trigger to bounce the missile and reset its travalled distance
MissileRed
MissileGreen
MissileBlue
Set the above variables and then run the MissileColor trigger to change the missile effect model color (1.31+ non dummy version only)
vJASS:
function CreateMissileGroup takes nothing returns MissileGroup
-> Creates a missile group and return it
function DestroyMissileGroup takes MissileGroup missiles returns nothing
-> Destroys the misisle group
function MissileGroupGetSize takes MissileGroup missiles returns integer
-> Returns the size of the missile group
function GroupMissileAt takes MissileGroup missiles, integer position returns Missiles
-> Returns the missile at the given index.
function ClearMissileGroup takes MissileGroup missiles returns nothing
-> Clear the missile group
function IsMissileInGroup takes Missiles missile, MissileGroup missiles returns boolean
-> True if the missile is inside the missile group
function GroupRemoveMissile takes MissileGroup missiles, Missiles missile returns nothing
-> Removes the missile from the missile group
function GroupAddMissile takes MissileGroup missiles, Missiles missile returns nothing
-> Add the missile to the missile group
function GroupPickRandomMissile takes MissileGroup missiles returns Missiles
-> Returns a random missile from the misisle group. 0 if empty
function FirstOfMissileGroup takes MissileGroup missiles returns Missiles
-> Returns the first missile inside the missile group. 0 if empty
function GroupAddMissileGroup takes MissileGroup source, MissileGroup destiny returns nothing
-> Add the missiles that are in the source group into the destiny group
function GroupRemoveMissileGroup takes MissileGroup source, MissileGroup destiny returns nothing
-> Remove the missiles that are in the source group from the destiny group
function GroupEnumMissilesOfType takes MissileGroup missiles, integer whichType returns nothing
-> Enumerates the missiles of matching type
function GroupEnumMissilesOfTypeCounted takes MissileGroup missiles, integer whichType, integer amount returns nothing
-> Enumerates up to amount of missiles of matching type
function GroupEnumMissilesOfPlayer takes MissileGroup missiles, player p returns nothing
-> Enumerates the missiles that belongs to a player
function GroupEnumMissilesOfPlayerCounted takes MissileGroup missiles, player p, integer amount returns nothing
-> Enumerates up to amount of missiles that belongs to a player
function GroupEnumMissilesInRect takes MissileGroup missiles, rect r returns nothing
-> Enumerates the missiles inside a region
function GroupEnumMissilesInRectCounted takes MissileGroup missiles, rect r, integer amount returns nothing
-> Enumerates up to amount of missiles inside a region
function GroupEnumMissilesInRangeOfLoc takes MissileGroup missiles, location loc, real radius returns nothing
-> Enumerates the missiles within range of a location
function GroupEnumMissilesInRangeOfLocCounted takes MissileGroup missiles, location loc, real radius, integer amount returns nothing
-> Enumerates up to amount of missiles within range of a location
function GroupEnumMissilesInRange takes MissileGroup missiles, real x, real y, real radius returns nothing
-> Enumerates the missiles within range of x, y
function GroupEnumMissilesInRangeCounted takes MissileGroup missiles, real x, real y, real radius, integer amount returns nothing
-> Enumerates up to amount of missiles within range of x, y
BPower
Dirac
Vexorian
AGD
emjlr3
AceHart
Nestharus
Maghteridon96
Bribe
Flux
Forsakn
(v1.0)
Release
(v1.1)
Merged Normal and Relativistic code for both Legacy and Current versions.
You can use the SWEET_SPOT constant to determine the system behavior
SWEET_SPOT <= 0 -> normal method
SWEET_SPOT > 0 -> relativistic method
Included support for DummyRecycler by Flux for the Legacy version. This should improve its performance even further.
(v1.2)
Fixed a bug for homing missiles height
New configuration member boolean collideZ -> set to true to make the new missile consider z collisions
New Global Configuration constant boolean ROLL -> If true missile will consider roll in orientation. Roll can look really fishy for some users and was never possible until patch 1.31, so if you want it set it to true in the globlas block (1.31+ version only).
You can now attach effects to the main missile effect with an offset through 2 new methods (1.31+ version only)
// dx, dy, and dz are offsets from the main missile coordinates
method attach takes string model, real dx, real dy, real dz, real scale returns effect
WorldBounds now is required (Centralized requirements and outsourced)
New optional event (See Available Events for more info)
method onBoundaries takes nothing returns boolean
Fixed a spelling mistake on the detach functionality.
(v1.6)
MissileEffect library updated to use the BlzSetSpecialEffectOrientation native. (v1.31+ only)
(v1.7)
Standardized getting and setting of the members speed, arc and curve. They now read and write in degrees.
(v1.8)
Made a system function (GetLocZ) private to avoid conflict with other resources.
(v1.9)
System ported to LUA (Credits to Forsakn for the first port).
Added instant facing when creating missiles instances.
Included a version of Missiles that uses the dummy method and a Dummy Pool utilizing the new natives. This version by default will not let missiles clip through terrain.
Code formatting and cleaning.
(v2.0)
System ported to GUI!
Implemented ways to enumerate missiles (Missile Groups)
New method: pause. When called pauses or unpauses the missile
2 new events: onPause and onResume
3 new members: roll, type and paused
Added the attach and detach methods to the LUA version
Fixed a bug on the collideZ
Fixed a bug when deflecting missiles
Refactored code to be more readable and easy to maintain
(v2.1)
Removed the usage of a post 1.30 native being used in the 1.30 version of the system. Now the 1.30- version should work for patches below that
Fixed a bug in the LUA GUI version for the onPause and the onRemove events
Added an alternative method of setting up events for the GUI version. It's more compact, you can set up all events you want inside only 1 trigger (See the Trigger Preview for examples on how to do it)
(v2.2)
Adjusted the initial position of the missile in the versions that use the dummy method.
(v2.3)
2 new events:
onCliff -> Run whenever the missiles collides with a cliff wall and it's height is greater than the current missile height
onTileset -> Run whenever the missile changes terrain types
4 new members
nextX -> The next missile x value
nextY -> The next missile y value
nextZ -> The next missile z value
tileset -> the current terrain type under the missile
Fixed the missile movement on higher ground levels
Fixed the movement of missiles when going over terrain/cliffs for the dummy versions
Separated the GUI version into vJASS and LUA implementations. For those who want to choose between them.
(v2.4)
Missiles can now grant vision using the new member "vision"
vJASS:
// To set (The missile must have a source or a owner)
yourMissile.vision = value
// To get
var = yourMissile.vision
Lua:
-- To set (The missile must have a source or a owner)
yourMissile:vision(value)
-- To get
var = yoruMissile.Vision
Example
Actions
-- Set the MissileVision variable before running the MissileCreate trigger ou at any event trigger (The missile must have a source or a owner) --
Set VariableSet MissileSource = (Triggering unit)
Set VariableSet MissileVision = 800.00
Creates the missile
Trigger - Run MissileCreate <gen> (ignoring conditions)
New required library: Alloc
Fixed a few bugs in the GUI version
(v2.5)
Missiles can now be paused within the onFinish event.
Removed the deflectZ method, now the deflect method expects x, y and z parameters
New method deflectTarget deflects the missile to a unit
New GUI variable MissileData can be used to store information as needed (integer type)
version 1.31+ non dummy only changes:
4 new method operator (operators in vJASS, functions in Lua)
yourMissile.timeScale => changes the time scale of the effect model (animation speed)
yourMissile.alpha => changes the alpha value of the effect model (transparency)
yourMissile.playerColor => changes the player color of the effect model
yourMissile.animation => changes the animation type used by the effect model
1 new method
yourMissile.color(integer, integer, integer) => changes the effect model color (vJASS)
yourMissile:color(integer, integer, integer) => changes the effect model color (Lua)
vJASS:
// To set
yourMissile.timeScale = 3.
yourMissile.alpha = 128
yourMissile.playerColor = GetPlayerId(GetOwningPlayer(unit))
yourMisisle.animation = 3 // ConvertAnimType(3) under the hood
// To get
variable = yourMissile.timeScale
variable = yourMissile.alpha
variable = yourMissile.playerColor
variable = yourMisisle.animation
Lua:
-- To set
yourMissile:timeScale(3.)
yourMissile:alpha(128)
yourMissile:playerColor(GetPlayerId(GetOwningPlayer(unit)))
yourMisisle:animation(3) -- ConvertAnimType(3) under the hood
-- To get
variable = yourMissile.TimeScale
variable = yourMissile.Alpha
variable = yourMissile.playerColor
variable = yourMisisle.Animation
GUIExamle
Actions
Set VariableSet MissileAnimation = 5
Set VariableSet MissileTimeScale = 3.00
Set VariableSet MissilePlayerColor = 3
Set VariableSet MissileAlpha = 128
Trigger - Run MissileCreate <gen> (ignoring conditions)
-------- CHANGING THE COLOR. MUST BE DONE AFTER THE MISSILE IS CREATED (1.31+ NON DUMMY VERSION ONLY) --------
Set VariableSet MissileRed = 123
Set VariableSet MissileGreen = 67
Set VariableSet MissileBlue = 32
Trigger - Run MissileColor <gen> (ignoring conditions)
(v2.6)
Fixed a bug when pausing missiles inside an onFinish event.
(v2.7)
Minor improvements.
(v2.8)
Fixed a bug in the deflect method when the onTerrain event is declared.
Fixed a bug in the flushAll method in the LUA version.
Hi, I'm a beginner editor who is very much a fan of Spell Utilities you've created.
I encountered a problem while making a map, when I save and load the game, it crashes during loading. (There is no problem when I start playing games from the beginning.)
(I checked all triggers one at a time, and there was a crash during loading the saved files if there is the RelativisticMissileSystem-vJass)
I'm planning a custom campaigns, so save & load is a very important issue for me.
Did I install this utility incorrectly? Or does this missile system requires very high in computation?
Generally speaking, alot of stuff doesn't work for save and loading. Its better to use gamecache or a save and load system that does not rely on the wc3 native save and load system.
Does the MissileArc variable work in the Jass/GUI version?
I'm using the most up to date version of Wc3/this system and I can't seem to get MissileArc to have any effect on my homing missile. Perhaps I'm using it wrong?
Capture Start Casting
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Capture
Actions
Set VariableSet Mon_Trainer = (Triggering unit)
Set VariableSet Mon_Target = (Target unit of ability being cast)
-------- [Missile System] --------
-------- SETTING UP MEMBERS --------
Set VariableSet MissileStart = (Position of Mon_Trainer)
Set VariableSet MissileStartZ = 60.00
Set VariableSet MissileFinishZ = 60.00
Set VariableSet MissileModel = Abilities\Spells\Other\AcidBomb\BottleMissile.mdl
Set VariableSet MissileSpeed = 600.00
Set VariableSet MissileArc = 200.00
Set VariableSet MissileSource = Mon_Trainer
Set VariableSet MissileTarget = Mon_Target
Set VariableSet MissileOwner = (Owner of Mon_Trainer)
Set VariableSet MissileCollision = 75.00
-------- SETTING UP EVENTS --------
Set VariableSet Missile_onFinish = Capture Missile Impact <gen>
-------- LAUNCH THE MISSILE --------
Trigger - Run MissileCreate <gen> (ignoring conditions)
I've also experienced weird results where some Arc values worked when negative but not when positive and just overall weirdness.
Does the MissileArc variable work in the Jass/GUI version?
I'm using the most up to date version of Wc3/this system and I can't seem to get MissileArc to have any effect on my homing missile. Perhaps I'm using it wrong?
Capture Start Casting
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Capture
Actions
Set VariableSet Mon_Trainer = (Triggering unit)
Set VariableSet Mon_Target = (Target unit of ability being cast)
-------- [Missile System] --------
-------- SETTING UP MEMBERS --------
Set VariableSet MissileStart = (Position of Mon_Trainer)
Set VariableSet MissileStartZ = 60.00
Set VariableSet MissileFinishZ = 60.00
Set VariableSet MissileModel = Abilities\Spells\Other\AcidBomb\BottleMissile.mdl
Set VariableSet MissileSpeed = 600.00
Set VariableSet MissileArc = 200.00
Set VariableSet MissileSource = Mon_Trainer
Set VariableSet MissileTarget = Mon_Target
Set VariableSet MissileOwner = (Owner of Mon_Trainer)
Set VariableSet MissileCollision = 75.00
-------- SETTING UP EVENTS --------
Set VariableSet Missile_onFinish = Capture Missile Impact <gen>
-------- LAUNCH THE MISSILE --------
Trigger - Run MissileCreate <gen> (ignoring conditions)
I've also experienced weird results where some Arc values worked when negative but not when positive and just overall weirdness.
Arc is calculated using the TANGENT function, so values should always stay between -90 and 90 degrees (remember that tangent of 90 and -90 is infinite). A positive value is an upward arc and a negative value is a downward arc (towards the ground). When using a negative value and using the dummy version (units as missiles) the missile will not go underground since units cant go underground as far as I remember.
Below is the formula used for arc:
vJASS:
method operator arc= takes real value returns nothing
set height = Tan(value*bj_DEGTORAD)*origin.distance/4
endmethod
when you pass 90 the missile will shoot up and never go down (because of the infinite tangent i mentioned). You dont need to pass the Tan() value, the system already does it. You need to find a value between 0 and 90 that suits want you want (if you want an upward arc). Try a value like 50 for example (50 degress). If you want you can share your map so i can take a look, or the entire triggers involved
when you pass 90 the missile will shoot up and never go down (because of the infinite tangent i mentioned). You dont need to pass the Tan() value, the system already does it. You need to find a value between 0 and 90 that suits want you want (if you want an upward arc). Try a value like 50 for example (50 degress). If you want you can share your map so i can take a look, or the entire triggers involved
It worked normally to me! I just increased the arc from 50 to 70 just so it would be a bit more accentuated for the video but it worked flawlessly without changing anything.
It worked normally to me! I just increased the arc from 50 to 70 just so it would be a bit more accentuated for the video but it worked flawlessly without changing anything.
Yep, just like 2 days ago I was having an issue with indexing a nil value in Lua, turns out the error was right in front of me
Definetely lost some brain cells that day.
For a projectile i use missile that leaves splat in point of impact. And also it has an arc, so when it hit the ground it has some degree of pitch, and its splat too.
How to make this missile not to leave splat after it hit the ground. Edit projectile is not the solution, as i use it in other cases, where i need its splat. Make two separate models doesnt fit too, because i have a lot of this models for different scenarios and multiplying them by two is undesirable outcome.
On hit event i tried the following:
I tried to set alpha to 0, it hides the missile, but no the splat
Set model to empty string or something else - didnt help
Set MissleZ and MissleArc to 0 - didnt help either.
Changing MissilePosition to another location changed nothing.
Is there the way to manually change model of missile before its destroyed or set it Z axis and pitch, to make it in line with ground so the splat will look normally?
For a projectile i use missile that leaves splat in point of impact. And also it has an arc, so when it hit the ground it has some degree of pitch, and its splat too.
How to make this missile not to leave splat after it hit the ground. Edit projectile is not the solution, as i use it in other cases, where i need its splat. Make two separate models doesnt fit too, because i have a lot of this models for different scenarios and multiplying them by two is undesirable outcome.
On hit event i tried the following:
I tried to set alpha to 0, it hides the missile, but no the splat
Set model to empty string or something else - didnt help
Set MissleZ and MissleArc to 0 - didnt help either.
Changing MissilePosition to another location changed nothing.
Is there the way to manually change model of missile before its destroyed or set it Z axis and pitch, to make it in line with ground so the splat will look normally?
Thank you for rapid response! But the problem is how to refer to the missile in example provided by you missile variable is clearly is effect. Maybe its just legacy version im using or something, but in my case Missle is an integer variable. And i cant find the way how to refer to current effect which used by exact missile in actual event. If i knew it would make things easier. So if you know how to do it please, tell me.
Thank you for rapid response! But the problem is how to refer to the missile in example provided by you missile variable is clearly is effect. Maybe its just legacy version im using or something, but in my case Missle is an integer variable. And i cant find the way how to refer to current effect which used by exact missile in actual event. If i knew it would make things easier. So if you know how to do it please, tell me.
The Missile is either a Unit or a Special Effect variable depending on which version you use. I can't remember the variable names but it should be easy to find, just look through the variable editor for variables of those types.
Version 1.31+ of the system uses Special Effects while the legacy version uses Dummy units. This is because the functions to modify a Special Effect's position weren't available in older versions.
The Missile is either a Unit or a Special Effect variable depending on which version you use. I can't remember the variable names but it should be easy to find, just look through the variable editor for variables of those types.
Version 1.31+ of the system uses Special Effects while the legacy version uses Dummy units. This is because the functions to modify a Special Effect's position weren't available in older versions.
Well. I use legacy version, but that one already using special effect one, which will be for 1.31 and beyond. I just searched trought all variables, and only one which is effect is "MissileDetachEffect". If it must be on surface, maybe im looking in wrong direction?
Well. I use legacy version, but that one already using special effect one, which will be for 1.31 and beyond. I just searched trought all variables, and only one which is effect is "MissileDetachEffect". If it must be on surface, maybe im looking in wrong direction?
I assure you legacy version that im using possesses both 1.30 and 1.31+ missle systems, and as i can tell 1.31+, which i use, is built on new natives, which uses special effect instead of dummy.
As i remember, version that i had, can be opened only in Reforged editor and already possesses some natives, which wont work on 1.31, which i didabled, but what i can see in description, natives which can interact with effect already present 1.31, so effect based system can work here. I also cheked the code, and it seems it moves and orient special effect rather than unit. Even if it suddenly unit version too, i couldnt find any unit variable that can refer to missile either. The only unit variables is MissileUnitFlush and MissileUnitHit, which refers on units collided with missile.
Im sorry, i dont want to become annoying, but in example you provided me you refer to effect of the missile, which is stored in missile variable. So in your example missile is effect. In my case missile is an integer variable. I simply cant increase height of integer. I want to know hows that. Besides that I cant find any other variable which i can adress to, except DetachEffect, which obviously not belong to missile as entity.
I searched trought methods and didnt find any built in solution to manipulate missile that way.
And both version that i downloaded backthan legacy and actual to that date i have missile variable present as integer. Im using GUI JASS versions. If for some reason you are using the same, but you have missile as effect variable, without any custom modification of the system. I cant tell whats going on.
Im sorry, i dont want to become annoying, but in example you provided me you refer to effect of the missile, which is stored in missile variable. So in your example missile is effect. In my case missile is an integer variable. I simply cant increase height of integer. I want to know hows that. Besides that I cant find any other variable which i can adress to, except DetachEffect, which obviously not belong to missile as entity.
I searched trought methods and didnt find any built in solution to manipulate missile that way.
And both version that i downloaded backthan legacy and actual to that date i have missile variable present as integer. Im using GUI JASS versions. If for some reason you are using the same, but you have missile as effect variable, without any custom modification of the system. I cant tell whats going on.
Sorry, I remembered being able to easily manipulate the Special Effect last time I used this system but now that I look at the map it seems like I was wrong. I did however figure out a way to do what I originally suggested, although I imagine Chopinski will have a better solution.
For now you can try this:
In the Patch 1.31+ folder, which I believe you're using, click the Missiles trigger and add the following code to the very bottom, right above the line that says "endlibrary":
vJASS:
// UNCLE
function MissileGetSfx takes nothing returns nothing
local Missiles missile = udg_Missile
set udg_MissileSfx = missile.effect.effect
endfunction
Also, make sure to create a new Special Effect variable called MissileSfx in the Variable Editor.
Then to use the new Special Effect variable you can do this:
Q onHit
Events
Conditions
MissileHitUnit Not equal to MissileSource
(MissileHitUnit is alive) Equal to True
Actions
Game - Display to (All players) the text: ((onHit( + ((String(Missile)) + ): )) + (Name of MissileHitUnit))
Unit - Kill MissileHitUnit
Custom script: call MissileGetSfx()
Special Effect - Set Height of MissileSfx to: 0.00
This is the Q onHit trigger from the This Map Only folder provided in the demo map.
I added the last two Actions. The Custom Script calls the function we just added to the Missiles code and the second Action adjusts the Height of the MissileSfx. You can do anything you want to MissileSfx after calling MissileGetSfx(). Just remember that this could easily cause problems for the missile afterwards since you'll be interfering with the system.
Sorry, I remembered being able to easily manipulate the Special Effect last time I used this system but now that I look at the map it seems like I was wrong. I did however figure out a way to do what I originally suggested, although I imagine Chopinski will have a better solution.
For now you can try this:
In the Patch 1.31+ folder, which I believe you're using, click the Missiles trigger and add the following code to the very bottom, right above the line that says "endlibrary":
vJASS:
// UNCLE
function MissileGetSfx takes nothing returns nothing
local Missiles missile = udg_Missile
set udg_MissileSfx = missile.effect.effect
endfunction
Also, make sure to create a new Special Effect variable called MissileSfx in the Variable Editor.
Then to use the new Special Effect variable you can do this:
Q onHit
Events
Conditions
MissileHitUnit Not equal to MissileSource
(MissileHitUnit is alive) Equal to True
Actions
Game - Display to (All players) the text: ((onHit( + ((String(Missile)) + ): )) + (Name of MissileHitUnit))
Unit - Kill MissileHitUnit
Custom script: call MissileGetSfx()
Special Effect - Set Height of MissileSfx to: 0.00
This is the Q onHit trigger from the This Map Only folder provided in the demo map.
I added the last two Actions. The Custom Script calls the function we just added to the Missiles code and the second Action adjusts the Height of the MissileSfx. You can do anything you want to MissileSfx after calling MissileGetSfx(). Just remember that this could easily cause problems for the missile afterwards since you'll be interfering with the system.
I already thought to add function which will be able to select sfx for manipulations. But it doesnt make your help mean less to me, because it would take a considerable amount of time to inspect the whole system to figure out how to do this, what element i need to get and in the same not jeopardize the whole system.
Your method is working, now i have more control over missile and there no need need to hide it, changing height. I can just change its Z axis and roll/pitch, to make it appear as it fell flat on the ground. Your help is invaluable for me.
Hi @chopinski , I've seen that the Lua version of TimedHandles is incorrectly labeled as "Timed". This causes a naming conflict with the Lua library "Timed". Please change the name back to TimedHandles to correct this issue.
It seems that system doesn't take into account Z axis, when checking finish condition. For example if i set start point equal to finish point, missile will be destroyed as soon as it appeared, no matter if finish Z = 0 and start Z = 1000. What should i do to imitate spells like starfall when missile decent on right from above with angle equal 90?
Thank you!
P.S:Spell suppose to be non target, so i cant set target for it in Missile configuration as solution.
set missile.source = u
set missile.model = "BladeBeamFinalLarger.mdx"
set missile.speed = 1500
set missile.damage = 100
set missile.collision = 250
set missile.owner = GetOwningPlayer(u)
set missile.scale = 2
call missile.color(255, 0, 75)
How do I check all possible "arguments" you can do? For example, how do I change pitch, yaw, roll? is it "set missile.roll = var"?
set missile.source = u
set missile.model = "BladeBeamFinalLarger.mdx"
set missile.speed = 1500
set missile.damage = 100
set missile.collision = 250
set missile.owner = GetOwningPlayer(u)
set missile.scale = 2
call missile.color(255, 0, 75)
How do I check all possible "arguments" you can do? For example, how do I change pitch, yaw, roll? is it "set missile.roll = var"?
scope RetsuSlash
private struct Slash extends Missiles
method onHit takes unit hit returns boolean
if IsUnitEnemy(hit, owner) then
call UnitDamageTarget(source, hit, damage, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null)
endif
return false
endmethod
endstruct
private struct RetsuSlash
static timer time = CreateTimer()
static unit u
static method onCast takes nothing returns nothing
local unit u = GetTriggerUnit()
local real tx = NewX(GetUnitX(u), 1500, AngleBetweenUXY(u, GetSpellTargetX(), GetSpellTargetY()))
local real ty = NewY(GetUnitY(u), 1500, AngleBetweenUXY(u, GetSpellTargetX(), GetSpellTargetY()))
local real tz = 200
local real x = NewX(GetUnitX(u), 150, AngleBetweenUXY(u, GetSpellTargetX(), GetSpellTargetY()))
local real y = NewY(GetUnitY(u), 150, AngleBetweenUXY(u, GetSpellTargetX(), GetSpellTargetY()))
local real z = 200
local Slash missile = Slash.create(x, y, z, tx, ty, tz)
set missile.source = u
set missile.model = "BladeBeamFinalLarger.mdx"
set missile.speed = 1500
set missile.damage = 100
set missile.collision = 250
set missile.owner = GetOwningPlayer(u)
set missile.scale = 2
//set missile.roll = GetRandomReal(1, 180)
//set missile.MissileEffect.roll = 75
//set missile.effect.roll = 75
call missile.color(255, 0, 75)
call missile.launch()
endmethod
static method onInit takes nothing returns nothing
call RegisterSpellEffectEvent('A002', function thistype.onCast)
call Cheat("iseedeadpeople")
endmethod
endstruct
endscope
The commented out part is approaches I've tried, there some other things I tried too but I'm not sure what I'm doing wrong
I believe you have to set the roll during the periodic method because the missile system itself will constantly change this value as it moves toward its destination.
I believe you have to set the roll during the periodic method because the missile system itself will constantly change this value as it moves toward its destination.
Are you sure? I thought Yaw, Pitch and Roll was just values you could change on setup like missile speed or damage or collision radius, and it'll remain that way throughout traversion
Are you sure? I thought Yaw, Pitch and Roll was just values you could change on setup like missile speed or damage or collision radius, and it'll remain that way throughout traversion
Missile systems use physics to calculate those dynamically, so if you want to make adjustments you would need to set them dynamically yourself. I'm not sure if this system supports a static yaw/pitch/roll, but if it does, then you can tell Missile to not update them on every tick using that method.
Missile systems use physics to calculate those dynamically, so if you want to make adjustments you would need to set them dynamically yourself. I'm not sure if this system supports a static yaw/pitch/roll, but if it does, then you can tell Missile to not update them on every tick using that method.
Remember, these orientation values use radians, so feeding a large value like you are in your example is probably going to produce weird results.
What others have said about needing to constantly update orientation is true since changing a Special Effect's position resets the orientation - at least this was the case last I tried. So you would need to update the orientation values inside of the periodic callback. This is all assuming that the system doesn't do things differently.
Next time you need to be more specific and provide the specific error.
In the trigger editor go to the top menu bar and select JASSHelper > Enable vJASS. This setting needs to be manually enabled on each map because Blizzard is dumb as fuck.
How do you customise the 'attach' feature? I want to add an elemental effect to an arrow projectile but it's too far back, so I've been trying to move it forward but I've not been able to thus far. I assumed it would be similar to the way the projectile launch coordinates are set up in the OE, but I'm getting very confusing results.
In reality the installation is not as simple as the later versions have implemented features that require more and more supportive systems: MapBounds, SpellEffectEvent. Also, you should add a note that the system won't work with Total Initialization (Bribe) by default and the onInit needs to be modified slightly.
How do you customise the 'attach' feature? I want to add an elemental effect to an arrow projectile but it's too far back, so I've been trying to move it forward but I've not been able to thus far. I assumed it would be similar to the way the projectile launch coordinates are set up in the OE, but I'm getting very confusing results.
unless someone is genius enough to math-ify the expected concept and update the system for it. (which i think is way more better than the way how it's implemented right now honestly)
by checking the relevant code, the offsets here weren't made to consider the missile's orientation axis therefore it's only following the map axis in relative to the missile's position so unfortunately it's not possible to do it yet but it's almostly possible for sure with some workarounds to achieve it afaik, i also myself not confident with the math problem-solving things which is kinda sucks i only know few of it...
Lua:
-- MissileEffect script
function mt:move(x, y, z)
if not (x > WorldBounds.maxX or x < WorldBounds.minX or y > WorldBounds.maxY or y < WorldBounds.minY) then
BlzSetSpecialEffectPosition(self.effect, x, y, z)
for i = 1, #self.array do
local this = self.array[i]
-- here's where the attachment offsets take place for your reference
BlzSetSpecialEffectPosition(this.effect, x - this.x, y - this.y, z - this.z) -- should even be + not -
end
return true
end
return false
end
edit 1:
here's some painted illustration from what i meant and for you to see how they currently work vs from the concept we're expecting
Lua:
local effect = missile:attach("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", 250, 0, 0, 2) -- 2 is only for attached effect scaling
although there are numerous ways we can still achieve the concept you want without the mind of geniuses and rewriting part of the system but do note the downsides ofc. you may create another missile instance with the offset you like and have its index remembered by the main missile for terminating purposes and such but an overhead solution. another workaround is if you only wanted to make the attached effect do forwards and backwards in respective to missile facing axis then we can use polar coordinates instead (a 2D so it may look wonky with arcs and curves which is designed for 3D). lastly, model editor...
surprisingly, i also requested it to AGD a long time ago and probably the best addition to his SpecialEffect library.. we call the concept a SatelliteEffect but the progress is discontinued at some point (however i still have the prototype version of it just in case someone wanted to take a look at the math algorithm made on it)
i know it's very late to response since i just got by in this resource suddenly and rather than calling that a bug i would call it quiet normal at least in my own perspective because it's how the things operate within the system it's just looping through the group of indexed missiles individually not simultaneously just like if we'll order both units to cast suicide from each other at the same time one may always survive depending on how they're both checked in the system. looking through the relevant code: (i commented some of the lines to illustrate how it currently works and some solution to the problem)
Lua:
-- Missiles script
function mt:OnMissile()
if self.onMissile then
if self.allocated and self.collision > 0 then
for i = 0, Missiles.count do -- looping through missile indexes 1 by 1
local missile = Missiles.collection[i]
if missile ~= self then
if array[self][missile] == nil then
local dx = missile.x - self.x
local dy = missile.y - self.y
if SquareRoot(dx*dx + dy*dy) <= self.collision then -- missile indexes collision detector
array[self][missile] = true -- means this missile index already collided with another missile index
if self.allocated and self.onMissile(missile) then -- returning true will terminate this missile index already
self:terminate() -- missile index already terminating
-- the line below is additional check which can be added here as user-defined implementation only to solve the problem you're having with both missiles returning true in onMissile collision.
if missile.onMissile(self) then missile:terminate() end
break -- the next missile index wouldn't even detect the collision with this missile index because it's already terminated and the loop breaks eventually to stop its operation.
-- the another missile index will survive because this missile index is already gone in the next operation
end
end
end
end
end
end
end
end
result:
edit 3:
@chopinski just in case you'll update the resource in the future i've already fixed some of the issues with your system on my copy somehow and i still want you to be aware of the findings. (will just post it here from time to time since i only have a bit of a spare time for modding although i'm already starting to get along with your resources since they're gloriously luafied and looking forward to use it with my resources sooner or later)
Lua:
-- Missiles T script
do
onInit(function()
RegisterSpellEffectEvent(FourCC('A006'), function()
local group = CreateMissileGroup()
GroupEnumMissilesInRange(group, Spell.x, Spell.y, 350)
for i = 0, MissileGroupGetSize(group) - 1 do
local missile = GroupMissileAt(group, i)
missile:attach("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl", 0, 0, 0, 1)
--^ will spawn at the center of the map instead at the center of the missile when pausing
if missile.paused then
missile:pause(false)
else
missile:pause(true)
end
end
DestroyMissileGroup(group)
end)
end)
end
should work like:
Lua:
function mt:attach(model, dx, dy, dz, scale)
local this = {}
this.x = dx
this.y = dy
this.z = dz
this.yaw = 0
this.pitch = 0
this.roll = 0
this.path = model
this.size = scale
this.effect = AddSpecialEffect(model, dx, dy)
BlzSetSpecialEffectZ(this.effect, dz)
BlzSetSpecialEffectScale(this.effect, scale)
-- changed the following line from: BlzSetSpecialEffectPosition(this.effect, BlzGetLocalSpecialEffectX(this.effect) - dx, BlzGetLocalSpecialEffectY(this.effect) - dy, BlzGetLocalSpecialEffectZ(this.effect) - dz)
-- into:
BlzSetSpecialEffectPosition(this.effect, BlzGetLocalSpecialEffectX(self.effect) + dx, BlzGetLocalSpecialEffectY(self.effect) + dy, BlzGetLocalSpecialEffectZ(self.effect) + dz)
-- added the following line:
BlzSetSpecialEffectOrientation(this.effect, self.yaw, self.pitch, self.roll)
table.insert(self.array, this)
return this.effect
end
Thank you for the response. I think I might end up just substituting the projectile for a custom one instead of trying to make this particular feature work.
Are you sure? I thought Yaw, Pitch and Roll was just values you could change on setup like missile speed or damage or collision radius, and it'll remain that way throughout traversion
uh... to answer your question just in case it still remains unsolved(though it may also help anyone facing the same)..the bad news is that the current setup of this system does not support user changes in yaw,pitch,roll because their values are always being overwritten internally and fixed already after your own orientation process finishes and before the system orientation process begins --- not the other way around. (except for the roll boolean part which we can read/write from the API) (however, for the yaw and pitch they're just readonly and probably the author just forgot to include them in the documentation) so doing something with them will just be replaceable by the system's hardcoded orientation techniques which is really not possible to do so in the current state.
the good news is i can implement the feature by rewriting some parts of the script without breaking the system overall just in case you still ask about it. (basically, just gonna add 3 variables and call them makeYaw,makePitch,makeRoll for the sake of a new system feature) ^^
I'm trying to create a fancy bouncing system with relativistic missiles using the algorithm described here About angles and reflection but I have 2 problems. The first problem is that the onDestructable method fails if I don't hit the center of the demon gates in my test map, the 2nd and more pressing problem is that since the post didn't fully explain it I'm not sure what last part of the calculation should be or if my math is even right up until that point. Attached is my test map.
May anyone help 1.26 users? From what I got, this system has 1.26 compatible version. I'd like to open this in reforged and copy the code itself, but since refroged worledit is hardcoded into pc, once you started reforged WE, you can't just open 1.26 editor after that, it starts crashing.
May anyone help 1.26 users? From what I got, this system has 1.26 compatible version. I'd like to open this in reforged and copy the code itself, but since refroged worledit is hardcoded into pc, once you started reforged WE, you can't just open 1.26 editor after that, it starts crashing.
This is a simple utility bat file that cleans up the editor registry so user can open their old editors after accidentally uses the newer ones. Most notable when switching from 1.32 to 1.31, or 1.32 to pre-1.31, or 1.31 to pre-1.31. The bat file can be inspected if people care about potential...
www.hiveworkshop.com
Anyways, for 1.26 users, it should be possible to use it in "unit mode" (projectiles are units), but I've never tried it.
FYI: You can "Preview Triggers" from the maps here on Hive webpage to check triggers out and for example copy paste code.
You probably need unit ids for properly setup dummy unit etc.
This is a simple utility bat file that cleans up the editor registry so user can open their old editors after accidentally uses the newer ones. Most notable when switching from 1.32 to 1.31, or 1.32 to pre-1.31, or 1.31 to pre-1.31. The bat file can be inspected if people care about potential...
www.hiveworkshop.com
Anyways, for 1.26 users, it should be possible to use it in "unit mode" (projectiles are units), but I've never tried it.
FYI: You can "Preview Triggers" from the maps here on Hive webpage to check triggers out and for example copy paste code.
You probably need unit ids for properly setup dummy unit etc.
Thank you. I copied everything that is said (world bounds, timerutils) and missiles trigger itself.
Trying to make it work, but Jass Helper keep giving me errors for now, aligning not the system itself, but the globals declaration in the map initialization that worked fine for me.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.