• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] /[vJass] Need help on something!

Status
Not open for further replies.
Level 18
Joined
Oct 18, 2007
Messages
930
Need help on something!

Ok im working on my new spells for my new spellpack, but i got a prob here.

The missile changes height from one unit to another, but it does not change it's height on the way back.

Link to code and to map download: The Hive Workshop - A Warcraft III Modding Site

Please if you find something that could be done to fix this Height problem then please post.

Regards, Dynasti

PS: The spell is not completely done, it needs some flawing and documentation but i think it is readable

JASS:
        unit u // Unit User ( The Caster )
        unit t // Unit Target ( The target that the missile will follow )
        unit m // Unit Missile
        group g=CreateGroup() // Group used for not bouncing on the same unit twice
        player p // Player p
        integer l // Integer Level
        
        real z // Real Z, keeps track of the Height (Does not go lower than the missiles height )
        real s=0 // Real Stolen, the amount of life the missile has stolen
        integer c=0 // Integer Count, used to keep track on how many bounces the missile has done
        integer mc // Integer Max Count used to keep track on the max bounces
        effect e // Effect used to set the look on the missile
        
        boolean ToPlayer=false // If set to true when the ball reaches it's target then the ball's motion will end
            
        static integer array Index // An integer array that is used for the indexing system
        static integer Total=0 // An integer wich keeps track of how many missiles there is in use
        static timer Tim=CreateTimer() // Timer used in the interval
        static real nX=0 // A Temp real used for getting the missile's X
        static real nY=0 // A Temp real used for getting the missile's Y
        static real nX2=0 // A Temp real used for getting the target's X
        static real nY2=0 // A Temp real used for getting the target's Y
        static real nA=0 // A Temp real used for getting the angle
        static real nH=0 // A Temp real used for getting the height
 
Last edited:
Level 9
Joined
Apr 5, 2008
Messages
529
good

Edit:

Ok i have found out that the
JASS:
 if tmpR != dat.z
does not work, so i removed it.

Another thing is that it does not work on the way back for some reason -_-

heh, yeah, I also just discovered that the NewHeight method is called everytime the missile changes target. =P
However, I still don't know exactly why it doesn't work with the caster but with all the other creeps.

Edit:

Bug found! I think... Will check now. ;P
 
Level 18
Joined
Oct 18, 2007
Messages
930
heh, yeah, I also just discovered that the NewHeight method is called everytime the missile changes target. =P
However, I still don't know exactly why it doesn't work with the caster but with all the other creeps.

Edit:

Bug found! I think... Will check now. ;P

^^ I know the New Height is runned evry time. It changes the height with a calculation between points. Somehow the points arent changed :S

Edit: Updating the map, fixed some minior things
 
Level 14
Joined
Nov 18, 2007
Messages
816
JASS:
call SetUnitFlyHeight(.m, h + M_HEIGHT, (h-GetUnitFlyHeight(.m)+(2*M_HEIGHT))/((SquareRoot((.nX2-.nX)*(.nX2-.nX)+(.nY2-.nY)*(.nY2-.nY))*M_TICK)/M_SPEED))
that should be mathematically correct.

oh, maybe you should add set tmpI=0 somewhere before you switch structs in your loop. Forget about that.

Do you filter out Dat.m as a valid new target?
 
Level 18
Joined
Oct 18, 2007
Messages
930
JASS:
call SetUnitFlyHeight(.m, h + M_HEIGHT, (h-GetUnitFlyHeight(.m)+(2*M_HEIGHT))/((SquareRoot((.nX2-.nX)*(.nX2-.nX)+(.nY2-.nY)*(.nY2-.nY))*M_TICK)/M_SPEED))
that should be mathematically correct.

oh, maybe you should add set tmpI=0 somewhere before you switch structs in your loop.

i do, if tmpI is greater than 0 then
[...]
set tmpI = 0
 
Level 18
Joined
Oct 18, 2007
Messages
930
Do you filter out dat.m as a valid new target?

dat.m is the missile. The filter filters out enemy non structure enemies

If there is no units in range or it has bounced the max amount of times then the target will be changed to the caster and a boolean called ToPlayer will be set to true. On impact it checks if it is false then it loop if it is true then the spell ends.
 
Level 18
Joined
Oct 18, 2007
Messages
930
I think I got it.
When the caster is set as the target, do you update the target coordinates to the values of the caster instead of the previous target?
I don't have the code here, so I can't check. =P

k checking

Edit: Yes i do
JASS:
        method BackToPlayer takes nothing returns nothing
            set .t = .u
            set .ToPlayer = true
            set .nX2=GetUnitX(.t)
            set .nY2=GetUnitY(.t)
        endmethod
 
Level 18
Joined
Oct 18, 2007
Messages
930
yes he does.
EDIT: okay, dat.m should be a valid target, if i am not mistaken. Just add it to .g when you spawn the missile. Tell me, if that fixed your problem (probably not, but w/e).

k testing, but dont think it will make any difference. Because the filter filters out enemies not in the group

Edit: Not working

Dont think it has something to do with the filter, more in the function.. but what?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
It is good to null struct handle components to allow eariler handle index recycling. They technically do not leak however but they may use more memory than usual if you do not so it is still recommendable to null them.

struct integer, string, real and boolean components do not need to be set to anything as they do not leak (stings do but that is a WC3 problem).
 

Attachments

  • New Spell.w3x
    50.7 KB · Views: 29
Last edited:
Status
Not open for further replies.
Top