Scripts / There is opposite of the script "plrinzone.lua?

Author
Message
Peri
Game Guru Backer
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 9th Aug 2017 10:35
I looking for the opposite of the script "plrinzone.lua,

I looking for a way to destroy the objects and ai behind the player, when the player can't go back anyway and reduce the level memory.

I used a script I found in the forum but its working with the object number its good only for one object.

Thanks for the helpers .
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 9th Aug 2017 11:12 Edited at: 9th Aug 2017 11:48
It's been a while so this is off the top of my head but you can destroy several entities from one script

You do however need to be on top of your level design and build the entire area first that you want to destroy behind you.
For example your first area contains 1000 items .
Place the player marker after the items to destroy so your not including this, (not sure it would cause problems but better safe than sorry) then destroy all these using the following script in a trigger zone.

function destroyall_init(e)
end

function destroyall_main(e)
if g_Entity[e]['plrinzone']==1 then
for x = e-999, e-1 do
Destroy(x)
end
ActivateIfUsed(e)
end
end

You can also use batches of any '- ' number if you want to destroy more zones behind the player.
This way you keep it tidy and don't need a bunch of item numbers.
If I am wrong then I am sure someone will be along to correct me
Peri
Game Guru Backer
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 10th Aug 2017 10:05
Thanks I will try
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Aug 2017 15:51
that's what 'else' does, so
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Peri
Game Guru Backer
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 14th Aug 2017 09:56
Hi @rolfy maybe I do something worng but when I am out the zone, the test level freeze

smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Aug 2017 12:42
try making sure the entity exists in game
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Peri
Game Guru Backer
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 20th Aug 2017 09:47 Edited at: 20th Aug 2017 09:49
Thanks you all I will try

but just to know, there is more simple way like the plrinzone by the entity name or its complicated?

Login to post a reply

Server time is: 2024-04-16 05:53:35
Your offset time is: 2024-04-16 05:53:35