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 / Destroy entity using Switch?

Author
Message
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 11th Jun 2005 13:02
I am trying to to set up a Switch/Entity relationship so that when the Player activates a Switch, another Entity gets destroyed, so far I have not succeeded and cant really see how it can be done.

I have tried hundreds of times using variations of the obvious scripts commands but cant seem to get destroy to work conditionally using the switch command "ifused" or any other.

Of course I can get the command destroy to work and destroy an entity but not via the Switch method, thus far.

The nearest I can get currently is that I can destroy either object when the Player touches them, but the player always destroys the one being touched, not the target object. In this case obviously not sending the destroy command to the entity target but destroying the Switch itself, the Player himself always being the destroy command activator.

What I need is a conditional method of getting the enity to destroy on switch activation. As far as I can see destroy only has one condition that could be applied and that might be health? Not really appropriate as I dont want to hit or have to otherwise damage anything as with a weapon - I cant for the life of me see how the destroy command can work between two entities using a Switch/Entity relationship?

Any suggestions would be gratefully appreciated.

Thanks

Dory The Cable Guy
17
Years of Service
User Offline
Joined: 23rd Apr 2005
Location:
Posted: 11th Jun 2005 16:45
ya, i need one thats like a bomb that u plant and then it counts down on a timer.

Heven doesn't want me and Hell's afraid i'll take over!!!
ctm
17
Years of Service
User Offline
Joined: 25th Feb 2005
Location:
Posted: 12th Jun 2005 00:34 Edited at: 12th Jun 2005 00:37
Uman,
all you need for the switch is one of the Switchscripts which are in the scriptbank folder and you have to type the name of the destroyable entity in the "IF Used" field of the switch.

The entity you want to destroy by using the switch needs a Init script.
If there is no Initscript attached to it use the "appear1" script.

The Mainscript should be a script that makes the Destroyscript run.
Here is a example which i have testet in the "Testmode":

The action "runfpidefault=2" activates the Destroyscript.

For my test i used the "crumble" script which is in the "scriptbank\destroy" folder.

Settings of the destroyable entity:
General:
Static Mode : No
Statistics:
Strenght: 0
IsImmobile: Yes
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 12th Jun 2005 01:38
ctm,

Thanks for that.

Have you actually tried setting up a Switch and got it to destroy another entity when the player touches (activates) the Switch?

I am trying to do it remotely i.e. the Switch is a little way from the Enity to be destroyed.

I have already tried set things up as you have described that way (many attempts) and it did not work.

I will study your input more closely and have another go and reprt back
ctm
17
Years of Service
User Offline
Joined: 25th Feb 2005
Location:
Posted: 12th Jun 2005 03:36
I made a screenshot from my testlevel.
For the test i used a normal switch and a fake wall.
You can see that the swich is not close to the wall (mywall).
The level:
http://www.chris-tm.de/pics/fpsc01.jpg

A screenshot from the switch.
It is a normal swich. The only thing i changed is to type the name of the wall (mywall) in the If Used field:
http://www.chris-tm.de/pics/fpsc02.jpg

And last a screenshot from the wall.
Here i had to change more:
I changed the wallname to "mywall"
I set the Static Mode to "No".
I had to add a "Init" script because the "fake walls" dont have a Init script attached originally.
And finally i added the "runDestroyscript" script to the "Main" field (that is the script i have posted in my first answer).

I marked the "destroy\crumble" script in the "Destroy" field too but it is attached to the "fake walls" originally.
The screenshot:
http://www.chris-tm.de/pics/fpsc03.jpg

I hope this helps.
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 12th Jun 2005 04:08
ctm,

Thanks again

I will be trying this out again a little later tody. No time for at the mo - have to go out.
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 13th Jun 2005 07:42 Edited at: 13th Jun 2005 07:43
I could not get that script to work.
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 13th Jun 2005 08:06 Edited at: 13th Jun 2005 08:21
Below is the code I use successfully to use the Switch activation to destroy the entity as required. The script could be modified to suit a number of scenarios.

As you can see from my code the entity in this instance is required to perform a damage operation on the player if he gets within 40 -effectively touches - the entity. This part of the code operation does not work perfectly as required. I do not wish to kill the Player but reduce his health every time he moves forward and hits the entity - until he uses the Switch to turn of the damage and destroy the entity or die in the attempt.

The initial impact of the Player hitting the entity reduces the Player health correctly by 50 points, thereafter impact by the Player with the entity does not Reduce his health so the entity is not resetting the command. Of course using the Switch destroys the entity, correctly.

I have tried various vesrions and amendments/scenarios within the script, producing various differing outcomes. I can get the player impact to work and reduce his health always, Get the Switch to reset the entity so that imapct only reduces health every time the switch is contacted and I can get the entity to kill the player with a simgle impact of course, but cant get the complete combination to work as needed. When ones requirement works correctly another does not.

The last two commands are vital

:state=0,destroy - works but works incorrectly reducing health only once. destroy:state=0 - works and resets the entity every time the Switch is used but does not destroy the object

I will keep trying to perfect this - if anyone knows how the script could be amended to achieve the required desired aim of multiple health reductions whilst maintaining the Destroy and Switch functions - I could do with some help

Thank you
ctm
17
Years of Service
User Offline
Joined: 25th Feb 2005
Location:
Posted: 14th Jun 2005 23:12 Edited at: 14th Jun 2005 23:14
Uman,
i tested the scripts again and nothing did work...not my script, not your script and not the other 2 scripts i have made.
There seems to be a bug in FPSC!
I found the entityname which i have typed in the If Used field of the switch in all If Used fiels of all the other entities in the level (doors, switches, all non static objects) but it had no effect to the other objects...very strange.

After closing FPSC and a new start everything worked fine again.

Here are 2 more tested scripts that should do what you want:

The first one works like the "plrhurtinzone" script and hurts the Player 1 health every frame using the hardcoded "hurt" sound:


But i think you want to use a other sound when the player gets hurt.
This script hurts the player 50 health every 0.5 seconds while he is closer than 40 units to the entity:
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 19th Jun 2005 09:30
ctm,

Thanks for that - I will take another look when I get a mo.

There certainly numerous bugs and erratic behaviours in FPSC - though I have everything working to a degree its not quite what I want. I am certain It can be perfected and I will have a look at your new code examples and see how they work or how I can fit the code into the equation and report back again.

Thank

uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 20th Jun 2005 08:14 Edited at: 20th Jun 2005 08:14
ctm,

The second of your last code posts works perfectly as I was looking for.

The script can easily be amended to fit a number of varying scenarios.

Thanks ctm

Regards

ctm
17
Years of Service
User Offline
Joined: 25th Feb 2005
Location:
Posted: 20th Jun 2005 09:29
I'm glad that i was able to help
uman
Retired Moderator
18
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 20th Jun 2005 10:30
Cheers,

I will give you a credit if I ever finish my game

Login to post a reply

Server time is: 2022-12-09 06:47:29
Your offset time is: 2022-12-09 06:47:29