Clan TMMM
Would you like to react to this message? Create an account in a few clicks or log in to continue.


The official site of Clan TMMM
 
HomeHomeSearchLatest imagesRegisterLog in


Latest topics
» Kevkevqaz is back
Region Question I_icon_minitimeby Eat_bacon_daily Wed Feb 22, 2023 7:22 pm

» Hey whats up
Region Question I_icon_minitimeby seankly Tue Feb 04, 2020 10:32 pm

» Gotta click fast - WC3 Mazing #mildlyinteresting
Region Question I_icon_minitimeby hoffmann Wed Jun 21, 2017 10:28 pm

» I'm getting married and you guys are invited
Region Question I_icon_minitimeby Achilles.42 Wed Sep 07, 2016 11:00 am

» Server Photo Album 1
Region Question I_icon_minitimeby Pat1487 Sat Aug 06, 2016 5:28 pm

» Legacy of The Void Beta
Region Question I_icon_minitimeby Achilles.42 Sun Oct 18, 2015 3:21 am

» Hey guys!!!
Region Question I_icon_minitimeby Eat_bacon_daily Fri Oct 16, 2015 11:20 pm

SC2 Links
SC2 Challenge/Tourney Info

Official SC2 Forums

SC2 Curse

SC2Mapster

Team Liquid

SC2 Replayed

SC2 Strategy
WC3 Links
Clan_TMMM[Host] Info

WC3 Challenge/Tourny Rules

Epicwar
Poll
What game does everyone play now?
Starcraft 2
Region Question I_vote_lcap26%Region Question I_vote_rcap
 26% [ 8 ]
Warcraft 3
Region Question I_vote_lcap35%Region Question I_vote_rcap
 35% [ 11 ]
League of Legends
Region Question I_vote_lcap19%Region Question I_vote_rcap
 19% [ 6 ]
World of Warcraft
Region Question I_vote_lcap0%Region Question I_vote_rcap
 0% [ 0 ]
Diablo 2
Region Question I_vote_lcap0%Region Question I_vote_rcap
 0% [ 0 ]
No games at all
Region Question I_vote_lcap10%Region Question I_vote_rcap
 10% [ 3 ]
Other game not listed
Region Question I_vote_lcap10%Region Question I_vote_rcap
 10% [ 3 ]
Total Votes : 31
Transparency

 

 Region Question

Go down 
2 posters
AuthorMessage
Serenity09
Moderator
Moderator
Serenity09



Region Question Empty
PostSubject: Region Question   Region Question I_icon_minitimeFri Aug 12, 2011 5:55 pm

alright so i'm trying to make an easier/faster way to do waypoint movement for creatures

ie. creature enters rect 1, ordered to move to rect 2 and then on entering rect 2 ordered to move to rect 3 etc

but in JASS it looks like:

Code:
function Move1 takes nothing returns nothing
   call NextMove(gg_rct_Rect_019)
endfunction

function InitMove takes nothing returns nothing
   local trigger t = CreateTrigger()
   local region r = CreateRegion()

   call RegionAddRect(r, gg_rct_Rect_XXX)

   call TriggerRegisterEnterRegion(t, r, OwnedByGreen
       call TriggerAddAction(t, function Move1)

   set t = null
   set r = null
endfunction

which is awful considering it needs to be done for each one

so i tried doing this

Code:
library WaypointMove

struct WaypointMove
    private region Waypoint = CreateRegion()
    private rect Nextpoint
    private trigger EntryEvent = CreateTrigger()
   
    static method WaypointNextMove takes nothing returns nothing
        call IssuePointOrder(GetTriggerUnit(), "move", GetRectCenterX(Nextpoint), GetRectCenterY(Nextpoint))
    endmethod
   
    method onDestroy takes nothing returns nothing
        set Waypoint = null
        set Nextpoint = null
        set EntryEvent = null
    endmethod

    static method create takes rect r1, rect r2 returns WaypointMove
        local WaypointMove new = WaypointMove.allocate()
       
        call RegionAddRect(new.Waypoint, r1)
        set new.Nextpoint = r2
       
        call TriggerRegisterEnterRegion(new.EntryEvent, new.Waypoint, OwnedByGreen)
        call TriggerAddAction(new.EntryEvent, function WaypointNextMove)
       
        return new
    endmethod
endstruct

endlibrary

OwnedByGreen is a filter func which does what it should
the problem with this is that it doesn't recognize WaypointNextMove as a valid function when I try to add it to the trigger
I'm pretty sure I've run into this exact problem before xD
but if you have an idea of how to fix it'd make my life a lot easier
.create(rect1, rect2) and doneeeeeeeeeeeeeeee

i tried it without the struct first, but you run into the problem of having to pass rects into WaypointNextMove

ive already tried the obvious stuff
like
function WaypointMove.WaypointNextMove



i have one more question, but it took way too long to type this one up, so i'll ask it later
Back to top Go down
Pat1487
Moderator
Moderator
Pat1487



Region Question Empty
PostSubject: Re: Region Question   Region Question I_icon_minitimeSun Aug 14, 2011 8:32 pm

What is the exact error
And is that the only one

I think it has to do with TriggerAddAction looking for a function where as you gave it a method
VJass converts methods into functions, but names them something else (i think) so when TriggerAddAction gets to it, its name as a function is no longer what you named it as a method
Back to top Go down
Serenity09
Moderator
Moderator
Serenity09



Region Question Empty
PostSubject: Re: Region Question   Region Question I_icon_minitimeSun Aug 14, 2011 9:16 pm

Code:
library WaypointMove requires FilterFuncs

struct WaypointMove
    private region Waypoint = CreateRegion()
    private rect Nextpoint
    private trigger EntryEvent = CreateTrigger()
   
    private method WaypointNextMove takes nothing returns nothing
        call IssuePointOrder(GetTriggerUnit(), "move", GetRectCenterX(Nextpoint), GetRectCenterY(Nextpoint))
    endmethod
   
    method onDestroy takes nothing returns nothing
        set Waypoint = null
        set Nextpoint = null
        set EntryEvent = null
    endmethod

    static method create takes rect r1, rect r2 returns WaypointMove
        local WaypointMove new = WaypointMove.allocate()
       
        call RegionAddRect(new.Waypoint, r1)
        set new.Nextpoint = r2
       
        call TriggerRegisterEnterRegion(new.EntryEvent, new.Waypoint, GreenOrBrown)
        call TriggerAddAction(new.EntryEvent, function WaypointMove.WaypointNextMove)
       
        return new
    endmethod
endstruct

endlibrary

here's its current form
idk what i messed up the last time when i tried this out, but it turns out its the exact same problem that I had the first time I tried with the wisp wheel (but I can't fix it the same way)

the error (on the trigger add action line):
"WaypointNextMove is not an static method of WaypointMove that takes nothing"

and I can't make it static because then I lose the ability to reference individual structs (which is the entire point of the damn thing)
Back to top Go down
Sponsored content





Region Question Empty
PostSubject: Re: Region Question   Region Question I_icon_minitime

Back to top Go down
 
Region Question
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Clan TMMM :: Warcraft 3 :: WC3 Tutorials and Help-
Jump to: