Author Topic: [PSX/PC] General editor - Hades Workshop (0.41f)  (Read 690001 times)

Bonez

  • Cosmo Memory Dev
  • Global moderator
  • *
  • Posts: 132
  • What goes here?
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1850 on: 2022-06-02 07:38:53 »
@Trilititi helooo ??? fucking answer you dick , this bullshit about ignore people's messages must end once and for all

 ::) Couldn't wait 5 whole days for a reply... @Tirlititi don't worry about answering him. He obviously has issues. He's already been banned before for this exact reason. He subverted the ban but is gone again.

Normally I would have deleted his last post and just banned him quietly, but considering he wrote you a novel, I didn't want you to put any work or thought into any replies to him without being aware.
« Last Edit: 2022-06-02 08:04:06 by Bonez »

Tirlititi

  • *
  • Posts: 789
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1851 on: 2022-06-02 10:31:21 »
I am obviously not going to answer his new questions.

@carl09876: I don't know what is your age or your situation, so I'm not going to lecture you on how to behave, on the internet or elsewhere. I'll only say that, without even considering the insult, I have been thinking that you don't pay attention to what people write to you and mostly ignore them. It is very dishonest of you to accuse someone else of doing that.

Seramera

  • *
  • Posts: 3
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1852 on: 2022-06-10 16:53:02 »
Hello,
working with field scripts right now. I want to make a window on the bottom of the screen, which shows a token string of a random field that the field exit will lead to.
Now the textwindow should disappear when the player leaves the Region on the walkmesh, but that is kinda hard to handle since there is no boolean "isinregion" or sth like that.
this is my approach so far:
region range loop opening textbox if globool1 false, set true then
Code: [Select]
Function Region16_Range
    if ( VAR_GlobBool_1 == 0 ) {
        SetTextVariable( 0, 1 )
        WindowAsync( 0, 4, 9 )
        set VAR_GlobBool_1 = 1
    }
    return

loop code for globool1 waiting ticks until its set false
Code: [Select]
Function Code1_Loop
    if ( VAR_GlobBool_1 == 1 ) {
        set VAR_GlobUInt8_1++
    }
    if ( VAR_GlobUInt8_1 == 59 ) {
        set VAR_GlobBool_1 = 0
        set VAR_GlobUInt8_1 = 0
    }
    Wait( 1 )
    loop
Code: [Select]
[STRT=160,1][TAIL=LOC][IMME]press x to go to[WDTH=0,160,6,0,-1][TEXT=0,0][TIME=60]
if anyone know if there is a better way, im glad to read.

less important Question1: im declaring global and local variables, which i dont see written in the edited field script. like globool_1 in this case. Might it be used in the backengine?
less important Question2: came up bcs i saw, especially in the worldmap scripts, stuff going on not happening in the scripts, like the alexandria worldmap model dependency on the scenariocounter, which is not articulated in the script.

less important Question3: Is there a way to edit 300:IceCavern Entrance or Daguerro? they seem independent
less important Question4: Is there a way to edit "field" 70 to have the "new game" button open an other field than 50:Primavista, as of now when i edit it i cant save the mod in .hws
« Last Edit: 2022-06-10 17:02:25 by Seramera »

Seramera

  • *
  • Posts: 3
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1853 on: 2022-06-10 17:32:38 »
also here is a rather lazy written code for a world moogle dialog option that will get you around town and change scenario counter. applies to WorldMap:Hilda Garde 3. just take care you hit the spot and not get lost in the void ;D
Code: [Select]
Function World_Moogle_27
    RunWorldCode( 35, 1 )
    set VAR_LocUInt8_20 = GetData_199
    set VAR_LocUInt8_19 = GetRandom
    set VAR_LocUInt8_0 = ( 192 - ( VAR_LocUInt8_20 + VAR_LocUInt8_19 ) )
    TurnInstant( Op60(ObjectUID_250) )
    set VAR_LocUInt8_21 = 1
    set VAR_LocUInt8_22 = 0
    while ( VAR_LocUInt8_22 < 10 ) {
        set VAR_LocInt24_1 = ( ( Cos(VAR_LocUInt8_0) * 2 ) + ( ( ( Cos(VAR_LocUInt8_0) * 4 ) - ( Cos(VAR_LocUInt8_0) * 2 ) ) / VAR_LocUInt8_21 ) )
        set VAR_LocInt24_4 = ( ( Sin(VAR_LocUInt8_0) * 2 ) + ( ( ( Sin(VAR_LocUInt8_0) * 4 ) - ( Sin(VAR_LocUInt8_0) * 2 ) ) / VAR_LocUInt8_21 ) )
        MoveInstantXZY( GetEntryPosX(250) + VAR_LocInt24_1, GetEntryPosZ(255), GetEntryPosY(250) + VAR_LocInt24_4 )
        set VAR_LocUInt8_21 = ( VAR_LocUInt8_21 + 1 )
        if ( VAR_LocUInt8_22 == 0 ) {
            MoveInstantXZY( GetEntryPosX(250) + VAR_LocInt24_1, 2000, GetEntryPosY(250) + VAR_LocInt24_4 )
        } else {
            SetObjectFlags( 7 )
        }
        Wait( 1 )
        set VAR_LocUInt8_22++
    }
    set VAR_LocInt24_1 = ( Cos(VAR_LocUInt8_0) * 2 )
    set VAR_LocInt24_4 = ( Sin(VAR_LocUInt8_0) * 2 )
    MoveInstantXZY( GetEntryPosX(250) + VAR_LocInt24_1, GetEntryPosZ(255), GetEntryPosY(250) + VAR_LocInt24_4 )
    SetObjectFlags( 7 )
    set VAR_LocInt24_7 = ( Cos(VAR_LocUInt8_0) / 3 )
    set VAR_LocInt24_10 = ( Sin(VAR_LocUInt8_0) / 3 )
    RunScriptAsync( 4, 4, 34 )
    InitWalk(  )
    Walk( GetEntryPosX(250) + VAR_LocInt24_7, GetEntryPosY(250) + VAR_LocInt24_10 )
    SetWalkSpeed( 60 )
    RunScriptAsync( 4, 4, 35 )
    TurnInstant( GetEntryAngle(7) - 64 )
    RunAnimation( 6151 )
    set VAR_LocInt24_13 = ( Cos(VAR_LocUInt8_0) / 8 )
    set VAR_LocInt24_16 = ( Sin(VAR_LocUInt8_0) / 8 )
    InitWalk(  )
    Walk( GetEntryPosX(250) + VAR_LocInt24_13, GetEntryPosY(250) + VAR_LocInt24_16 )
    set VAR_LocInt8_25 = 0
    while ( VAR_LocInt8_25 >= 0 ) {
        RunWorldCode( 16, 6 )
        RunWorldCode( 17, 126 )
        RunWorldCode( 20, 0 )
        WindowAsync( 5, 4, 42 )
        do {
            Wait( 1 )
        } while ( !IsButton(196608L) )
        CloseWindow( 5 )
        if ( ( GetDialogChoice == 3 ) && IsButton(131072L) ) {
            RunWorldCode( 16, 39 )
            RunWorldCode( 17, 126 )
            RunWorldCode( 20, 0 )
        }
        switch 4 ( GetDialogChoice ) from 0 {
        case +0:
            set VAR_LocUInt8_24 = 0
            RunWorldCode( 16, 39 )
            RunWorldCode( 17, 126 )
            RunWorldCode( 20, 0 )
            WindowAsync( 5, 4, 43 )
            do {
                Wait( 1 )
            } while ( !IsButton(196608L) )
            CloseWindow( 5 )
            if ( ( GetDialogChoice == 1 ) && IsButton(131072L) ) {
                RunWorldCode( 16, 39 )
                RunWorldCode( 17, 126 )
                RunWorldCode( 20, 0 )
            }
            switch 2 ( GetDialogChoice ) from 0 {
            case +0:
                RunWorldCode( 16, 5 )
                RunWorldCode( 17, 126 )
                RunWorldCode( 20, 0 )
                WindowSync( 5, 4, 45 )
                while ( GetData_200 ) {
                    Wait( 1 )
                }
                RunWorldCode( 39, 0 )
                Menu( 4, 0 )
                RunWorldCode( 40, 0 )
                set VAR_LocUInt8_23 = 2
                break
            case +1:
                set VAR_LocUInt8_23 = 1
                break
            }
            break
        case +1:
            set VAR_LocUInt8_24 = 0
            RunWorldCode( 16, 39 )
            RunWorldCode( 17, 126 )
            RunWorldCode( 20, 0 )
            set VAR_GlobUInt8_42 = GetItemCount(253)
            if ( !VAR_GlobUInt8_42 ) {
                WindowSync( 5, 4, 46 )
            } else {
                SetTextVariable( 1, VAR_GlobUInt8_42 )
                WindowAsync( 5, 4, 44 )
                do {
                    Wait( 1 )
                } while ( !IsButton(196608L) )
                CloseWindow( 5 )
                if ( ( GetDialogChoice == 1 ) && IsButton(131072L) ) {
                    RunWorldCode( 16, 39 )
                    RunWorldCode( 17, 126 )
                    RunWorldCode( 20, 0 )
                }
                switch 2 ( GetDialogChoice ) from 0 {
                case +0:
                    RemoveItem( 253, 1 )
                    RunScriptAsync( 5, 4, 37 )
                    FadeFilter( 2, 24, 0, 255, 255, 255 )
                    Wait( 25 )
                    RunScriptAsync( 5, 7, 38 )
                    RunScriptAsync( 5, 250, 38 )
                    RunScriptSync( 5, 10, 40 )
                    FadeFilter( 3, 16, 0, 0, 0, 0 )
                    Wait( 40 )
                    FadeFilter( 2, 24, 0, 255, 255, 255 )
                    Wait( 25 )
                    RunScriptAsync( 5, 10, 41 )
                    RunScriptAsync( 5, 7, 39 )
                    RunScriptSync( 5, 250, 39 )
                    FadeFilter( 3, 16, 0, 0, 0, 0 )
                    Wait( 20 )
                    set VAR_LocUInt8_23 = 2
                    break
                case +1:
                    set VAR_LocUInt8_23 = 1
                    break
                }
            }
            break
        case +2:
            WindowAsync( 5, 4, 90 )
            do {
                Wait( 1 )
            } while ( !IsButton(196608L) )
            CloseWindow( 5 )
            if ( ( GetDialogChoice == 1 ) && IsButton(131072L) ) {
                RunWorldCode( 16, 39 )
                RunWorldCode( 17, 126 )
                RunWorldCode( 20, 0 )
            }
//Dialog Option starts here
            switch 2 ( GetDialogChoice ) from 0 {
            case +0:
                set VAR_LocInt24_2 = 0
                set VAR_LocInt24_5 = 1
                set VAR_LocInt24_6 = 0
                SetTextVariable( 5, VAR_LocInt24_2 )
                SetTextVariable( 6, VAR_LocInt24_5 )
                SetTextVariable( 4, General_ScenarioCounter )
                WindowAsync( 5, 4, 10 )
                do {
                    if ( IsButton(16) ) {
                        if ( VAR_LocInt24_5 == 1000 ) {
                            set VAR_LocInt24_5 = 1000
                        }
                        if ( VAR_LocInt24_5 == 100 ) {
                            set VAR_LocInt24_5 = 1000
                        }
                        if ( VAR_LocInt24_5 == 10 ) {
                            set VAR_LocInt24_5 = 100
                        }
                        if ( VAR_LocInt24_5 == 1 ) {
                            set VAR_LocInt24_5 = 10
                        }
                        SetTextVariable( 6, VAR_LocInt24_5 )
                    }
                    if ( IsButton(64) ) {
                        if ( VAR_LocInt24_5 == 1 ) {
                            set VAR_LocInt24_5 = 1
                        }
                        if ( VAR_LocInt24_5 == 10 ) {
                            set VAR_LocInt24_5 = 1
                        }
                        if ( VAR_LocInt24_5 == 100 ) {
                            set VAR_LocInt24_5 = 10
                        }
                        if ( VAR_LocInt24_5 == 1000 ) {
                            set VAR_LocInt24_5 = 100
                        }
                        SetTextVariable( 6, VAR_LocInt24_5 )
                    }
                    if ( IsButton(128) ) {
                        set VAR_LocInt24_2 = ( VAR_LocInt24_2 - VAR_LocInt24_5 )
                        SetTextVariable( 5, VAR_LocInt24_2 )
                    }
                    if ( IsButton(32) ) {
                        set VAR_LocInt24_2 = ( VAR_LocInt24_2 + VAR_LocInt24_5 )
                        SetTextVariable( 5, VAR_LocInt24_2 )
                    }
                    if ( IsButton(8) ) {
                        set General_ScenarioCounter = VAR_LocInt24_2
                    }
                    Wait( 1 )
                } while ( !IsButton(196608L) )
                break
            case +1:
                set VAR_LocInt24_2 = 0
                set VAR_LocInt24_5 = 1
                set VAR_LocInt24_6 = 0
                SetTextVariable( 5, VAR_LocInt24_2 )
                SetTextVariable( 6, VAR_LocInt24_5 )
                WindowAsync( 5, 4, 9 )
                do {
                    if ( IsButton(16) ) {
                        if ( VAR_LocInt24_5 == 1000 ) {
                            set VAR_LocInt24_5 = 1000
                        }
                        if ( VAR_LocInt24_5 == 100 ) {
                            set VAR_LocInt24_5 = 1000
                        }
                        if ( VAR_LocInt24_5 == 10 ) {
                            set VAR_LocInt24_5 = 100
                        }
                        if ( VAR_LocInt24_5 == 1 ) {
                            set VAR_LocInt24_5 = 10
                        }
                        SetTextVariable( 6, VAR_LocInt24_5 )
                    }
                    if ( IsButton(64) ) {
                        if ( VAR_LocInt24_5 == 1 ) {
                            set VAR_LocInt24_5 = 1
                        }
                        if ( VAR_LocInt24_5 == 10 ) {
                            set VAR_LocInt24_5 = 1
                        }
                        if ( VAR_LocInt24_5 == 100 ) {
                            set VAR_LocInt24_5 = 10
                        }
                        if ( VAR_LocInt24_5 == 1000 ) {
                            set VAR_LocInt24_5 = 100
                        }
                        SetTextVariable( 6, VAR_LocInt24_5 )
                    }
                    if ( IsButton(128) ) {
                        set VAR_LocInt24_2 = ( VAR_LocInt24_2 - VAR_LocInt24_5 )
                        SetTextVariable( 5, VAR_LocInt24_2 )
                    }
                    if ( IsButton(32) ) {
                        set VAR_LocInt24_2 = ( VAR_LocInt24_2 + VAR_LocInt24_5 )
                        SetTextVariable( 5, VAR_LocInt24_2 )
                    }
                    if ( IsButton(8) ) {
                        Field( VAR_LocInt24_2 )
                    }
                    Wait( 1 )
                } while ( !IsButton(196608L) )
                break
            }
            break
        case +3:
            switch 2 ( VAR_LocUInt8_23 ) from 1 {
            case +0:
                WindowAsync( 5, 4, 47 )
                break
            case +1:
                WindowAsync( 5, 4, 48 )
                break
            default:
                if ( VAR_LocUInt8_24 < 8 ) {
                    WindowAsync( 5, 4, 50 )
                } else {
                    if ( VAR_LocUInt8_24 == 8 ) {
                        WindowAsync( 5, 4, 51 )
                    } else {
                        if ( VAR_LocUInt8_24 == 12 ) {
                            WindowAsync( 5, 4, 52 )
                        } else {
                            if ( VAR_LocUInt8_24 >= 16 ) {
                                WindowAsync( 5, 4, 49 )
                            } else {
                                WindowAsync( 5, 4, 50 )
                            }
                        }
                    }
                }
                break
            }
            if ( ( !VAR_LocUInt8_23 ) && ( VAR_LocUInt8_24 < 32 ) ) {
                set VAR_LocUInt8_24 = ( VAR_LocUInt8_24 + 1 )
            }
            RunScriptSync( 5, 7, 42 )
            set VAR_LocInt8_25 = 65535
            set VAR_LocUInt8_23 = 0
            break
        }
        Wait( 1 )
    }
    return
