Jump to content

Recommended Posts

Currently, this statement is attached to inst.OnSave, however if a player leaves (which is an event that saves them) it doesn't apply to them.

 

function onpossesssave(inst)
if inst:HasTag("possessedmob") then
inst:AddTag("playerghost")
inst.Network:AddUserFlag(USERFLAGS.IS_GHOST)
inst.player_classified:SetGhostMode(true)
inst:PushEvent("ms_becameghost")
end
end

 

I've also tried doing a negative health delta, but the character will simply rejoin with full hp instead.  Is there some day to ensure if a player had a certain tag when they left they would be killed when they rejoin?

Edited by Mario384
12 hours ago, DarkXero said:

I don't get it. Why not just kill them when they rejoin?

Attach to OnLoad the same check for the "possessedmob" tag and then kill them.

The tag doesn't add itself when they rejoin.  Mind you, these are regular players.  Actually, here, just take a look:

 

Possession Mod.zip

Edited by Mario384
2 hours ago, Mario384 said:

The tag doesn't add itself when they rejoin.  Mind you, these are regular players.  Actually, here, just take a look:

 

Possession Mod.zip

if you just want the tag to be there on load, then add an OnSave and OnLoad function with something like

local function OnSave(inst, data)
    data.possessed = inst:HasTag("possessed")
end

local function OnLoad(inst, data)
    if data and data.possessed then
        inst:AddTag("possessed")
    end
end

 

Edited by Aquaterion
47 minutes ago, Aquaterion said:

if you just want the tag to be there on load, then add an OnSave and OnLoad function with something like


local function OnSave(inst, data)
    data.possessed = inst:HasTag("possessed")
end

local function OnLoad(inst, data)
    if data and data.possessed then
        inst:AddTag("possessed")
    end
end

 

Alas, I can't because data is not declared.  Not sure why though.

Edited by Mario384
53 minutes ago, Aquaterion said:

try


local function OnSave(inst)
    return {possessed = inst:HasTag("possessed")}
end

 

I tried this, and then tried different version of this, but nothing worked.

 

EDIT: Wait a second.

EDIT 2: Nope, doesn't work.

Edited by Mario384
4 minutes ago, DarkXero said:

OnSave for entities doesn't return a table, it gets passed the table to use.


local function OnSave(inst, data)
	data.possessedmob = inst:HasTag("possessedmob")
end

 

 

 

tried that already, but apparently didnt work, but i guess he didn't try it in the main fn yet

2 minutes ago, Mario384 said:

Also, why would putting it in the main function help any?  It's not supposed to affect the spiderden, it's supposed to affect the player.

well you tried to put it in a function that only runs when you haunt it, is this suppose to be able to happen to all characters? or just a specific character? either way I think it would be more ideal to do this via component.

Okay, here's the idea:

 

Any player dies, haunts Spider Den, becomes spider.

New day begins, possessed spiders die.

Player who is a possessed spider leaves and rejoins, die on rejoin.

First 2 work, last one doesn't.

Edited by Mario384

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...