HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

NEW! JASS function pack, please contribute

08-25-2003, 07:02 PM#136
piRo-piOn
1. can someone please tell me what is the last version of this function pack and if and when there will be a webpage?

2. Is there anything that closeley resembles a dialog engine in this function pack that i can use (updated for TFT)? I really don't want to have to go and make my own... "why you ask? The answer to this can be found in another question: What is the most universal characteristic? Fear, or lazyness?"
08-25-2003, 09:41 PM#137
Peppar
I made a dialog engine that is yet to be included to the function
pack (if ever, it defies the rules somewhat). It can be found here.
08-26-2003, 07:06 PM#138
Starcraftfreak
Measures to make sure the names match the way Blizzard named their functions:
UnitTypeIsInUnitGroup: rename it to UnitTypeIsInGroup
UnitTypeIsInRegion: rename it to UnitTypeIsInRect, rename all descriptions, so that a "region" is a rect
PlayerGroupIsEmpty: rename it to IsForceEmpty
Unit2UnitGroup: rename it to UnitToGroup
PlaySound4Player: rename it to PlaySoundForPlayer

Code:
function SwitchUnits takes unit whichUnit1, unit whichUnit2 returns nothing
    local location unitloc1

    set unitloc1 = GetUnitLoc(whichUnit1)

    call SetUnitPathing( whichUnit1, false )
    call SetUnitPathing( whichUnit2, false )

    call SetUnitPositionLoc( whichUnit1, GetUnitLoc(whichUnit2) )
    call SetUnitPositionLoc( whichUnit2, unitloc1 )

    call SetUnitPathing( whichUnit1, true )
    call SetUnitPathing( whichUnit2, true )
endfunction

Why do you store the location of whichUnit1 in a variable?
08-26-2003, 08:03 PM#139
Peppar
Code:
call SetUnitPositionLoc( whichUnit1, GetUnitLoc(whichUnit2) )
The moment Jass hits this line of code, whichUnit1 is moved and
his position is forgotten. It's the only way to do it, I'm afraid.

EDIT: Btw, the location should be destroyed, or it will leak
memory. (I think...)
08-26-2003, 11:55 PM#140
dataangel
One of the features the site is going to have is a "requested function" list where people can submit functions that they'd like to see, than admins can remove these if they're infeasible or if they've been coded. The list will be for people who wanna earn more XP but can't think of anything new to code ;)

Anyway, if anyone wants to start, go a page back and I have a thread of functions I intend to code... unless somebody beats me to them first :ggani:

BTW, if anybody knows or is a PHP/MySQL guru, I am in need of assistance to get this working.

@Peppar: In your special effects functions, I wonder if it would be better to do DestroyTrigger( ThisTrigger() ) (not sure that's what it's called but you know what I mean) at the bottom of the child function.
08-28-2003, 04:41 AM#141
dataangel
Added a bunch more functions to do to list in previous thread page.

Still need a php/mysql guru :/
08-30-2003, 06:42 PM#142
Starcraftfreak
Code:
//Returns the external string with the given index
//Returns the name of Player 1 if there is no external string with the given index
//Requires: StrLen
function GetExternalString takes integer index returns string
    local string name = GetPlayerName(Player(0))
    local string extstring
    local integer i

    set i = 3 - strlen(I2S(index))
    set extstring = "TRIGSTR_"
    loop
        exitwhen i <= 0
        set extstring = extstring + "0"
        set i = i - 1
    endloop
    set extstring = extstring + I2S(index)
    call SetPlayerName(Player(0), extstring)
    set extstring = GetPlayerName(Player(0))
    call SetPlayerName(Player(0), name)
    return extstring
endfunction

Thanks AIAndy for explaining how to get the string.

I wasn't able to make it return an empty string, if this external string doesn't exist.

BTW, this was the first fuction of me, that worked for the first time without testing.
08-30-2003, 08:58 PM#143
PitzerMike
I'd rather set and get the Player Name of Player(PLAYER_NEUTRAL_PASSIVE)
even if you set the name back after that procedure
08-30-2003, 10:21 PM#144
Peppar
Regarding externalized strings:
http://www.battle.net/forums/war3/th...nt=7#post55665
08-31-2003, 06:25 PM#145
Starcraftfreak
Quote:
Originally posted by PitzerMike
I'd rather set and get the Player Name of Player(PLAYER_NEUTRAL_PASSIVE)
even if you set the name back after that procedure
It doesn't matter. I would have to set it back anyway. And the function is fast enough, that no one notices.

@Peppar:
Nice discussion with Brett_Wood. Fine that you made him think about an addition to the next patch (making my function useless :nono:).
09-01-2003, 07:17 PM#146
Peppar
Actually I held that discussion before you posted that function.

And, there is one thing that your function lacks: the ability to use
it asynchronously. If the players have different string tables the
game will desync if you attempt to localize a string that differs.
That is why I even considered discussing the matter with BWood.

And I wouldn't say that your function would be useless in the light
of the native function. You build a TRIGSTR_-reference from an
integer while the other function requires one.
09-01-2003, 09:58 PM#147
Starcraftfreak
Is there a way to make it work in multiplayer?
I know what you mean. You mean, if that person has a localized version, and he has maybe another version of the WTS file loading (with the ID).
BTW, to test whether Warcraft III loads such files by their ID (like if the user has the German version it uses the one with ID 1031) isn't that difficult. You just have to modify config.txt (war3.mpq). Look at the article about Local IDs on my website.
09-01-2003, 11:17 PM#148
Peppar
I don't know of any way to make it multiplayer, sorry. Not even
the functions in Blizzard.j are sync-proof.

Your Locale ID information is cool, and your site is really helpful.
Until now I haven't been able to test locale-dependant functions.
Thank you! :P. I have locale id 0x409.

Also, if you haven't already checked, there is an excessively long
list of locale ids on msdn.

http://msdn.microsoft.com/library/de.../vsmsclcid.asp
09-02-2003, 08:37 PM#149
Starcraftfreak
@Peppar: I know about local IDs since a year and a half (or so). At some time I decided to write that article you can find on my site. I know, that for each country there is an ID, but only a few are used by Blizzard.
09-02-2003, 09:16 PM#150
Peppar
Yes you seem to possess a great deal of knowledge regarding
these issues. I am glad you do :P. I realized that the Locale ids
that Blizzard uses are actually a widely spread standart first when
I read your article on the subject.