| 08-27-2008, 10:17 PM | #1 |
So, I want to make it so you cannot play my map in single player mode, but i do want it to be able to be played over a lan game single player. This is to disable cheats. So, @ the start of the map I set up a number of functions that say: If player X = playing and slot status = used, then set (variable) true If variable = true, fire intro trigger, if not end game with message and defeat. This works fine if I wanted it to be NOT single player mode @ all. How do I set up something to say, if player 1 is only player in game, and is not threw custom game, then allow play? |
| 08-27-2008, 10:21 PM | #2 |
bj_isSinglePlayer Seems suspiciously easy, but I recall it working. If not: http://www.wc3jass.com/viewtopic.php?t=288 |
| 08-27-2008, 10:57 PM | #3 |
There are several ways to do this, basically based on functions acting differently. Gamecache has at least one I think, some returns boolean, probably to do with saving them, but I can't remember exactly which function. |
| 08-27-2008, 11:15 PM | #4 |
Ok, I have no idea how to read jass... So in that link does that save if in "single player mode" to a boolean variable? If it does, whats the name of it and how do I add that into a trigger? For Captain = I'll look into gamecache as well... |
| 08-28-2008, 12:22 AM | #5 |
Add this code: JASS:function isSinglePlayer takes nothing returns boolean local gamecache gc=InitGameCache("gc.w3v") call StoreInteger(gc,"test","test",9) return SaveGameCache(gc) endfunction To your map header, then create a variable called "SinglePlayer" or something. Now on map initialization have some custom script run like: Trigger: Custom script: set udg_SinglePlayer = isSinglePlayer()After it has been set SinglePlayer will be true if the game is in single player mode, false otherwise. |
| 08-28-2008, 03:25 AM | #6 |
| 08-28-2008, 03:29 AM | #7 |
Check the previous line that has code (not a blank line or comment // comment). Sometimes the Syntax Checker marks the wrong line and the error is actually on the line before. |
| 08-28-2008, 03:37 AM | #8 |
Well... I have a shit load of JASS stuff on the map and I think it's making it so I can't add anymore. I came to this conclusion by removing all the code and it worked, but I need the code that's in there for GUI triggers I have set up... I use WE Unlimited latest version and I have enabled the advanced triggers. ..I would show u all the crap but it's over 370060 characters and I can't post it... Does anyone know if you can convert this JASS trigger into a GUI one? |
| 08-28-2008, 04:19 AM | #9 |
There is no reason to ignore "bj_isSinglePlayer" variable. |
| 08-28-2008, 04:21 AM | #10 |
What do you mean? |
| 08-28-2008, 04:38 AM | #11 |
This function is useless: Code:
function isSinglePlayer takes nothing returns boolean
local gamecache gc=InitGameCache("gc.w3v")
call StoreInteger(gc,"test","test",9)
return SaveGameCache(gc)
endfunction |
| 08-28-2008, 04:42 AM | #12 |
Ok... Then can u post code or a trigger that accomplishes what I'm trying to do? |
| 08-28-2008, 05:58 AM | #14 |
no, the save native returns a boolean telling if it saved the cache sucessfully, something that cannot be achieved in GUI (except with custom script). Since you can't save caches on battle.net or lan, it will return false (cache never saved) so you can then assume the game is played in an environment that has cheats disabled. There is an issue though, if your cache data is full, you can't save another cache. The value was 255 caches, but the data system has since been changed, so it might be more or less. The point is, there is no 100% guarantee that a map is being played on battle.net with only 1 person. |
