Scripts / Delete an entity with "If Used"?

Author
Message
Devcore35
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 8th Jul 2015 17:58
Hello,

I am looking for a script that does the opposite of the script "plrinzone.lua".
Indeed when you put entity "Spawn at Start = No" just put a "Trigger Zone" connected to LUA script "plrinzone.lua" and indicate "If Used" the name of the entity to bring up when the player come into this area.

I'm looking for just the opposite: when the player enters the area the entity disappears.

Do you have an idea of script ?

Thank you very much in advance !
PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 8th Jul 2015 19:41 Edited at: 8th Jul 2015 19:47
Very easy
zone:
main:plrinzone.lua
ifused: name of entity which should disappear

entity
name: name of entity which should disappear

and this script:



I am at the university, so I did not test it. Hope it works

Edit:
Should it appear again?
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
Devcore35
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 8th Jul 2015 21:10
Thank you very much: D!
I'll test it
Not need it to appear again as it is a survival horror based on the famous "Slenderman" So each appearance did not stay long ^^
Basically I shows the Slenderman off the player and when he approaches too close to the Slenderman disappears (through another StriggerZone).
Thank you for helping hands I'm not good in LUA script really sorry for asking a question as stupid ^^

PS: I will provide the game based on Slenderman I called "Slawn" forum translated into English for you when GameGuru will be optimized for the scene of the forest is 2.7 million polygons and I down to 5 fps ... So I bought a computer specifically for creating 3D video game last generation xD But you will have: P And I would do my best with my team to give you a little game that will complete very scared

I also have another very serious problem; the lightmaps flash alone when I'm away from it, then I'm ready when it no longer flashes (normal).
Would there be a way to ensure that lightmaps is visible from afar thanks to a LUA script in which a high display distannce is indicated? Who lose FPS.

Thank you
PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 8th Jul 2015 22:49 Edited at: 8th Jul 2015 22:50
I took cornos idea and just added a little that would allow your "slawn" to disappear based on distance but not be removed so you can call him back using ResetPosition(e,x,y,z).

You'd need to calculate the x, y and z

eg:





You could use a trigger zone (for example) to decrease/increase the appear/disappear distances dynamically. ie: Add something like this to a trigger zone script. Every time they entered the zone the range could be increased/decreased? minDist = minDist - 1

Obviously both of these script pieces are not really working script and the ResetPosition script example would not check for obstacles so if you weren't careful where Slawn appeared you could land him in a tree.


----
Based on my understanding of your lights problem, the range is fixed so there is no way (I know of) to make lights work from a long way away. Need to find the thread where this was discussed a little while back.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 8th Jul 2015 23:50
Or you can transport to, so you can choose the place you want appears. There is useful example in smallg's thread.

About show/hide, it would be nice to be able to control the time elapsed while entity appears/disapears, so you can hide/show entity gradually, it looks most reallistic, I thought.

I was trying whith a z-ghost, but not look. I got the transparency, but does not dissapears gradually, it does fast, and the efect is not the same.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 9th Jul 2015 00:09
Quote: "About show/hide, it would be nice to be able to control the time elapsed while entity appears/disapears, so you can hide/show entity gradually, it looks most reallistic, I thought."

I spent a lot of time yesterday working on something very similar and gave up for want of a better way. I'm hoping to spend some time today with a (much feared) while loop and see if I can't hold the execution until the timer for each call elapses.

I'm actually trying to scale up a teleport decal effect at the same time as using hide/show for an entity with random "hide" calls increasing faster than "show" to give the illusion he's fading away. It'll either look amazing or burn out my video card
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Devcore35
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 5th Aug 2014
Location: Rouen (76) - France
Posted: 9th Jul 2015 10:06 Edited at: 9th Jul 2015 10:07
Hello,

Thank you all for your answers
But in the game it is very dark and so if the Slenderman disappears one blows it does not matter.
So I create this script by helping me to "health.lua" because the idea of Destroy (e) on a StriggerZone does not. We should have a command like "DestroyIfUsed (e)" but it does not exist in the engine GG.

Here is a script that works: simply put it on the character "Slenderman" :



Then uffit adjust the viewing distance (1200 here) and the Slenderman (or object) disappears. It is not recoverable, but it does not matter here ^^

Thank you again for your help
PM

Login to post a reply

Server time is: 2024-12-22 01:05:50
Your offset time is: 2024-12-22 01:05:50