(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Resources > JASS Functions

JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum.

Reply
 
LinkBack Thread Tools Display Modes
Old 02-10-2008, 08:53 AM   #31 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


We can make 5 000 000 of those, but it's ok, I guess.

Better to make stuff like:

function CreateUnitForPlayer takes player owner, integer unitID, real x, real y, real facing, player whichPlayer returns unit
    local integer i
        if GetLocalPlayer() == whichPlayer then
            set i = unitID
        endif
    return CreateUnit(owner, i, x, y, facing)
endfunction


I don't know how this function works exactly, I don't understand how can you create a unit that exists only for one player, but I've seen it on TheHelper.

Or maybe:

function AddSpecialEffectForPlayer takes string path, real x, real y, player whichPlayer returns effect
    local string s
        if GetLocalPlayer() == whichPlayer then
            set s = path
        endif
    return AddSpecialEffect(s, x, y)
endfunction
Silvenon is offline   Reply With Quote
Old 02-10-2008, 05:30 PM   #32 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

CreateUnitForPlayer will desynch. (Not necessarily upon call, but when the unit deals or receives damage, for example)
PurplePoot is offline   Reply With Quote
Old 02-11-2008, 06:04 AM   #33 (permalink)
 
PurgeandFire111's Avatar

User Title
 
Join Date: Nov 2006
Posts: 1,029

PurgeandFire111 is a jewel in the rough (155)


Lol... I didn't see Disciple's Post... He already posted a GetNearestUnit xP
__________________
Vote For The Hive Workshop!
Funny but the TRUTH! :
Quote:
Originally Posted by Sopho
Unprotecting maps is not right its like crime and YOU GO MAKE YOUR OWN MAP AND BE HAPPY! Don't be gay n00b!

1. You can if it is yours but you should not if it is not. It is like stealing information and using it as if it is your own. It si gay stuff and people who unprotect maps are gay themselves.
PurgeandFire111 is offline   Reply With Quote
Old 02-11-2008, 10:45 AM   #34 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


Quote:
CreateUnitForPlayer will desynch. (Not necessarily upon call, but when the unit deals or receives damage, for example)
With avoiding those, it can be useful.

Quote:
Lol... I didn't see Disciple's Post... He already posted a GetNearestUnit xP
Yeah, but his is more flexible, I think.
Silvenon is offline   Reply With Quote
Old 03-05-2008, 01:45 AM   #35 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


GetClosestUnitFunction

I'm assuming that the function works, but could you explain it to me a bit better, kind of step by step

Mostly, I'm curious as to why (dx^2 + dy^2)/100000 > 100000 is the closest unit (I suppose that 100000 is the max size of all maps?)
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 03-05-2008, 05:53 PM   #36 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


No.

You see, I was trying to avoid SquareRoot function (as you can see, there isn't one in it). In the beginning, md variable represents a great distance (probably bigger than the map) which is compared to the location from which it is searching the closest unit. If distance from a picked unit and that location is lower than that distance (which it is), md becomes the distance between the picked unit and the location. Then it compares to the other units, if the distance from a certain unit to that location is lower than the current md, that md becomes that distance.

But, since I'm not using SquareRoot, the system compares each distance squared (since I'm not square rooting it), so md has to represent a distance greater than any other, but it has to be squared (since maybe some distance squared will be greater than that one), so with a little help from Disciple, I used this simple equation:

Code:
x = y
x/1000 = y/1000
I had to lower each number because there is a number limit in wc3 from which every next number becomes the negative value of that number (then I would be calculating with negative distances........yeah).

Get it?
Silvenon is offline   Reply With Quote
Old 03-08-2008, 12:45 AM   #37 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Hmmm

Ohhhhh now I got it

Your just getting the x and the y, then using pythagorean thereom

There isn't a ^ (1/2) function so it had to be a number that is much larger than any two squares could be (100000*100000)

But at the same time, x^2 and y^2 would get so big they would flip to negative(odd), so you just divided x^2 + y^2 by 100000

So, does it keep looping over and over, even after you got the unit??? (maybe you should add something so it doesn't loop with over 300 units or something)

_________________________________________________
EDIT

Finally, I'm starting to really understand JASS thanks to these little code snippets, thank you so much for this
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 03-08-2008, 01:05 PM   #38 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


Yeah, it loops through all units that satisfy the boolexpr condition. I can't make it run through less units because........because I just can't, I need to check every single one. This is supposed to be fast, so it shouldn't lag.

That flipping-to-negative is a stupid bug and people should be careful with it.
Silvenon is offline   Reply With Quote
Old 03-10-2008, 11:47 PM   #39 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Question

Do you think it would lag awfully in a timed trigger (.05) on a massive risk map??? (each unit has bout 100hp each, cost 1, and each player receives +100 gold per round)
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 03-11-2008, 08:41 AM   #40 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


First of all, this is getting offtopic, you should open a new thread or PM me, second of all, you really gave me little information, try to explain the details more (for example, I already lost you at the "massive risk map" part, since I don't know what that is).
Silvenon is offline   Reply With Quote
Old 03-11-2008, 08:54 PM   #41 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Eh nvm

I'm not gonna be making any risk maps any time soon, so it doesn't really matter just a bit curious


Btw, How come you wanted to avoid the SquareRoot function?
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 03-11-2008, 10:23 PM   #42 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


Arghhhh try to put all your questions in the fewest number of posts possible!

SquareRoot is a slow function, many good jassers are avoiding it. There are also other slow functions that should be avoided: Sin(), Cos(), Tan(), Pow()......
Silvenon is offline   Reply With Quote
Old 03-11-2008, 10:58 PM   #43 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Sorry bout that

Yeah the questions kind of just keep popping into my mind

Damn sin, cos, tan, pow, all are no good

That makes me sad

I suppose you would only use those if they were absolutely necessary, like a polar coordinate (I think uses one of those)
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Old 03-12-2008, 09:01 AM   #44 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


Yeah, sometimes you have to use those, but I think Pow() isn't necessary in any situation (since Pow(x, 3) = x * x * x).

But with the power of vJass sin, cos and tan won't make problems anymore (since every good vJass code is freakin fast).

If you got any more questions, PM me, that would be better.
Silvenon is offline   Reply With Quote
Old 03-12-2008, 07:19 PM   #45 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Ok sure

Something about the unit for one player, I suppose you could use it as a dummy unit, and create special effects for players who should see it, and not for players who couldn't see it

I'm not really sure when the situation would call for it, but I suppose it would be for an RPG or something

(Maybe a flare behind a wall???)
__________________
77% of all people are neurotic
Herman is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Twice as small Oziris World Editor Help Zone 1 02-05-2008 10:41 AM
Small help needed with a small map-mod I'm making. Ekoi Map Development 5 10-07-2005 05:47 AM
GMAX CODE - Can someone give me your Gmax code please? Ryxian Modeling & Animation 1 11-12-2004 01:11 AM
Just a small hello. Sponge3737 Off-Topic 10 10-21-2004 09:16 PM

All times are GMT. The time now is 07:37 AM.






Your link here 
Loans | Proxy | Web Advertising | Adverse Credit Remortgage | Debt Consolidation
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle