(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Modding > World Editor Help Zone

World Editor Help Zone Need help with Blizzard's World Editor? Ask general questions about its features and use in this forum. README!

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 02-20-2008, 12:38 AM   #1 (permalink)

daehtorraP
 
Join Date: Jun 2007
Posts: 695

Parrothead has little to show at this moment (54)


Modify Code

Can someone modify these codes so that instead of making units slide on northrend ice to slide on lordaeron summer dirt?

function Trig_Slides_Actions takes nothing returns nothing
    local group g1
    local group g2
    local location p
    local location p2
    local unit u
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 11
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set g1 = GetUnitsOfPlayerAndTypeId(ConvertedPlayer(GetForLoopIndexA()), 'hpea')
        set u = GroupPickRandomUnit(g1)
set p = GetUnitLoc(u)
        if ( IsUnitAliveBJ(u) == true ) then
            if ( GetTerrainTypeBJ(p) == 'Nice' ) then
                set p2 = PolarProjectionBJ(p,7, GetUnitFacing(u))
                call SetUnitPositionLoc( u, p2 )
                call RemoveLocation( p2 )
            endif
        endif
        call RemoveLocation( p )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction
function InitTrig_Slides takes nothing returns nothing
    set gg_trg_Slides = CreateTrigger( )

    call TriggerRegisterTimerEventPeriodic( gg_trg_Slides, 0.02 )
    call TriggerAddAction( gg_trg_Slides, function Trig_Slides_Actions )
endfunction

Can you please change this one to lordaeron summer dirt as well?

function Trig_Skate_Conditions takes nothing returns boolean
    if ( GetBooleanOr( GetIssuedOrderIdBJ() == String2OrderIdBJ("smart") , GetIssuedOrderIdBJ() == String2OrderIdBJ("move") ) ) then
        return true
    endif
    return false
endfunction

function Trig_Skate_Actions takes nothing returns nothing
    local location p
    local location p2
    set p = GetUnitLoc(GetOrderedUnit())
    if ( GetTerrainTypeBJ(p) == 'Nice' ) then
        set p2 = GetOrderPointLoc()
        call SetUnitPositionLocFacingBJ( GetTriggerUnit(), PolarProjectionBJ(p, 1.00, DistanceBetweenPoints(p, p2)), AngleBetweenPoints(p, p2) )
        call RemoveLocation( p2 )
    endif
    call RemoveLocation( p )
endfunction

function InitTrig_Skate takes nothing returns nothing
    set gg_trg_Skate = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Skate, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Skate, Condition( function Trig_Skate_Conditions ) )
    call TriggerAddAction( gg_trg_Skate, function Trig_Skate_Actions )
endfunction

Last edited by Dr Super Good; 02-20-2008 at 01:08 AM.. Reason: Use JASS tags please.
Parrothead is offline  
Old 02-20-2008, 01:15 AM   #2 (permalink)
Spell and Map Moderator
 
Dr Super Good's Avatar

The Helpful Personage
 
Join Date: Jan 2005
Posts: 4,269

Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)


Change
'Nice'
in both pieces to be the equivelent for the other terane.

To find this out make a GUI one that references that terane type and convert it into JASS and it will appear.
Dr Super Good is offline  
Old 02-20-2008, 01:15 AM   #3 (permalink)

daehtorraP
 
Join Date: Jun 2007
Posts: 695

Parrothead has little to show at this moment (54)


So that would be Ldrt!

Thank you!

Edit, how do you turn jass scripts on and off because I want to leave a code initially off but if a player chooses a certain dialog it turns on?
Parrothead is offline  
Old 02-20-2008, 01:54 AM   #4 (permalink)
 
overload119's Avatar

User
 
Join Date: May 2007
Posts: 94

overload119 has little to show at this moment (15)overload119 has little to show at this moment (15)


I think you want the Trigger - Turn Off action.

I guess in your case you'd make a separate trigger that would check to see if a dialogue button was clicked, then turn on the trigger with that JASS code in it, and if another one is clicked then it will turn it off
__________________
Don't forget -> Want to show your thanks to someone? Add reputation!
overload119 is offline  
Old 02-20-2008, 02:37 AM   #5 (permalink)
Spell and Map Moderator
 
Dr Super Good's Avatar

The Helpful Personage
 
Join Date: Jan 2005
Posts: 4,269

Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)


Yes, both jass scripts are run by the trigger they are in, and thus turning it on and off turns them on and off.

WARNING
The top script leaks 250 (50 runs per second leaking 5 each) non nulled locals a second and 550 (50 runs per second looping 11 times per run leaking 1 per loop) groups a second.

The bottom script leaks 2 non nulled locals a fire.

SOLUTION
Null all local handles at the end of the function to remove the non nulled local leaks.

Destroy all groups in the upper script after they have been used in the loop (before they are replaced with a new group).

If you do not want to fix this you run the risk of your map becomming unplayable with in a few minutes of playing due to too many leaks, the choice is yours to make and so I strongly recomend you remove all leaks in atleast the upper script atleast as that leaks a unbareable ammount.
Dr Super Good is offline  
Old 02-20-2008, 02:50 AM   #6 (permalink)
 
hvo-busterkomo's Avatar

Resistance 2
 
Join Date: Jul 2007
Posts: 739

hvo-busterkomo has little to show at this moment (57)


To make it initially off use DisableTrigger. So it would be
call DisableTrigger(gg_trg_Skate)
__________________
Current Projects:

Humans vs Orcs v5.01 full release: 98%

Untitled Warcraft 1-2 historical reenactment: 30%
hvo-busterkomo is offline  
Old 02-20-2008, 03:13 AM   #7 (permalink)
 
HINDYhat's Avatar

WRONG HOLE!
 
Join Date: Apr 2007
Posts: 1,022

HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)

Super Donor: This user has donated at least $100 to The Hive. 

Quote:
Originally Posted by Dr Super Good
Null all local handles
Not all local handles must be nulled. Things like players and boolexpr (whose functions return constant values) do not need to be nulled.
__________________
HINDYhat is offline  
Closed Thread

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
Can you modify a model for me? Paladon Requests 9 04-14-2008 02:11 AM
level modify flashing World Editor Help Zone 3 03-16-2008 12:28 PM
Phoenix Fire Modify DeFiLeR8383 Triggers & Scripts 1 07-01-2005 09:20 AM
[JASS] How to modify Globals? Hydragon Triggers & Scripts 2 04-13-2005 04:35 PM
Vertex Modify StealthFox Modeling & Animation 1 01-15-2005 03:42 AM

All times are GMT. The time now is 06:02 AM.






Your link here 
Credit Cards | Tesco | Credit Cards UK | Advertising | Bankruptcy Certification
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle