• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Map going crazy not echoing text but still running triggers

Status
Not open for further replies.
Level 3
Joined
Oct 7, 2011
Messages
37
Hi,
This is hard to describe but I'm not crazy bear with me

For some reason the majority of my text outputs using the following code
  • Game - Display to (All players) the text: Minigame Time!
seem to be outputing blank lines of text instead of the actual string

I'm working on a map with minigames everything was fine and dandy. Recently I tried showing someone and noticed some of the text wasent displaying anymore, specifically the minigame name and wind up text there are others as well but this is one I managed to isolate the code for

I've been working on the code to narrow the issue down but its just been getting more perplexing the further I've dug. As far as I can tell the code is executing correctly all the way through but when the text is meant to output to the player instead of normal text a blank line is output instead for seemingly no reason

I can tell its outputting a blank line because I started using a library from here that outputs a large amount of debug text and occasionally i now see blank rows being inserted in between the debug calls, I have tried disabling the new library and disabling and enabling debug mode and it did not change any of these issues
  • Minigame Timer
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • miniGamesOn Equal to (==) True
    • Actions
      • Set miniGameTimer = (miniGameTimer + 2)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • miniGameTimer Greater than or equal to (>=) MinigameFrequencySecs
          • Then - Actions
            • Set miniGameIsCurrentlyRunning = True
            • Set minGameType = minigameOrderOfPlay[minigameNext]
            • Game - Display to (All players) the text: Minigame Time!
            • Game - Display to (All players) the text: ___________________...
            • Set miniGamesOn = False
            • Trigger - Turn on Intro Minigame <gen>
          • Else - Actions
This is my trigger to start a minigame it runs every 300 seconds at the moment when the increment hits 300 or higher it sets a value to disable the trigger till the minigame is ended, it turns on a trigger that executes every second which spams some more text each second and plays some sounds then at the 5 second mark starts the minigame

All this stuff works as far as I can tell at the 300 second mark the sounds start playing according to the other trigger and 5 seconds later a random minigame starts

I haven't posted that code because its identical in most ways and all the actions in both triggers are happening just the text output is always blank

I had these outputs working briefly without changing much last night and then this morning with no change not working again but the trigger is definitely running because the minigame starts and there is no other code to start them on the map except from this trigger

I have checked the war3map.wts file by extracting it with a MPQ editor and I'm at around 5723 strings so not reached the end? if it does end at 8192 or whatever it is. The string Minigame Time! is in the file too so its not become corrupt somehow as far as i can tell though i don't have much experience manually editing these files

Does anyone have any ideas why I'm getting these texts being displayed as blank lines or had a similar issue and an approach to fixing it please?

I've tested at 15 seconds after map init outputting text using the same command and it worked with no problems as well
 
Last edited:
Level 3
Joined
Oct 7, 2011
Messages
37
I haven't managed to figure this out yet but i did try adding alternative text outputs and the ones that don't use forces seem fine
  • Minigame Timer
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • miniGamesOn Equal to (==) True
      • BattleRoyalRunning Equal to (==) False
    • Actions
      • Set miniGameTimer = (miniGameTimer + 2)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • miniGameTimer Greater than or equal to (>=) MinigameFrequencySecs
          • Then - Actions
            • Set miniGameIsCurrentlyRunning = True
            • Set minGameType = minigameOrderOfPlay[minigameNext]
            • Game - Display to (All players) the text: Minigame Time!
            • Game - Display to (All players) the text: ___________________...
            • Custom script: debug call BJDebugMsg("Minigame Time! debug")
            • Custom script: debug call BJDebugMsg("_____________________________________________ debug")
            • Set miniGamesOn = False
            • Trigger - Turn on Intro Minigame <gen>
          • Else - Actions
The two debug outputs output the text when the trigger executes the two normal Display to All players just print a blank line

Does anyone know of how All players force could be broken? Destroy force wouldn't permanently kill it would it? just the local variable
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Does anyone know of how All players force could be broken? Destroy force wouldn't permanently kill it would it? just the local variable
All players is a constant force. Destroying it will kill it forever so all future references to all players will return a destroyed force and not work as intended.

Never destroy all players.
 
Level 3
Joined
Oct 7, 2011
Messages
37
Is it ok to null a variable pointing to All Players?
and if i declare a force for a single player should i null and destroy that or not?

ie the following function
JASS:
function displayTextToPlayerAsForce takes unit hero, string text returns nothing
    local force pforce = GetForceOfPlayer(GetOwningPlayer(hero))
    call DisplayTextToForce(pforce,text)
    call DestroyForce(pforce)
    set pforce = null
endfunction
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Is it ok to null a variable pointing to All Players?
Yes, why should it not be? The only reason you null is to prevent a handle index garbage collector bug with locally declared handles (that are not parameters). In fact you do not even need to null the All Players group as it never gets destroyed so the handle index does not need to be recycled.

and if i declare a force for a single player should i null and destroy that or not?
You should never do that as it will cause a game split. You need to declare forces for all players.

If you mean declaring a force containing a single player then that is up to your implimentation. You could create a constant array of forces where the index is the player in the force and in that case there is no need to destroy or null locals with the force as you never destroy it (no leak). You could also just create a temporary force with the player and in that case you will have to destroy it and null all locals referencing it.
 
Level 3
Joined
Oct 7, 2011
Messages
37
Thanks for your help again but specifically with the example I posted
JASS:
function displayTextToPlayerAsForce takes unit hero, string text returns nothing
    local force pforce = GetForceOfPlayer(GetOwningPlayer(hero))
    call DisplayTextToForce(pforce,text)
    call DestroyForce(pforce)
    set pforce = null
endfunction
I am destroying and nulling that force is that correct or not? you seem to say at the start of your reply 2nd quote that i should never do this
You should never do that as it will cause a game split.
but towards the end you say
You could also just create a temporary force with the player and in that case you will have to destroy it and null all locals referencing it.
And the example above is a temporary force isn't it? the GetForceOfPlayer constructs a force from scratch and returns it so I should be destroying it?
JASS:
function GetForceOfPlayer takes player whichPlayer returns force
    local force f = CreateForce()
    call ForceAddPlayer(f, whichPlayer)
    return f
endfunction

Thanks for your replies :)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
And the example above is a temporary force isn't it? the GetForceOfPlayer constructs a force from scratch and returns it so I should be destroying it?
It creates a force containing one player for all players (the result has 1 player andt is synchronous with all players as opposed to something like a text tag which might only be created for a single player via GetLocalPlayer()). Yes you should destroy that force and null any non-parameter locals referencing it.
 
Level 3
Joined
Oct 7, 2011
Messages
37
I think this is solved now I read in one of the leak fixing tutorials here somewhere here that forces leak and I went through my entire map and destroyed them all after using them heh

Would have been more helpful if the leaking tutorials mentioned this that you can't destroy specific forces or you'll kill your map

Obviously slightly unwise ;)
Thanks everyone for helping
 
Status
Not open for further replies.
Top