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

Locked Screen Utility

Level 31
Joined
Jul 10, 2007
Messages
6,306
This needs updating. MFN is being updated big time atm with a lot of new features, so this will have to be changed for the updates. This will also including a few other interesting things that the new MFN allows you to do : ), including locking a unit to a player's screen rather than locking a player to a unit's screen : O. What does that allow? Arrow movements with 0 delay ^_^.

a simple locked screen utility for MFN.

Requires MFN v.01e CN15

This is v.01a CN2 ftw :D

Got rid of UPN call : O, lol.... i had it in there to make things easier to read and what not, but i forgot it was in there : O.

it works 100% and is very easy to use ^_^

default interval (how often it locks the screen) is 3.

It uses memory addresses for the units... so uhm...

JASS:
local integer unit = MFN.createVariable()
MFN.setVariable(unit, MFN_U2I(CreateUnit(blah blah)))

yea... ;p

or.. if you get the spiffy UPN utility, which isn't out yet, you can just do this

JASS:
set integer unit = UPN.createUnit(player, unittype, x, y, facing)

Description-
Locks a player's screen to a unit : )

LSN-
JASS:
scope LSjijahHG
    private keyword LSNStructure
    
    globals
        LSNStructure LSN
    endglobals
    
    private struct LSNStructure
        private static string SYSTEM = "LSN"
        private static string VERSION = ".01a"
        private static integer CN = 1
        
        private trigger run = CreateTrigger()
        private integer array unit[11]
        private real interval = .1
        
        private method require takes nothing returns nothing
            call MFN.requireSystem("MFN", 15)
        endmethod
        
        public method turnOff takes nothing returns nothing
            local integer x = 0
            call DisableTrigger(.run)
            loop
                if (.unit[x] != -1) then
                    if (GetLocalPlayer() == MFN.getPlayer(x)) then
                        call ResetToGameCamera(0)
                    endif
                endif
                set x = x + 1
                exitwhen x > MFN.players
            endloop
        endmethod
        
        public method turnOn takes nothing returns nothing
            call EnableTrigger(.run)
        endmethod
        
        public static method lock takes nothing returns nothing
            local integer x = 0
            local player p
            loop
                set p = MFN.getPlayer(MFN.playerID[x])
                if (LSN.unit[x] != -1) then
                    if (GetLocalPlayer() == p) then
                        call SetCameraTargetController(MFN_I2Unit(MFN.getVariableValue(LSN.unit[x])), 0, 0, false)
                    endif
                endif
                set x = x + 1
                exitwhen x > MFN.players
            endloop
        endmethod
        
        public method addPlayer takes player p, integer u returns nothing
            set .unit[MFN.getPlayerID(p)] = u
        endmethod
        
        public method removePlayer takes player p returns nothing
            set .unit[MFN.getPlayerID(p)] = -1
        endmethod
        
        public method setInterval takes real interval returns nothing
            set .interval = interval
            call DestroyTrigger(.run)
            set .run = null
            set .run = CreateTrigger()
            call DisableTrigger(.run)
            call TriggerRegisterTimerEvent(.run, .interval, true)
            call TriggerAddAction(LSN.run, function LSNStructure.lock)
        endmethod

        public static method create takes nothing returns LSNStructure
            set LSN = LSNStructure.allocate()
            call DisableTrigger(LSN.run)
            call TriggerRegisterTimerEvent(LSN.run, LSN.interval, true)
            call TriggerAddAction(LSN.run, function LSNStructure.lock)
            call MFN.registerSystem(LSN.SYSTEM, LSN.CN)
            call LSN.require()
            call createCreditMFN(LSN.SYSTEM, LSN.VERSION, "Nestharus", "None", "ReplaceableTextures\\CommandButtons\\BTNPeriapt1.blp", "Locked Screen Utility v"+ LSN.VERSION + " CN " + I2S(LSN.CN))
            return 0
        endmethod
    endstruct
endscope