Code: [Select]
[STRT=167,5][TAIL=DEFT][WDTH=0,61,64,0,64,1,-1][IMME][D06050][HSHD] [C8B040][HSHD]Set Field()
[68C0D8][HSHD]New=[NUMB=5], Increment=[NUMB=6]
[DBTN=START]: Overwrite[TIME=-1]
Code: [Select]
[STRT=167,5][TAIL=DEFT][WDTH=0,61,64,0,64,1,-1][IMME][D06050][HSHD] [C8B040][HSHD]Set Scenario Counter()
[68C0D8][HSHD]Old=[NUMB=4], New=[NUMB=5], Increment=[NUMB=6]
[DBTN=START]: Overwrite[TIME=-1]
Code: [Select]
[STRT=136,3][TAIL=UPC][PCHC=2,1][IMME]Debug?
[CHOO][MOVE=18,0]Scenario Counter
[MOVE=18,0]Field[TIME=-1]
« Last Edit: 2022-06-10 18:20:22 by Seramera »

Tirlititi

  • *
  • Posts: 789
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1854 on: 2022-06-13 08:54:25 »
Hi Seramera,
Congrats on doing all that already. That's really neat.

Many script variables are indeed used by the back engine. The scenario counter (General_ScenarioCounter) is used indeed a lot (for city destroyed and whether Iifa roots expand to post-Terra spots on the World Map, but also whether Garnet has long or short hair and surely I'm missing some). The friendly flags (FriendlyMonster_Progress and the first bit of Ragtime_QuizzSuccess) disable the possibility to encounter those friendly monsters. The pepper spot flags (Chocobo_ParadiseFound and Chocobo_MognetFound) change the appearance of the entrance on the world map etc...
The "General" variables are usually the ones used by the engine. It sometimes happens that the engine fetch local or global variables for "hotfixes", especially on the Steam version of the game. At the end of the day, that's very rare though so you'll most likely never get to one of these instances. Here's an example of such hotfix that can be found in the engine's source code: it increases the score of the Blank sword fight minigame by checking that the field map is 64 (A. Castle/Public Seats), that the running script is a function of the object 4 (Code4_Init or Code4_Loop) and even the exact binary position of the code executed (after the normal score is computed but before the "SetTextVariable" line). So you can see in that example that hotfixes are very specific: you'll almost surely won't have issues because of them. Also, these hotfixes aside, script variables (local or global) are never used by the engine so you can't mess with it by using "VAR_GlobBool_1" especially if it weren't used in the field's script already.

I don't have a complete list of these hotfixes or how the engine uses general-type variables for purposes like the ones you spotted.
Unfortunatly, these uses are spread in the code and hard to interpret.

I don't understand your 3rd question. Ice Cavern's Entrance and Daguerro's field scripts should be editable like any other. I'll check if there is a problem with these but there shouldn't.

I am currently working on an update of the tool that will fix the issues with the field 70: Opening for FMV (among other things).

I don't know of a better way to check if the player character is in the region. I think that your solution is actually the best suited and fits with the spirit of programming tricks they usually used.

(By the way, Global-type variables can be used up to index 79. If you use "VAR_GlobUInt8_80", it will get out of the array range and probably at least throw an exception on Steam, effectively at least terminating the script function, or have an unexpected behaviour on the PSX version. I'm not sure if that limit is documented correctly in the tool.)

Seramera

  • *
  • Posts: 3
    • View Profile
Re: [PSX/PC] General editor - Hades Workshop (0.41f)
« Reply #1855 on: 2022-06-18 04:13:53 »
Hello Tirlititi,
thank you for the elaborate answer.
Having built the Randomizer and other stuff, I indeed found out some Variables are used in the back engine.
It got me burst out laughing when i suddenly swapped control with the npc I interacted with. Bugs can be funny creatures. :-D

So the method (that works for me now) is to look for Variables that are already used on the field, but dont interfere with the added use, instead of searching for unused variables.

Here is a little Speak Script that i use to test Battles.

Code: [Select]
Function YoungWomanB_SpeakBTN
    ifnot ( IsMovementEnabled ) {
        return
    }
    set VAR_GlobBool_158 = 0
    if ( VAR_GlobBool_159 == 1 ) {
        DisableMove(  )
        if ( VAR_GlobBool_144 == 0 ) {
            DisableMenu(  )
        } else {
            Wait( 1 )
        }
    }
    SetTriangleFlagMask( 127 )
    WaitTurn(  )
    set VAR_GlobUInt8_16 = GetEntryAngle(255)
    TurnTowardObject( 250, 32 )
    WaitTurn(  )
    WindowSync( 5, 2, 2 )
    switch 1 ( GetDialogChoice ) from 0 {
    case +0:
        set VAR_GlobInt16_6 = 0
        set VAR_GlobInt16_4 = 1
        set VAR_GlobBool_21 = 0
        SetTextVariable( 4, VAR_GlobBool_21 )
        SetTextVariable( 5, VAR_GlobInt16_6 )
        SetTextVariable( 6, VAR_GlobInt16_4 )
        WindowAsync( 5, 4, 3 )
        do {
            if ( IsButton(16) ) {
                if ( VAR_GlobInt16_4 == 1000 ) {
                    set VAR_GlobInt16_4 = 1000
                }
                if ( VAR_GlobInt16_4 == 100 ) {
                    set VAR_GlobInt16_4 = 1000
                }
                if ( VAR_GlobInt16_4 == 10 ) {
                    set VAR_GlobInt16_4 = 100
                }
                if ( VAR_GlobInt16_4 == 1 ) {
                    set VAR_GlobInt16_4 = 10
                }
                SetTextVariable( 6, VAR_GlobInt16_4 )
            }
            if ( IsButton(64) ) {
                if ( VAR_GlobInt16_4 == 1 ) {
                    set VAR_GlobInt16_4 = 1
                }
                if ( VAR_GlobInt16_4 == 10 ) {
                    set VAR_GlobInt16_4 = 1
                }
                if ( VAR_GlobInt16_4 == 100 ) {
                    set VAR_GlobInt16_4 = 10
                }
                if ( VAR_GlobInt16_4 == 1000 ) {
                    set VAR_GlobInt16_4 = 100
                }
                SetTextVariable( 6, VAR_GlobInt16_4 )
            }
            if ( IsButton(128) ) {
                set VAR_GlobInt16_6 = ( VAR_GlobInt16_6 - VAR_GlobInt16_4 )
                SetTextVariable( 5, VAR_GlobInt16_6 )
            }
            if ( IsButton(32) ) {
                set VAR_GlobInt16_6 = ( VAR_GlobInt16_6 + VAR_GlobInt16_4 )
                SetTextVariable( 5, VAR_GlobInt16_6 )
            }
            if ( IsButton(8) ) {
                if ( VAR_GlobBool_21 == 0 ) {
                    set VAR_GlobBool_21 = 1
                    SetTextVariable( 4, VAR_GlobBool_21 )
                } else {
                    set VAR_GlobBool_20 = 0
                    SetTextVariable( 4, VAR_GlobBool_21 )
                }
            }
            Wait( 1 )
        } while ( ( !IsButton(196608L) )  )
        break
    default:
        break
    }
    Wait( 5 )
    if ( VAR_GlobBool_21 == 1 ) {
        Battle( 0, VAR_GlobInt16_6 )
    }
    CloseAllWindows(  )
    0xA9( 250 )
    set VAR_GlobBool_158 = 1
    if ( VAR_GlobBool_159 == 1 ) {
        if ( VAR_GlobBool_156 == 0 ) {
            EnableMove(  )
            SetTriangleFlagMask( 255 )
            if ( VAR_GlobBool_144 == 0 ) {
                EnableMenu(  )
            }
        }
    }
    TimedTurn( VAR_GlobUInt8_16, 16 )
    WaitTurn(  )
    return
Code: [Select]
[STRT=100,3][IMME]What u wanna do?
[CHOO=2,1] Go Battle
Nothing
Code: [Select]
[STRT=200,4] [IMME]Increment: [NUMB=6] Destination: [NUMB=5]
startbattlebool: [NUMB=4] (0=no, 1=yes)
[JCBT=START] change startbattlebool
[JCBT=UP] [JCBT=DOWN]Increment[JCBT=LEFT] [JCBT=RIGHT]Destination

I'll report when I'm stuck elsewhere or have finished sth playable.
« Last Edit: 2022-06-18 05:30:52 by Seramera »