GetSavingPlayer(), Testers Needed

Azlier

Old World Ghost
Reaction score
461
So, now that I've gone totally insane, I would like one more thing to be tested.

Online (LAN or Battle.net doesn't matter) would be nice, because I want to test if this desyncs. Or works at all.

Save the game, it's supposed to display the name of the player who saved it. If you get syntax errors, report them with the errors you get and which line it's on.

Note: This is terribly inefficient with some unnecessary handles. But it should work. Hopefully.

[lJASS]requires[/lJASS] Event
JASS:
library GetSavingPlayer initializer Init requires Event //Note to self: needs polishing.

globals
    private Event Ev
    private player SavingPlayer = null
    private unit array U
    private integer LocalId
endglobals

constant function GetSavingPlayer takes nothing returns player
    return SavingPlayer
endfunction

function TriggerRegisterGameSaved takes trigger t returns nothing
    call Ev.register(t)
endfunction

private function OnClick takes nothing returns boolean
    set SavingPlayer = GetOwningPlayer(GetTriggerUnit())
    call Ev.fire()
    ////////////////////////////////////////////
    call BJDebugMsg(GetPlayerName(SavingPlayer))
    ////////////////////////////////////////////
    set SavingPlayer = null
    return false
endfunction

private function OnSave takes nothing returns boolean
    call SelectUnit(U[LocalId], true)
    call SelectUnit(U[LocalId], false)
    return false
endfunction

private function Init takes nothing returns nothing
    local trigger t
    local integer i = 11
    set LocalId = GetPlayerId(GetLocalPlayer())
    set Ev = Event.create()
    loop
        set t = CreateTrigger()
        call TriggerRegisterGameEvent(t, EVENT_GAME_SAVE)
        call TriggerAddCondition(t, Condition(function OnSave))
        if GetLocalPlayer() != Player(i) then
            call DisableTrigger(t)
        endif

        set t = CreateTrigger()
        set U<i> = CreateUnit(Player(i), &#039;hfoo&#039;, 10000, 10000, 270)
        call PauseUnit(U<i>, true)
        call TriggerRegisterUnitEvent(t, U<i>, EVENT_UNIT_SELECTED)
        call TriggerAddCondition(t, Condition(function OnClick))
        exitwhen i == 0
        set i = i - 1
    endloop
endfunction

endlibrary</i></i></i>
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
It seems to be returning the right player, but I haven't had a chance to get more than 1 person to test with.
 

ZakkWylde-

New Member
Reaction score
14
:D:D

Thanks! I'll try this out...
I'll also try to get results of your other test back...

And uh...what does this need? Are you using KT2? (I'm noob at the extension languages)
 

Azlier

Old World Ghost
Reaction score
461
This needs Event. I gotta update the first post.

Just save the game in-game online, and tell me if it displays your name.

Have the other players save, too.
 

ZakkWylde-

New Member
Reaction score
14
Zzzz...
Where do I get Event?

I'm assuming that'll fix the problem of this saving...and returning

Missing Requirement: Event (libraries cannot require scopes)
 

Azlier

Old World Ghost
Reaction score
461
I linked it, you know. Twice.
 

ZakkWylde-

New Member
Reaction score
14
QQQQQ.

Yeah I found it...i was testing it :D
As it turns out, when Player 1 (blue) saved the game, it displayed both Player 0 and 1's names...So .... not quite working...I'll try and run a few more tests.
 

Azlier

Old World Ghost
Reaction score
461
Method 2 it is, then. Please stand by.

EDIT: Try it now.
 

ZakkWylde-

New Member
Reaction score
14
Unfortunately, it continues to display the names of all the players...

If 3 people are in the game, it displays all three from player 0 to player 2
...it always displays player 0's name first (if he's in the game)

EDIT: WRONG INFO...posting again.
 

Azlier

Old World Ghost
Reaction score
461
It needs a rewrite, yes it does. I need to try my third method. It'll be done in an hour or so.
 

ZakkWylde-

New Member
Reaction score
14
Ok, 3 people...

3 slots (2 people are on Force 1, one person is on Force 2) Red, Blue, Teal, respectively

Blue (second slot) saves. It shows Red's name, Blue's name, Teal's name.
Red (first slot) saves. It shows Red's name, Teal's name, Blue's name.
Teal (third slot) saves. It shows Red's name, Teal's name, Blue's name.

I'm not sure if it is the case that whoever saves has their name in second? (Unless its red?!?) :confused:

If so, that info could be used as well...

EDIT/Addition: Yo, Az, I'll be back later tonight...maybe in about 3-4 hours...so I'll be able to test once again at that time. Thanks again for the help. I really appreciate it.

EDIT #2: I figured it out -- its on the next page...I made sense of the information (a little bit of educated guessing, but the thought-pattern seems to follow sequentially and coherently)
 

Azlier

Old World Ghost
Reaction score
461
I now realize that... this won't work. :(

I can't come up with another method that would work.

This study can be postponed until further notice.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Just a random thought, but try using the GetDelay thing to calculate the ping, and base it off of that.

It's a completely random thought, and I'm thinking it won't work, but meh.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Bah I'm an idiot. That's what I get, posting half-awake. >.<
 

ZakkWylde-

New Member
Reaction score
14
Ok, 3 people...

3 slots (2 people are on Force 1, one person is on Force 2) Red, Blue, Teal, respectively

Blue (second slot) saves. It shows Red's name, Blue's name, Teal's name.
Red (first slot) saves. It shows Red's name, Teal's name, Blue's name.
Teal (third slot) saves. It shows Red's name, Teal's name, Blue's name.

I'm not sure if it is the case that whoever saves has their name in second? (Unless its red?!?) :confused:

If so, that info could be used as well...

EDIT/Addition: Yo, Az, I'll be back later tonight...maybe in about 3-4 hours...so I'll be able to test once again at that time. Thanks again for the help. I really appreciate it.

Uh...I figured it out...
Your script does work. It just has to differentiate between the person who INITIATED the save and everyone (who saves the game). Because everyone gets the save file, everyone's name shows up. And it shows up in the order that people save it (i.e., the names show up sequentially...about every .5 seconds...)

It seems the host saves it first and the person who initiated the save saves it second. Then the order (probably) goes from player 0 to player 11 excluding the two (or one, if host = saver) people who already have the save file.

Maybe this insight will help you out...if I totally understood your script, I could probably fiddle around with it to get it right.
 

Azlier

Old World Ghost
Reaction score
461
Fiddle away. I don't know how to act on "information" like that.
 

ZakkWylde-

New Member
Reaction score
14
...if I totally understood your script, I could probably fiddle around with it to get it right.

And there is the problem. I could spend some time going through Event I guess...but could you explain the basics OR could I come to ask you if I run into trouble?

But anyways, I was thinking along the lines of kicking the second name that shows, unlessssssss someway to figure out that is or isn't host who is saving...
This method doesn't make sense to you? =P I don't know if its possible or how many conditions it will require....if then if then?
 

Azlier

Old World Ghost
Reaction score
461
Well, Event doesn't really have anything to do with the script. Remove it, if you want.
 
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