#Model Replacement API & SDK
6053 messages · Page 7 of 7 (latest)
so itll always be true since no matter what everyone will have the code run and itll be like yup you are wearing the suit youre wearing
i must just be fundamentally misunderstanding how this code is run or something
as its inside of Start() it will run after the object is created for each client so yes
yeah so how do i only run it for the player who equipped the suit
ye
i just remembered because its all a local spawn
what you tryng to do with this btw?
camera height adjustments
currently when someone equips a suit its meant to adjust your camera height but it does it to everyone
so i want that code to only run for the player who equipped that suit
well you could add a check for if the local player suitID is the suitid of the suit
or well the suitname in your case
as that probs be more accurate
how would i check that though? like how does the code know its that suit
since that function runs for everyone regardless of what suit theyre wearing
if (StartOfRound.Instance.unlockablesList.unlockables[player.currentSuitID].unlockableName.Equals("Default") ||
StartOfRound.Instance.unlockablesList.unlockables[player.currentSuitID].unlockableName.Equals("Orange suit"))
so in the player spot you put in the localplayer
and for the.equals the suit name you want
aka you can modify this to feed of the config for the suit ya know
like this..?
move the model replacement part to the line below it tabbed once
it should auto do it when you add a enter to it but ye
just makes it more clear to read what the if statement is doing
oh neat
but other than that it will prevent your function from executing on other clients
actually maybe i can just do this
so i dont have to keep retyping the name multiple times for each of the 100 suits
and every new suit i add
either works if you got a config use the config value for the suit
nope no configs
and you could just make the entire thing into a function call ya know
where you just feed in the suitname into the function and it does the check inside of it
so you just got a single function call to use for all your stuff
true
there we go
now the check is in here
unless i can somehow move all these overrides somewhere else?
though idk if thats possible
had to do some trickery since i add spaces for the suit textures ingame but in theory this line should work:
string currentSuit = StartOfRound.Instance.unlockablesList.unlockables[GameNetworkManager.Instance.localPlayerController.currentSuitID].unlockableName.Replace(" ", "");
(replaces all spaces with nothing, essentially just removing them)
okay nvm ive hit a wall again
the problem is when you equip a suit that doesnt have these height adjustments your camera is supposed to be reset to normal, but of course yes this code runs for everyone with the mod so when a player equips one of those suits everyone is set to that height... reasonable idea would be put the same code in but the thing is when this runs youve already swapped suits so i cant check what the suit is gonna magically be in the future