LSN Diagnostics (normally disabled)-
JASS:
scope LSjijahHG
    private keyword LSNStructure
    
    globals
        LSNStructure LSN
    endglobals
    
    private struct LSNStructure
        private static string SYSTEM = "LSN"
        private static string VERSION = ".01a"
        private static integer CN = 1
        
        public method require takes nothing returns nothing
            call MFN.requireSystem("MFN", 15)
        endmethod
        
        public static method create takes real interval returns LSNStructure
            set LSN = LSNStructure.allocate()
            call MFN.registerSystem(LSN.SYSTEM, LSN.CN)
            call LSN.require()
            set MFN.diagonstics = true
            return 0
        endmethod
    endstruct
endscope

Usage Example-
In your MFN Interface, just put this in your utility area
JASS:
    public function utilityINI takes nothing returns nothing
        call LSN.create()
    endfunction

turn on locked by using the turnOn method
JASS:
LSN.turnOn()

turn off by using turnOff method
JASS:
LSN.turnOff()

add players/units by using addPlayer method : P
*Note* takes a memory address atm using virtual memory from MFN
JASS:
LSN.addPlayer(Player(0), 30)

remove a player with remove
JASS:
LSN.removePlayer(Player(0))

change interval to w/e with interval
*Note* Interval is how often it locks the screen
JASS:
LSN.setInterval(2)


There's a reason to keep the two if statements separate btw... : o
 

Attachments

  • LockedScreenUtility.w3m
    12.1 KB · Views: 55
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
#1- it does compile. I looked at MFN downloads and it was at 0, so you're still not using MFN : P.

Requires MFN v.01e CN12
That means it will not compile without MFN v.01e CN12, or it might but it won't work right : ).

#2-
Kamera - Lock camera target for Spieler 1 (Rot) to (Triggering unit), offset by (0.00, 0.00) using Vorgabe-Drehung

That's why I said it was very simple : ). This just allows you to turn it on, turn it off, add and remove players for units, and set the interval for keeping it locked to disable CTRL + C.

If you ever do locked screen for units, this is the utility to use ; ).

EDIT-
Oh woops, I see a UPN call in there... hmm.. apparently it requires UPN as well : O.

JASS:
UPN.getUnit(LSN.unit[x])

EIDT 2-
Got rid of UPN call : P
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
resp-
I donwloaded LockedScreenUtility.w3x
==> Didn't compile.
maybe you reuploaded?

Requires MFN v.01e CN12

I said that 3x now? I also said that in the first post? And I said this was designed to work with MFN? And I have MFN working with this and it compiles?

MFN

resp-
Ah, and you can also unlock the camera easily. There is absolutely no sense for this.

it makes it easier and adds functionality that you'd normally have to do by hand : P. Once again, I said this was a *Very* simple *utility* : P.

From post #1
a simple locked screen utility for MFN.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
So, I know this will never happen, but I'm throwing it out there...

let's say you have 10 megs worth of systems. You want another system that requires all of those, so you have to download all 10 megs again. You want another, so another 10 megs, etc, etc.

Or, you can have 1 system by itself nice and organized and just download system by system ; ).

Download everything again and again or download one thing at a time? That is the question : P
 
So, I know this will never happen, but I'm throwing it out there...

let's say you have 10 megs worth of systems. You want another system that requires all of those, so you have to download all 10 megs again. You want another, so another 10 megs, etc, etc.

Or, you can have 1 system by itself nice and organized and just download system by system ; ).

Download everything again and again or download one thing at a time? That is the question : P

Just add the demo map, or else nobody is going to use/test this.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Oh, that's a good idea.. add a demo map ^_^

Wasn't thinking about that ; P. I'll do it soon ok, rawr. I'm reworking a lot of MFN at the moment though... I kept adding more and more stuff to it and it got to be a headache to read. I'm also optimizing a few things o-o. On a final note, I think I've figured out a really good way to do multi-threaded looping to prevent loop crashes >: D, and I increased the system capacity from 500 to 40,000 by changing other things around : O. Just a lot has change : ).

But yea, sry if you got the wrong idea MapperMalte. That download wasn't a test map or a demo map. It was a utility release so you could just copy the system and paste it into your map =P.
 
Top