Jump to content
Sign in to follow this  
Nebula

Male and female characters

Recommended Posts

2 hours ago, Axezombie said:

well same as IRL, undress him/her

Your jokes are inappropriate here.
I need help with the code.

 

And by the way, yes, it would be more interesting if the characters were completely undressable, and underwear was dressed as well as clothes.

Edited by Nebula

Share this post


Link to post
Share on other sites
Posted (edited)

Use the function "getPlayer():isFemale()"

There's more ways to get some player's gender, but this is one way.

 

"getPlayer()" is a global Project Zomboid function that returns an "IsoPlayer" object that is the client's character.

https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html

https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html#getPlayer--

image.png.192cb9bc03c1a2d8d779c1fa1cd28cfa.png

 

"isFemale()" is a function of "IsoPlayer" which is inherited from the "IsoGameCharacter" class.

https://projectzomboid.com/modding/zombie/characters/IsoPlayer.html

image.thumb.png.4b537ae29b984293d5e301235bc6b764.png

 

"IsoGameCharacter"

https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#isFemale--

image.thumb.png.1b664c9cee0a5aecea9affbb73fb5df5.png

 

 

Here's some example functions that use these classes and their functions.

This only returns if the client's gender is female as true or false.

 

The code has to be put inside the client folder in "..\media\lua\client" on some lua file.

Any questions feel free to ask me.

PlayerFunctions = {}

--[[
    Returns a boolean true if the player is female.
    Returns a boolean false if the player is male.
    
    Requirements: This code must be run under the client folder inside "..\media\lua\client" inside some lua file.
]]
function PlayerFunctions.isFemale()
    local playerObj = getPlayer()
    local isFemale = playerObj:isFemale()
    return isFemale
end

function PlayerFunctions.isFemale2()
    return getPlayer():isFemale()
end

local function isFemale()
    return getPlayer():isFemale()
end

function isFemaleGlobalFunction()
    return getPlayer():isFemale()
end

local function printPlayerGender()
    print("IsFemale? --> " .. getPlayer():isFemale())
end

function printPlayerGenderGlobalFunction()
    print("IsFemale? --> " .. getPlayer():isFemale())
end

 

 

 

PlayerFunctions.lua

Edited by ATPHHe
Edited code.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...