Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Using a switch to destroy an entity

Author
Message
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 17th Nov 2006 17:40
Ive been trying to get a switch to destroy an entity, but I cant seem to get it to work. This is the script I have:



But when I set it up, for which item to activate, the entity doesnt get destroyed.

Any help?

Nue B
19
Years of Service
User Offline
Joined: 20th Nov 2005
Location: Indy
Posted: 17th Nov 2006 19:36
Your above script looks good. But you'll need another for such a task to work.

In the main script of the entity you want to destroy, include the following command.

:activated=1:destroy

Yes, it can be just like that or
if you want it to happen at a particular state write it like this:

:state=X,activated=1:destroy

Have fun

Nue B. or not Nue B. That is the question.
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 17th Nov 2006 21:59 Edited at: 23rd Nov 2006 05:13
Hi,the post below should be of some help

http://forum.thegamecreators.com/?m=forum_view&t=55534&b=23
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 17th Nov 2006 22:11
I dont get it, rolfy. I cant find any scripts that you add to a switch in that thread?

rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 17th Nov 2006 22:15 Edited at: 17th Nov 2006 22:25
Sorry Higgins,I had edited my post just as you were posting above.
I dont think you need to add anything in the switch script.It just triggers the scripts in the entity's ai.
Hope this helps!
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 17th Nov 2006 23:12
Could you post the script I need to add to the entity here, please?

rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 17th Nov 2006 23:27 Edited at: 23rd Nov 2006 05:14
The destroy script is in the post above, 'code snippet',the crumble script is in the scriptbank/destroy fpsc folder.Although this is a decal script I believe it works just as well for entities.Works fine for me,ensure the entity is dynamic, static mode 'no'.And isimmobile to yes (if you want this).
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 18th Nov 2006 00:33
Its working now, rolfy. But not as I thought it would, I was looking for it to explode, as I set it to when destroyed, but it never, nor does it cause any damage.

Is there a way for it to explode and cause damage to near by entities?

NIK
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: Texas
Posted: 18th Nov 2006 01:32 Edited at: 18th Nov 2006 01:33
Higgins, did you set the entity property explode to yes?

Puff Puff Pass
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 18th Nov 2006 01:47
Yes I did, nothing happened. The entity just disappeared.

filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 18th Nov 2006 02:34
I had addressed this same problem in another thread.

I cant find it right now, but here's the solution I had provided :

Use a vial (strength=1, explode ON, explode damage = 100) and make it spawn about halfway above the floor when the trigger is used.
The object you want to explode, set the properties as strength = 25, explode ON. Make sure the vial falls close to the exploding entity.



This solution is the only one I could figure out because of the following reasons:
1. Somehow even with exact same strenght and explode ON, some objects explode (vial) and some dont (generator).
2. Only some objects explode using triggers (vials), others exhibit wierd behaviours (generators).

For my puzzle level entry, I had tried a lot of things before coming up with the above mentioned solution (or mork of a workaround).


Do let me know if it helped.

-filya

-- game dev is fun...but taking up too much time --
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 18th Nov 2006 03:19
I got it working by doing what I did to make the object disappear, but I also made aother object spawn when I used the switch which had a short life set to explode.

Works really well too

Iam happy.

rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 18th Nov 2006 04:14 Edited at: 18th Nov 2006 05:27
Glad you got that one sorted Higgins,I could get the entity to explode from a switch,but was left with the problem that it would get destroyed when fired upon or even walked into,solved this the same way as you by spawning the exploding entity at the same time as destroying the first.
best,Rolfy.
@Filya,maybe I have another script would help with what you want to do.
filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 18th Nov 2006 06:46
Higgins...so what did u exactly do? I thought you couldn't get the object to explode at all. So how does spawning it at trigger help?

-- game dev is fun...but taking up too much time --
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 18th Nov 2006 14:13
I thought I explained it, simple enough above.

I had two entities with the same name, such as "1", one had the destroy script, and the other never, but the one without had a short life set to explode when spawned, so I set it not to spawn at the start, but to spawn when I hit the switch. Which destroyed one entity and spawned other which exploded.

filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 18th Nov 2006 18:52
Maybe I am an idiot, but I still didnt quite get you.

If you could make a script to destroy and object, why use 2 objects?

-- game dev is fun...but taking up too much time --
SpyDaniel
18
Years of Service
User Offline
Joined: 4th Feb 2006
Location: United Kingdom
Posted: 18th Nov 2006 19:17
Because the destroy script does not make the object explode.

filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 18th Nov 2006 19:45
k thanks

-- game dev is fun...but taking up too much time --
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 18th Nov 2006 22:35 Edited at: 18th Nov 2006 23:03
@Filya, just to clarify this,the switch can explode the entity,same can be done with a trigger zone,using the flamable script.
Set the entity's strength to 1, and physics force damage to 1000.
What Higgins wanted was a barrier of some sort.If he used these low strength settings it would have exploded on contact.So he needed two entities, one which would disappear and one which would spawn and explode,creating the illusion that the barrier itself had exploded when the switch was used.This is one of two ways to do this.
filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 19th Nov 2006 01:40
rolfy, thanks a lot for the clarification
makes sense now

-- game dev is fun...but taking up too much time --

Login to post a reply

Server time is: 2024-11-23 04:35:27
Your offset time is: 2024-11-23 04:35:27