Snippet Slide

Trollvottel

never aging title
Reaction score
262
no, i dont see. but next time you use variables make them more descriptive than A, T, etc....

good job on the system
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
It was either A or acceleration and accereleration was too long for me to write out each time.
Plus, at the top it explains that. =D
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
The naming of your functions is a bit off, too,... laconic.

May I suggest something like "UnitMakeUnitSlide" or "UnitApplySlide", a more descriptive approach.


Also, this is just a question of preference, but the parameter intake list a bit weird.

"function UnitMakeUnitSlide takes unit whichUnit, real displacement, real vel, real time, real angle, returns nothing"


Also, I would like to see the parameter "displacement" removed and the parameter "speed",
the speed in Warcraft units (pixels per second), added instead.

Why?

It makes the usage of this snippet easier, as it's easier for the user to input the speed he wants the unit to slide,
instead the displacement per timer interval.

How to determine the value one should move the unit, if the speed and the timer interval is given?

displacement = speed / (1 / interval)

Yes, you need the parenthesis.


Lastly, it would be more better if you was to use some kind of more common attaching system.

Yes, a system for a snippet would be a bit much, but you could improve your efficiency,
as in it would enable you to remove the looping and usage of struct array.


P.S

- if (something) then
- else
(do nothing)
- then

If you do nothing after the "else", you can simply remove the "else" part.
 

Flare

Stops copies me!
Reaction score
662
Also, I would like to see the parameter "displacement" removed and the parameter "speed",
the speed in Warcraft units (pixels per second), added instead.

IIRC, displacement = distance so replacing it with speed would confuse things. Anyway, isn't vel the initial speed argument?

Lastly, it would be more better if you was to use some kind of more common attaching system.

Yes, a system for a snippet would be a bit much, but you could improve your efficiency,
as in it would enable you to remove the looping and usage of struct array.

Wouldn't that (1) require a timer per instance and (2) slow down the code, thus making it less efficient?
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
I think you mis-understood the system Andrew.
As flare said, displacement is distance from the start point so speed wouldn't make sense.

Also, the displacement is the TOTAL distance traveled and the time is the TOTAL time to complete this.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
It would just be more convenient to specify the distance and speed, rather distance and time.

Though, you can create two or more functions and really turn it into a system.


Yes, sorry, I looked the displacement was the distance it would move the unit per timer interval.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
I will be releasing the full system soon, this is just a snippet of the system to check that the coding was okay and everything! :)

The full system has 10 functions which can be used. Hopefully people might find it useful!

I will look into making the names more descriptive.
Any comments on the code?

Also, I would use attachments instead but I don't want this system to require other systems if that is possible! :)
 

Flare

Stops copies me!
Reaction score
662
10 functions?!?!? Why the **** would you need 10 functions for sliding? I can see 3 at best (decelerating, accelerating, and neither) going by what you have there. And you honestly wouldn't need much more than that... unless you plan to make a physics system ^^

EDIT: Just looked at the intended functions and...
Code:
//          call Slide_SUV(Displacement, Initial_Velocity, Final_Velocity, whatAngle, whichUnit)  
Probably usable - Would be good for normal slides, like charges and that
                                      
//          call Slide_SUA(Displacement, Initial_Velocity, Acceleration, whatAngle, whichUnit)  
Probably usable, same as above
                                        
//          call Slide_SUT(Displacement, Initial_Velocity, Time, whatAngle, whichUnit)    
Possibly usable, can't think of a use right now
                                              
//          call Slide_SVA(Displacement, Final_Velocity, Acceleration, whatAngle, whichUnit)   
//Same as #1 and #2
                                         
//          call Slide_SVT(Displacement, Final_Velocity, Time, whatAngle, whichUnit)      
Same as #1, #2 and #4
                                              
//          call Slide_SAT(Displacement, Acceleration, Time, whatAngle, whichUnit)   
Possibly usable, can't think of a use right now
                                                   
//          call Slide_UVA(Initial_Velocity, Final_Velocity, Acceleration, whatAngle, whichUnit)   
Can't see why you would need something like this. #2 would have a similar effect
                                     
//          call Slide_UVT(Initial_Velocity, Final_Velocity, Time, whatAngle, whichUnit)  
Same as above, can't really see a use for going from X to Y over Z seconds
                                              
//          call Slide_UAT(Initial_Veloity, Acceleration, Time, whatAngle, whichUnit)  
Same as above
                                                 
//          call Slide_VAT(Final_Velocity, Acceleration, Time, whatAngle, whichUnit) 
Possibly usable, but I've rarely seen situations where you need to go from 0 to X over Y seconds

But that's just what I think based on various maps I've played (and my expectations of what the function is gonna do). And if you do keep all 10 functions, you're gonna have a hell of a time giving them half-decent names
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
I don't know what I have made.
All I know is it works exactly how I planned.
I have to admit, one of the functions is completly pointless.
I have one where you specify starting and finishing speed and acceleration.
Then it calculates a time and a distance.
The functions where you don't put in a distance are quite dodgy, often the unit either barely moves, or goes flying of the map! xD
haha
Oh well, you will soon see.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
No, the maths behind it is perfect.
It's just you can't really bash random numbers into it and expect it to stay on the screen.
Whereas if you specify the distance, then you know where it will end up.
 

Flare

Stops copies me!
Reaction score
662
No, the maths behind it is perfect.
It's just you can't really bash random numbers into it and expect it to stay on the screen.
Whereas if you specify the distance, then you know where it will end up.

Well then, if a situation like that is possible, then it's not the best idea to keep the feature (since you know someone's gonna end up doing something stupid, and sending their units into the black boundary :p)
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
Yea. It seems a few of the functions are unstable. Mainly the ones where you don't control distance or time.
I will add some safeguards in, and make sure that it is noted that some of the functions are harder to use.
So basically, it will be just 4 functions now =[
Oh well.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
Hmmm, well some of the functions are too unstable. So some will be removed. But I think I will release this as a system. Especially as I saw someone earlier trying to implement this into their code. So a stand alone trigger (system) would be much easier to use.

Could a moderator please close this thread.

Thanks for the feedback guys, and especially Flare... who I still can't plus rep... =S
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
Because the feedback has been tweaks to the code. Now it's hopefully fine, so I figured that I should restart a thread. With feedback, and any new code errors.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top