Map Crashing

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
In my footies map, when units are spawned they will goto the main buildings rally point. Great huh? I know.
Thing is, I'm getting a crash. Here's how I got it.
I set the rally point somewhere on the map, not on the main building. I then continue upgrading my units and number of units spawned. Ect. Upgrading building....
After a while, if I set the rally point to the main building again then it goes kaboom. Crash. Close.
Here's the code. Yes, units spawn fine.

JASS:
scope Spawning initializer Init
    globals
    //Arrays for setting each level of each tier.
        private integer array HUMANTIER
        private integer array COVENANTTIER
        private integer array FLOODTIER
        
    //Bases
        private constant integer HUMANBASE = 'hC01'
        private constant integer COVBASE = 'oC02'
        private constant integer FLOODBASE = 'uC03'
        
    //Increase Tier Upgrade ID
        private constant integer TIERUP = 'R002'
    //The number spawned.
        private integer array NUMSPWNED [12]
    //A safety so the units don't run to the middle aimlessly.
        private location array SAFETY
    //Used for SUPOT.
        public integer array UQID [12]
    //The type of spawn.
        private integer array SPWNTYPE [12]
    //The frequency of the spawn.
        private real array SPWNFREQ [12]
    //Increase # Of Units Spawned Upgrade ID
        private constant integer INCSPWN = 'R000'
    //The unit tier level for each player.
        private integer array TIERLEVEL[12]
    //The location the units run to.
        private location array RUNTO [12]
    endglobals
    
    private function StartingC takes nothing returns boolean
        return GetUnitTypeId(GetTriggerUnit()) == HUMANBASE or GetUnitTypeId(GetTriggerUnit()) == COVBASE or GetUnitTypeId(GetTriggerUnit()) == FLOODBASE
    endfunction
    
    private function Starting takes nothing returns nothing
        local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
        local real x = GetUnitX(GetTriggerUnit())
        local real y = GetUnitY(GetTriggerUnit())
        set NUMSPWNED<i> = 1
        set SPWNFREQ<i> = 5
        set SAFETY<i> = GetUnitRallyPoint(BASE<i>)
        if GetUnitTypeId(GetTriggerUnit()) == HUMANBASE then
            //Start Spawning Humans
            set UQID<i> = SUPOT_Start(GetOwningPlayer(GetTriggerUnit()),HUMANTIER[TIERLEVEL<i>],NUMSPWNED<i>,SPWNFREQ<i>,x,y)
            set SPWNTYPE<i> = 0
        elseif GetUnitTypeId(GetTriggerUnit()) == COVBASE then
            //Start Spawning Covenant
            set UQID<i> = SUPOT_Start(GetOwningPlayer(GetTriggerUnit()),COVENANTTIER[TIERLEVEL<i>],NUMSPWNED<i>,SPWNFREQ<i>,x,y)
            set SPWNTYPE<i> = 1
        else
            //Start Spawning Flood
            set UQID<i> = SUPOT_Start(GetOwningPlayer(GetTriggerUnit()),FLOODTIER[TIERLEVEL<i>],NUMSPWNED<i>,SPWNFREQ<i>,x,y)
            set SPWNTYPE<i> = 2
        endif
    endfunction
    
    private function TierUpC takes nothing returns boolean
        return GetResearched() == TIERUP
    endfunction
    
    private function TierUpA takes nothing returns nothing
    //Increases the tier level for a player.
        local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
        set TIERLEVEL<i> = TIERLEVEL<i>+1
        if SPWNTYPE<i> == 0 then
            call SUPOT_ChangeUnitID(UQID<i>, HUMANTIER[TIERLEVEL<i>])
        elseif SPWNTYPE<i> == 1 then
            call SUPOT_ChangeUnitID(UQID<i>, COVENANTTIER[TIERLEVEL<i>])
        else
            call SUPOT_ChangeUnitID(UQID<i>, FLOODTIER[TIERLEVEL<i>])
        endif
    endfunction
    
    private function IncSpwnC takes nothing returns boolean
        return GetResearched() == INCSPWN
    endfunction
    
    private function IncSpwnA takes nothing returns nothing
        local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
        set SPWNFREQ<i> = SPWNFREQ<i>+4
        set NUMSPWNED<i> = NUMSPWNED<i>+1
        call SUPOT_ChangeSpawnTime(UQID<i>,SPWNFREQ<i>)
        call SUPOT_ChangeSpawnAmount(UQID<i>,NUMSPWNED<i>)
    endfunction
    
    private function MoveRally takes nothing returns nothing
        local integer i = 0
        loop
        exitwhen i &gt; 11
            //Rally Point Update
            set RUNTO<i> = GetUnitRallyPoint(BASE<i>)
            set i = i + 1
        endloop
    endfunction
    
    private function MoveUnit takes nothing returns nothing
        local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
        if RUNTO<i> != SAFETY<i> and IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == false then
            //If rally point isn&#039;t at base, then make units attack walk to it.
                call IssuePointOrder(GetTriggerUnit(),&quot;attack&quot;,GetLocationX(RUNTO<i>),GetLocationY(RUNTO<i>))
        endif
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local timer t2 = CreateTimer()
        local trigger t3 = CreateTrigger()
        local trigger t4 = CreateTrigger()
        local trigger t5 = CreateTrigger()
        local integer i = 0
        
        //What spawns per tier.
    //Humans
        set HUMANTIER[0] = &#039;hfoo&#039;
        set HUMANTIER[1] = &#039;hrif&#039;
        set HUMANTIER[2] = &#039;hkni&#039;
        set HUMANTIER[3] = &#039;hgry&#039;
        set HUMANTIER[4] = &#039;hrtt&#039;
    //Covenant
        set COVENANTTIER[0] = &#039;ogru&#039;
        set COVENANTTIER[1] = &#039;ohun&#039;
        set COVENANTTIER[2] = &#039;orai&#039;
        set COVENANTTIER[3] = &#039;otau&#039;
        set COVENANTTIER[4] = &#039;n00N&#039;
    //Flood
        set FLOODTIER[0] = &#039;ugho&#039;
        set FLOODTIER[1] = &#039;ucry&#039;
        set FLOODTIER[2] = &#039;uabo&#039;
        set FLOODTIER[3] = &#039;ufro&#039;
        set FLOODTIER[4] = &#039;e001&#039;
        
        loop
        exitwhen i &gt; 11
            call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_UPGRADE_FINISH,Condition(function FailSafe))
            call TriggerRegisterPlayerUnitEvent(t4,Player(i),EVENT_PLAYER_UNIT_RESEARCH_FINISH,Condition(function FailSafe))
            call TriggerRegisterPlayerUnitEvent(t5,Player(i),EVENT_PLAYER_UNIT_RESEARCH_FINISH,Condition(function FailSafe))
            call TriggerRegisterEnterRectSimple(t3,bj_mapInitialPlayableArea)
            set TIERLEVEL<i> = 0
            set i = i + 1
        endloop
        //For starting the spawn.
        call TriggerAddCondition(t,Condition(function StartingC))
        call TriggerAddAction(t,function Starting)
        
        //Triggers for increasing the tiers.
        call TriggerAddAction(t4,function TierUpA)
        call TriggerAddCondition(t4,Condition(function TierUpC))
        
        //Triggers for increasing the number of units spawned.
        call TriggerAddAction(t5,function IncSpwnA)
        call TriggerAddCondition(t5,Condition(function IncSpwnC))
        
        //Move unit when spawned.
        call TriggerAddAction(t3,function MoveUnit)
        
        //Rally Point Updating
        call TimerStart(t2,1,true,function MoveRally)
    endfunction
