HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need a couple of suggestions

01-07-2007, 08:06 PM#1
Feroc1ty
Well i have made a script that makes maze making easyer but it only has 2 functions so far, please give suggestions

Collapse JASS:
//////////////////////////////////////////////////////// Jokes-On-You's Maze Maker /////////////////////////////////////////////////////////
// *Functions                                                                                                                             //
//     *Periodic                                                                                                                          //
//          (Use on a periodic event) Does specific functions on certain terrain types                                                    //
//     *Revive                                                                                                                            //
//          (Use on a unit dies event) Checks if 1-however many players specified food equls to 0, if so respawns units at respawn region.//
// *How to use                                                                                                                            //
//     * Select custom script action, and type in "call Function()" without the quotes, Ex. call Kill()                                   //
//          (Note that the line will be case sensitive so CALL KILL(), Call kill(), call KILL will not work, only call Kill()             //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function Periodic takes nothing returns nothing
    local integer i = 1
    local location p
    loop
        exitwhen i > udg_players
        if GetTerrainType(GetUnitX(udg_Unit[i]),GetUnitY(udg_Unit[i])) == udg_terrain then
            call KillUnit( udg_Unit[i] )
        else
        endif
        if GetTerrainType(GetUnitX(udg_Unit[i]),GetUnitY(udg_Unit[i])) == udg_terrain2 then
            call PauseUnitBJ( true, udg_Unit[i] )
            set p = GetUnitLoc(udg_Unit[i])
            call SetUnitPositionLoc( udg_Unit[i], PolarProjectionBJ(p, 12.00, GetUnitFacing(udg_Unit[i])) )
            call RemoveLocation(p)
        else
            call PauseUnitBJ( false, udg_Unit[i] )
        endif
        set i = i + 1
    endloop
    set p = null
endfunction

function Revive takes nothing returns nothing
    local location p
    local integer food = 0
    local integer i = 1
    loop
        exitwhen i > udg_players
        set food = food + GetPlayerState(ConvertedPlayer(i), PLAYER_STATE_RESOURCE_FOOD_USED)
        set i = i + 1
    endloop
    if food == 0 then
        if udg_chances != 0 then
            set i = 1
            set udg_chances = udg_chances - 1
            call DisplayTextToForce( GetPlayersAll(), ( "You have " + ( I2S(udg_chances) + " chances left!" ) ) )
            loop
                exitwhen i > udg_players
                set p = GetRandomLocInRect(udg_respawn)
                call ReviveHeroLoc( udg_Unit[i], p, true )
                call PanCameraToTimedLocForPlayer( ConvertedPlayer(i), p, 1.00 )
                call RemoveLocation(p)
                set i = i + 1
            endloop
            set i = 1
            loop
                exitwhen i > udg_players
                call PauseUnitBJ( true, udg_Unit[i] )
                call SelectUnitForPlayerSingle( udg_Unit[i], ConvertedPlayer(i) )
                set i = i + 1
            endloop
            call PolledWait( 2 )
            set i = 1
            loop
                exitwhen i > udg_players
                call PauseUnitBJ( false, udg_Unit[i] )
                set i = i + 1
            endloop
        else
            set i = 1
            call CinematicFilterGenericBJ( 5.00, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 100, 100, 100, 100, 0, 0, 0, 0 )
            call PolledWait( 5.00 )
            loop
                exitwhen i > udg_players
                call CustomDefeatBJ( ConvertedPlayer(i), "You have failed!" )
                set i = i + 1
            endloop
        endif
    endif
    set p = null
endfunction

I need sugestions on upgrading my functions or on making further functions.


Some people might ask WHY ARE YOU MAKING THIS, and i have a simple answer, to help newbies, and also speed up the map making, becouse currently only maps that are being hosted are 'DOTAS'

here is a screenie of how short the triggers are.

Initialization


Checks if all units are dead, and if so it revives them if have enough chances


Kills units that are off the path
01-08-2007, 04:27 AM#2
Joker
This should proly be in the Trigger/Script section, and also, you have do
Code:
[gui][/gui]
to show gui. Ill edit my post later for my suggestion
01-08-2007, 04:32 AM#3
Pyrogasm
Quote:
Originally Posted by Joker
This should proly be in the Trigger/Script section, and also, you have do
Code:
[gui][/gui]
to show gui. Ill edit my post later for my suggestion
They're not [gui] tags, they're [trigger][/trigger] tags..
01-08-2007, 04:43 AM#4
Feroc1ty
i tought would better fit general sectious becouse i dont really need any help with the script itself, only suggestions :/
01-08-2007, 06:06 PM#5
Joker
Quote:
Originally Posted by Pyrogasm
They're not [gui] tags, they're [trigger][/trigger] tags..
oops my bad

well, you could get rid of some bj's
01-08-2007, 10:46 PM#6
Feroc1ty
Srry i started scripting not long ago and dont know what that means :/
01-08-2007, 11:01 PM#7
SFilip
BJs are functions made by Blizzard presumably to simplify the use of some natives. Most of them (but not all) have the "BJ" suffix (most likely stands for Blizzard Jass) because of which we call them BJs.
Most of them (again not all, but this is probably debatable) are just useless junk that wraps around a native and swaps its parameters. More importantly calling a BJ instead of a native is slightly slower so you should avoid them whenever possible.
To make your job easier I suggest downloading JassCraft or Silly Jass Utility which feature function lists that allow you easily lookup a function, see if its a BJ and use the corresponding native instead of it.

As for the system itself...
> to help newbies
Ouch...
Newbies avoid using Jass as much as possible, even if you give clear explanations. And if someone knows Jass then I'm almost certain that he would know how to do this himself.

Nevertheless I like the idea. You should go for adding some sliding and jumping triggers...people ask for these very often and, although they exist in some other systems, having them as a part of a maze system is probably a must.
01-09-2007, 12:23 AM#8
Feroc1ty
alrighty, just a question how should i do it, should i just base it off terrain type just like in the kill function?


edit: i have no idea how would jump be usefull in the maze system :/, a custom jump level? and if so i would have to add some more if than's on my kill function :((

EDIT; added a sliding function which requires you to set terrain2 variable to a type of terrain that units will slide on.


Anyways for the sliding to look smooth you need to have at least 0.04 second periodic event calling Periodic(), or else it looks very edgy, anyways i tried it on 0.04, which my computer is 1.6ghz and 512mb of ram and the map runs pretty smooth.