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

Submissions Submit JASS resources! If approved, they will be moved to their proper section.
Please read me first.

Reply
 
LinkBack Thread Tools Display Modes
Old 08-09-2008, 11:20 AM   #1 (permalink)
 
Element of Water's Avatar

User
 
Join Date: Aug 2008
Posts: 252

Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)


[JASS] SetRectTerrainType

This isn't much, but I felt wc3 was lacking this function. It basically changes the terrain inside a rect to whatever you want. Here's the code:
function SetRectTerrainType takes rect r, integer terrainType, integer variation returns nothing
    local real minx = GetRectMinX(r)
    local real miny = GetRectMinY(r)
    local real maxx = GetRectMaxX(r)
    local real maxy = GetRectMaxY(r)
    local real x = minx
    local real y = miny
    loop
        exitwhen y >= maxy
        loop
            exitwhen x >= maxx
            call SetTerrainType(x, y, terrainType, variation, 1, 1)
            set x = x + 128.0
        endloop
        set y = y + 128.0
        set x = minx
    endloop
endfunction
I don't know why, but this function doesn't work after TriggerSleepAction is called, but I'm sure there are ways round that, such as using a timer, though I haven't tested any.
__________________

Last edited by Element of Water; 08-09-2008 at 12:17 PM..
Element of Water is offline   Reply With Quote
Old 08-09-2008, 12:10 PM   #2 (permalink)

Anozer jasser
 
Join Date: Apr 2008
Posts: 237

Troll-Brain has little to show at this moment (13)Troll-Brain has little to show at this moment (13)


Why 130 instead of 128 ?
Troll-Brain is offline   Reply With Quote
Old 08-09-2008, 12:13 PM   #3 (permalink)
 
Element of Water's Avatar

User
 
Join Date: Aug 2008
Posts: 252

Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)


Sorry I didn't know what the correct value was, but 130 seemed close enough. I'll edit it, though it wouldn't make any difference in all but the largest rects...

EDIT: fixed.
__________________
Element of Water is offline   Reply With Quote
Old 08-09-2008, 04:55 PM   #4 (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 

Quote:
I don't know why, but this function doesn't work after TriggerSleepAction is called
That almost definitely has to do with the context you were testing it in.
PurplePoot is offline   Reply With Quote
Old 08-11-2008, 10:04 AM   #5 (permalink)
 
Element of Water's Avatar

User
 
Join Date: Aug 2008
Posts: 252

Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)


I tested it by doing:
call SetRectTerrainType(gg_rct_test1, 'Lgrs', -1)
call SetRectTerrainType(gg_rct_test2, 'Lgrs', -1)
call SetRectTerrainType(gg_rct_test3, 'Lgrs', -1)
call SetRectTerrainType(gg_rct_test4, 'Lgrs', -1)
call SetRectTerrainType(gg_rct_test5, 'Lgrs', -1)
and it all worked until I put call TriggerSleepAction(0.5) after every call, then it just worked in the first rect, but didn't do anything to the others...
__________________
Element of Water is offline   Reply With Quote
Old 08-11-2008, 11:48 AM   #6 (permalink)

User
 
Join Date: Nov 2007
Posts: 94

Deaod has little to show at this moment (11)Deaod has little to show at this moment (11)


would you please post the whole code you used for testing? There must be some reason why only the first rect gets converted.
Deaod is offline   Reply With Quote
Old 08-11-2008, 06:19 PM   #7 (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 

Was that inside a boolexpr or a timer callback?
PurplePoot is offline   Reply With Quote
Old 08-14-2008, 10:00 AM   #8 (permalink)
 
Element of Water's Avatar

User
 
Join Date: Aug 2008
Posts: 252

Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)Element of Water has little to show at this moment (29)


Well, it was in the main menu for my project - Azeroth - Total War. It's not quite done but it has the SetRectTerrainType function working in it perfectly.
Attached Files
File Type: w3x Main Menu.w3x (19.5 KB, 10 views)
__________________
Element of Water 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
JASS: Moving From GUI to Jass, the Start Rheias JASS/AI Scripts Tutorials 61 07-22-2008 11:06 AM
I'm a JASS noob so I would like to find out if something is possible with JASS Aoen Triggers & Scripts 14 01-06-2007 09:38 PM
[JASS Request] Trigger to JASS AztraL- Requests 0 10-08-2006 03:02 PM
passing local variable in JASS? Channeled effects with JASS? kuraruka Triggers & Scripts 2 02-10-2006 11:38 PM
[JASS] Converting GUI to JASS !! PLEASE HELP !! Learning JASS HELP ApM Triggers & Scripts 7 03-10-2005 12:42 PM

All times are GMT. The time now is 08:42 AM.






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