endscope</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>


And here's the error.

attachment.php
 

Attachments

  • W3ERR.JPG
    W3ERR.JPG
    18.8 KB · Views: 182
Remember that day where I was saying in channel you didn't know vJass.
I was partially wrong, you do know it but poorly.

I'll help you out, contact me on MSN and I'll provide you with some code and I'll teach you the best way on making things like this.
Though, of course I can make it for you but having a tutor on this will make you learn the use of it much faster.

Anyways, I was unable to find where the crash is caused.
However I did find a few bugs:
JASS:

    private function AtkMove takes nothing returns nothing
        local integer i = GetPlayerId(GetOwningPlayer(GetEnumUnit()))
        call IssuePointOrder(GetEnumUnit(),&quot;attack&quot;,GetLocationX(RUNTO<i>),GetLocationY(RUNTO<i>))
    endfunction</i></i>


GetEnumUnit() returns null and so the player ID is 0.
In other words, this will only work for Player 1.

I believe, however I'm not 100% sure that the order string should be: "attackmove".
 
Actually AtkMove was an old, and now unused, function.
I had simply forgotten to remove it. It is "attack" and I'm on MSN waiting.
 
"attackmove" is hardly a function.....looks more like a string to me...

a quick read through and I see no reason why it would crash....maybe its some where else
 
The only functions involved in this are in the above trigger, but here's the map.
 

Attachments

  • H3F.w3x
    1 MB · Views: 68
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top