Hiding code in war3map.j?

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Is it possible to put a jass code in war3map.j without having it show up in the trigger editor? (basically invisible code unless you export war3map.j [Though 100% invisible would be better, but there's no way its possible, right?])
 
Reaction score
341
JASS:
//===========================================================================
// 
// Just another Warcraft III map
// 
//   Warcraft III map script
//   Generated by the Warcraft III World Editor
//   Date: Thu Mar 12 19:18:18 2009
//   Map Author: Unknown
// 
//===========================================================================

//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    // Generated
    trigger                 gg_trg_Melee_Initialization = null
endglobals

function InitGlobals takes nothing returns nothing
endfunction

//***************************************************************************
//*
//*  Triggers
//*
//***************************************************************************

//===========================================================================
// Trigger: Melee Initialization
//
// Default melee game initialization for all players
//===========================================================================
function Trig_Melee_Initialization_Actions takes nothing returns nothing
    call MeleeStartingVisibility(  )
    call MeleeStartingHeroLimit(  )
    call MeleeGrantHeroItems(  )
    call MeleeStartingResources(  )
    call MeleeClearExcessUnits(  )
    call MeleeStartingUnits(  )
    call MeleeStartingAI(  )
    call MeleeInitVictoryDefeat(  )
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

//===========================================================================
function InitCustomTriggers takes nothing returns nothing
    call InitTrig_Melee_Initialization(  )
endfunction

//===========================================================================
function RunInitializationTriggers takes nothing returns nothing
    call ConditionalTriggerExecute( gg_trg_Melee_Initialization )
endfunction

//***************************************************************************
//*
//*  Players
//*
//***************************************************************************

function InitCustomPlayerSlots takes nothing returns nothing

    // Player 0
    call SetPlayerStartLocation( Player(0), 0 )
    call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
    call SetPlayerRacePreference( Player(0), RACE_PREF_HUMAN )
    call SetPlayerRaceSelectable( Player(0), true )
    call SetPlayerController( Player(0), MAP_CONTROL_USER )

endfunction

function InitCustomTeams takes nothing returns nothing
    // Force: TRIGSTR_002
    call SetPlayerTeam( Player(0), 0 )

endfunction

//***************************************************************************
//*
//*  Main Initialization
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
    call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
    call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
    call NewSoundEnvironment( "Default" )
    call SetAmbientDaySound( "LordaeronSummerDay" )
    call SetAmbientNightSound( "LordaeronSummerNight" )
    call SetMapMusic( "Music", true, 0 )
    call InitBlizzard(  )
    call InitGlobals(  )
    call InitCustomTriggers(  )
    call RunInitializationTriggers(  )

endfunction

//***************************************************************************
//*
//*  Map Configuration
//*
//***************************************************************************

function config takes nothing returns nothing
    call SetMapName( "Just another Warcraft III map" )
    call SetMapDescription( "Nondescript" )
    call SetPlayers( 1 )
    call SetTeams( 1 )
    call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS )

    call DefineStartLocation( 0, -2832.8, -2662.9 )

    // Player setup
    call InitCustomPlayerSlots(  )
    call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER )
    call InitGenericPlayerSlots(  )
endfunction


Under this..
JASS:
//***************************************************************************
//*
//*  Main Initialization
//*
//***************************************************************************


Just a guess.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Do you know what runs in what order in that? I'm trying to use something similar to Maplock except it just counts the number of handles (i think that already has been done but I like to do things myself), and it would be better if it ran after everything's created (and even maybe run 0.00 seconds in?)
 
Reaction score
341
Search the forums, someone has already done this.

I know you "like to do it yourself", but it would be best to find your answer there.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Well, I really don't know what to search... Besides the only time I saw this done... it wasn't hidden in the war3map.j... :\
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Who said I wanted to prevent people from hacking my map? Actually I do, except I don't want to Optimize my map either, I kind of want to make it "Read-Only", so that it prevents you from doing modifications, but you can still see the code and all.

That's why I'm looking for a good way to make it hard to find.


(Besides I looked at Saw792's anti-cheatpack as well as Jesus4Lyf's maplock, but both require map optimization.)
 

Akolyt0r

New Member
Reaction score
33
eeeehm ...such a thing would be totally pointless ...

AFAIK the war3map.j file gets rebuild every time the map is saved, so this protection thing would be removed by simply saving the map once ...
 

Jesus4Lyf

Good Idea™
Reaction score
397
Hey, what he's trying to do is completely valid. Commendable, even.

Yes, you can hide it by, after saving the map for the last time, extracting war3map.j, editing it, reimporting it, and what you added will be hidden. The problem is, when you save the map, war3map.j is recreated, meaning whatever you added (in this case, your protection) will be removed. So hiding protection in this way is redundant, sadly. :)

However, there are ways to make maps read only. I think I've seen it done once, but I forget how... Something you can import which will corrupt the map on save, but not before then...

PS. MapLock doesn't require optimization at all. But neither does it appear to work on battle.net at this point. In fact, I'm pretty sure saw's doesn't require it either, and is probably exactly what you want. The problem is if you hide it it will be removed on save (defeats the purpose) and if you don't, users can delete it if they know what it is. But they probably don't! :)
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
So I can't hide it in war3map.j, it will be removed when saved...

How about I make it harder to read by using some random textmacros?

@TriggerHappy
Thats a decent way to do it, except i dont feel like reprotecting it with each new version (team project)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top