Jump to content

Recommended Posts

Posted

When I'm trying to do something like this in script that I attached earlier:

-- MyScript
function initialize()
    local entity = Entity()
    if someCondition then
        entity:removeScript(pathToMyScript)
    end
end

server just crashes with error "EXCEPTION_ACCESS_VIOLATION".

 

So.. how to removeScript from itself?

Posted

When I'm trying to do something like this in script that I attached earlier:

-- MyScript
function initialize()
    local entity = Entity()
    if someCondition then
        entity:removeScript(pathToMyScript)
    end
end

server just crashes with error "EXCEPTION_ACCESS_VIOLATION".

 

So.. how to removeScript from itself?

 

just use terminate() instead ... it sets the script to invalid and removes it automagically on the next ocassion!

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...