how do i remove an item while i am playing?

Talk about anything related to Legend of Grimrock 2 here.
Post Reply
ratman
Posts: 76
Joined: Fri Jan 10, 2020 1:13 am

how do i remove an item while i am playing?

Post by ratman » Mon Jan 13, 2020 7:27 pm

such as if the player takes an item from an altar, I would want it to remove a "swamp_sky_1". does anyone know how to do this? thanks in advance.

User avatar
Isaac
Posts: 2949
Joined: Fri Mar 02, 2012 10:02 pm

Re: how do i remove an item while i am playing?

Post by Isaac » Mon Jan 13, 2020 11:52 pm

For which game? (Presumably LoG2; because it's a Sky.)

This is usually done via script, in a script_entity.

Every object has a destroy:() method.

you can destroy an object in either game, by calling the [[ object.id ]] : destroy()

For example:

Code: Select all

swamp_sky_1:destroy()
___

Create (or select) a script_entity on the map, and paste the following into it:

Code: Select all

function destroySky(self)
	if findEntity:("swamp_sky_1") then
		findEntity:("swamp_sky_1"):destroy()
	end 
end
If you wish to destroy the sky object due to the player's action at a specific time, you can activate the script by connecting any trigger object to the script.

ratman
Posts: 76
Joined: Fri Jan 10, 2020 1:13 am

Re: how do i remove an item while i am playing?

Post by ratman » Mon Jan 20, 2020 1:25 am

thanks

Post Reply