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: 181

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
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".
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
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.
 

emjlr3

Change can be a good thing
Reaction score
395
"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
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
The only functions involved in this are in the above trigger, but here's the map.
 

Attachments

  • H3F.w3x
    1 MB · Views: 67
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top