• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Removing Purchasable Units from Nuetral Buildings

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
Alright so I have a trigger that prevents a unit from being purchasable during the night and makes it available during the day. This right now is my current trigger:

JASS:
function Trig_Skiptime_Actions takes nothing returns nothing
    if IsPlayerInForce(GetLocalPlayer(), udg_BloodPackPlayer) then
        call SetPlayerTechMaxAllowed(GetLocalPlayer(), 'uC02', -1)
    endif
    if udg_EasyMode == 1 then
        call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 7.10)
        call SetGameSpeed( MAP_SPEED_SLOW )
    else
        call SetGameSpeed( MAP_SPEED_NORMAL )
        call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 8.10)
    endif
endfunction

//===========================================================================
function InitTrig_Skiptime takes nothing returns nothing
    set gg_trg_Skiptime = CreateTrigger(  )
    call TriggerRegisterGameStateEvent(gg_trg_Skiptime, GAME_STATE_TIME_OF_DAY, EQUAL, 6.10)
    call TriggerAddAction( gg_trg_Skiptime, function Trig_Skiptime_Actions )
endfunction
JASS:
function RemoveDamned takes nothing returns boolean
    if GetUnitTypeId(GetEnumUnit()) == 'uC02' then
        call KillUnit(GetEnumUnit())
    endif
return false
endfunction

function Trig_Slowtime_Actions takes nothing returns nothing
 local group g = CreateGroup()
    call SetMapFlag(MAP_LOCK_SPEED, true)
    call GroupEnumUnitsInRect(g, GetPlayableMapRect(), function RemoveDamned)
    if IsPlayerInForce(GetLocalPlayer(), udg_BloodPackPlayer) then
        call DisplayTextToPlayer(GetLocalPlayer(), 0,0, "Damned Souls are no longer available")
        call SetPlayerTechMaxAllowed(GetLocalPlayer(), 'uC02', 0)
    endif
    if udg_EasyMode == 1 then
        call SetGameSpeed( MAP_SPEED_FAST )
    else
        call SetGameSpeed( MAP_SPEED_FASTEST )
    endif
    call DestroyGroup(g)
 set g = null
endfunction

//===========================================================================
function InitTrig_Slowtime takes nothing returns nothing
    set gg_trg_Slowtime = CreateTrigger(  )
    call TriggerRegisterGameStateEvent(gg_trg_Slowtime, GAME_STATE_TIME_OF_DAY, EQUAL, 18.10)
    call TriggerAddAction( gg_trg_Slowtime, function Trig_Slowtime_Actions )
endfunction

However it's not working at all. I based it off of the idea of the Hero Selection Taverns for AoS. What's the problem with it? :X

Also the trigger is suppose to speed up the day cycle and slow down the night cycle, but it isn't doing that. Nor is it removing the unit from the map when night comes.

Debug messages seem to indicate it's going through it's triggers, but the effects aren't happening.
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
None of my issues have been resolved yet :/

Am I to assume that their is no solution to these issues, or that the code has no problem?

They don't even seem like that complex of issues either. The use of SetTimeOfDayScale() is crashing my game. I remove it, no crash, I add it in, the game closes on 18:10.

I need to remove a unit from being buyable in game, then allow it to be purchased again at a later time. I'm sure plenty of people have done this and know the proper way to do it.
 
Status
Not open for further replies.
Top