• 🏆 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!

LAN Map only help

Status
Not open for further replies.
Level 14
Joined
Nov 30, 2013
Messages
926
As the title explained, I want to have a map which it's only worked in LAN games.
Like a map called "Fortress Survival", it causes the game to crash when playing it in "Single Player".
But playing it by yourself when playing it in LAN/Online, it won't crash.

I'm unsure how they did that but it would be great to hear a solution or an advice. :csmile:

EDITED:

Well the way that I want is not when it detect a player playing in Singleplayer, it will cause the game crash.
Rather than that, I only want a trigger to detect whenever a player is playing it in Singleplayer like insta-defeat.
 
Last edited:
Level 12
Joined
May 22, 2015
Messages
1,051
I am not sure if you can detect this.

I have a hunch, though. Are you trying to stop them from using cheats? Like, you don't want them to just see the whole map or get infinite money and do stupid things?

You could add a trigger that detects when a player types one of those messages and instantly defeat that player if they do. Just an idea.
 
Level 3
Joined
Jun 3, 2009
Messages
53
You could add a trigger that detects when a player types one of those messages and instantly defeat that player if they do. Just an idea.

IIRC it's not so simple because when a player types a cheat and the game recognizes it as such, it doesn't recognize it as a chat message, and so the event "player types a chat message" can't catch it.
 
Level 12
Joined
May 22, 2015
Messages
1,051
IIRC it's not so simple because when a player types a cheat and the game recognizes it as such, it doesn't recognize it as a chat message, and so the event "player types a chat message" can't catch it.

Damn. That makes it a lot more complicated :(

Checking for all the cheats with periodic checks might work, but that is gonna be a big, ugly chunk of code that wastes a decent amount of processing power lol.
 
Level 12
Joined
May 22, 2015
Messages
1,051
You can detect

Whosyourdaddy:

Create a tower and an enemy unit with high hp regeneration.
Order the tower to attack the enemy unit.
If the unit dies, the cheat is enabled.

Ya I was thinking this kind of stuff would work.

However, it would be expensive to detect all cheats. Though, I think you can at least detect the ones that will ruin your map (such as iseedeadpeople when your map is a mystery or something and seeing the whole map might ruin it).
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
Correct, not all cheats can be disabled, example that cheat that allow a heroes to learn an ability that require level 6 while his hero is just level 2, you can do nothing after that, specily if it's a campaign that will ruin the entire experience of your hero (Ability Level)
As, for the "Iseedeadpeople" cheat, it still can be disabled, but the playable map area will still have vision in the minimap, but you can use " Create a Black fading arround playable map area..." and turn the minimap to black, but still, you'll lose your last visited area vision.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Correct, not all cheats can be disabled, example that cheat that allow a heroes to learn an ability that require level 6 while his hero is just level 2, you can do nothing after that, specily if it's a campaign that will ruin the entire experience of your hero (Ability Level)
As, for the "Iseedeadpeople" cheat, it still can be disabled, but the playable map area will still have vision in the minimap, but you can use " Create a Black fading arround playable map area..." and turn the minimap to black, but still, you'll lose your last visited area vision.

Well I mean you can just make the player lose in defeat if they use a cheat.

I think you can probably check for all of them, but it would have some annoying triggers running for no reason when people are not cheating. You can at least destroy the triggers if there are multiple players.
 
Level 11
Joined
Dec 19, 2012
Messages
411
There is a native function which could force cheat to be called :native Cheat takes string cheatStr returns nothing

Example :
call Cheat("greedisgood 1000000")
would make all player resources to be maximum.

Using this could detect whether a player is plying in single player or LAN (that native wouldn't works in LAN), so you can do like this :

JASS:
function func takes nothing returns nothing
	call DestroyTimer(GetExpiredTimer())
	if GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) == 1000000 then
		//here you found out player playing in single player mode
	else
		//here you found out player plying in LAN mode
	endif
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
	call Cheat("greedisgood 1000000")
	call TimerStart(CreateTimer(), 0., false, function func)
endfunction
 
Level 12
Joined
May 22, 2015
Messages
1,051
There is a native function which could force cheat to be called :native Cheat takes string cheatStr returns nothing

Example :
call Cheat("greedisgood 1000000")
would make all player resources to be maximum.

Using this could detect whether a player is plying in single player or LAN (that native wouldn't works in LAN), so you can do like this :

JASS:
function func takes nothing returns nothing
	call DestroyTimer(GetExpiredTimer())
	if GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) == 1000000 then
		//here you found out player playing in single player mode
	else
		//here you found out player plying in LAN mode
	endif
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
	call Cheat("greedisgood 1000000")
	call TimerStart(CreateTimer(), 0., false, function func)
endfunction

If that works, that's a brilliant solution.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Why bother doing all this when you can simply detect when multiplayer mode is run? All you need to do then is disable all code based save/load systems when in single player and they cannot cheat. Look at SWAT Aftermath for example.

Like a map called "Fortress Survival", it causes the game to crash when playing it in "Single Player".
I am guessing that is a bug. All crashes are bugs. I would recommend reporting it to the map creator to fix or a moderator to reject the map.

Rather than that, I only want a trigger to detect whenever a player is playing it in Singleplayer like insta-defeat.
Which is equally bad practice. If people want to play singleplayer then let them, just disable code based save/load and warn them that their experience might be ruined if they cheat.

Any way this function returns true if single player (custom game/test) and false if multiplayer (LAN/BattleNet).

JASS:
function isSinglePlayerMode takes nothing returns boolean
    local gamecache gc=InitGameCache("spcheck.w3v")
    call StoreInteger(gc,"test","test",9)
    return SaveGameCache(gc)
endfunction

It operates because of SaveGameCache. That returns true if the game cache save was successful (single player mode) and false if it failed (multiplayer mode like LAN).

Credits go to SWAT Aftermath map for the snippet. I pulled it from their script.
 
Level 14
Joined
Nov 30, 2013
Messages
926
Thanks for your help Dr Super Good. I'll try this later.

Well there's something shown up at the screen which is unseenable if you play it at the LAN before it crashed so therefore, it has it own trigger which identify whether a player is playing at Singleplayer or LAN. Also, you can't reject the map. It has it own site as well which can be seen below the page

EDITED
Tried this and it worked! DD_legionTN's solution probably works as well.. :cgrin:
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Well there's something shown up at the screen which is unseenable if you play it at the LAN before it crashed so therefore, it has it own trigger which identify whether a player is playing at Singleplayer or LAN. Also, you can't reject the map. It has it own site as well which can be seen below the page
No map should crash. Any crashes must be reported as bugs.

The only exception that can be made is for map hacking related crashes as a result of hidden corrupted models since you are then cheating anyway. That said they should be disabled in single player (the models are not used) and the game should still not crash when playing single player. Like wise purposely induced crashes as a result of tamper protection should also be allowed, since if the map is crashing from them it was modified without consent anyway so should not be distributed.

There is nothing clever about a crash. Crashes are bad and show bad creation skills.
 
Level 14
Joined
Nov 30, 2013
Messages
926
I never mentioned that crashes are good, I already knew that they were bad.
They must have did something wrong through their triggers because there's no corrupted files through their import during playing it in LAN.
Most of their imported icons, models, and etc are mostly used in their map but it isn't cause the problem.
The creator of that map will more likely to ignore that situation only for some reason.

Also, I can respect the advices you gave for me. I really appreciate it.
 
Status
Not open for further replies.
Top