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 script to alter entity

Author
Message
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 6th Mar 2009 05:13
My wife has been working hard on her game and presented me today with a question that has me stumped. She is using the Dark Egypt pack and has an entity called entrance doorway-closed placed at the entrance to a passage. In the level she showed me how you have to search and collect the artifact. What she was hoping to do was once the artifact is collected, the entrance doorway-closed becomes an entity called entrance doorway which the player can pass through and enter the passage.

I know that the entrance doorway-closed uses the default.fpi for main script and destroy, and appear1.fpi for start. The entrance doorway uses appear1.fpi for start, default.fpi for destroy, and has the following script called DTIWalkThru.fpi in the main:



I created a test level and put the entrance doorway-closed in place at the start of the passage, then placed the entrance doorway entity just behind the first one. I then used a trigger point to try and destroy the entrance doorway-closed entity and after a few attempts and script creations, we both were stumped.

Hence, I thought I'd turn to the advice of the experienced here and ask if in fact something like this is possible. If so, are we going about it the wrong way?
dumpus
16
Years of Service
User Offline
Joined: 1st Jan 2008
Location: Canada, eh?
Posted: 6th Mar 2009 06:14
How did you try to destroy it? There are probably other ways of doing this, but it would be best to see what you're doing first.

Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 6th Mar 2009 06:18
Ok i'm not 100% sure what your talking about but ill give it a go.







Ok now the first script goes on the artifacts the second goes on an animated door. In the second script the varequal=5 change the number 5 to the number of artifacts.


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 6th Mar 2009 06:22
I created a barrel and set it to spawn when the player hit the trigger point at the artifact my wife placed in a different room. The barrel spawned just off the ground and then exploded, which takes out the door. I could do that and that is okay with her. We were just wondering if there was an easier way than the method I have used. She wants the doorway-closed in place, but hoped there was a way to make the doorway where the player can walk through replace the doorway-closed.
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 6th Mar 2009 21:34
@ Hockeykid

Thanks for the direction. Believe it or not, my wife was really impressed and liked the idea of what you did. Gave her even more ideas now. My "to-do list" from her just increased.

Once again, we appreciate the time and direction/help people give here.
X10 User
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location:
Posted: 6th Mar 2009 22:30
the simplest thing to do would be adapt my door charge simulator, as it focuses with destroying an entity on command, is it a closed entrance you are trying to destroy to allow to exit? just set up a trigger zone, adapt its ai main along these lines

:state=0,plrwithinzone:settargetnameyourdoorwayname),activatetarget=1

somewhere in the aimain place

:activated=1:destroy

that way when you enter the trigger zone it will set the activated value of the doorway to 1, as theres no state specified in the doorway main for activated condition then in theory regardless of what else the script is doing, when the activated state hits 1 it should destroy itself

you could even dispense with the trigger zone and wack the activatetarget lines straight in the artefact with a bit of clever coding

- Why is everyone on here so rude? -
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 7th Mar 2009 03:22
@ X10 User

They are two seperate entities we were trying to use. They come from the Dark Egypt pack. One is called entrance doorway and the second is called entrance doorway-closed. The door frames around the door are identical, it is just the doorway-closed has two wicker-style doors that block the doorway preventing the player from going through it.

My wife had asked if she had the entrance doorway-closed in place, could a trigger be activated and the entrance doorway-closed entity would be replaced with the entrance doorway entity, which would allow the player to enter that passageway.

So far we have two options. One was to have a barrel explode and destroy the door, and the second method was provided by hockeykid. I can try your suggestion to give her another option to choose from.

Appreciate your help too.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Mar 2009 20:27 Edited at: 7th Mar 2009 20:28


Give that script to your doorway. Name your doorway "entrance doorway" without the quotes. Make sure the doorway is immobile and has the default appear script (Not the one that turns off collision)


Now... give this next one to your artifact:



That should do it. Now, when you pick up the artifact, the doorway should no longer have collision and allow the player to pass through. (You don't need two doors for this)


The one and only,


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 8th Mar 2009 17:54
All worked like a charm. The wife is very happy. Thanks to you all.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 9th Mar 2009 01:46
No problem, we're here to help.


The one and only,


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 10th Mar 2009 08:10 Edited at: 10th Mar 2009 08:26
I had meant to ask about the text displayed when we pick up the scroll. On my wife's computer, the text "Picked up scroll" comes up faster on her machine than on my laptop. Can I delay that text display at all? She has a hud that displays "Picked up scroll 4. Locate artifact" and when I was on her machine it was so fast I had to ask her what it instructed me. I thought it may be good to delay the hud to stay on the screen for an extra few seconds.

Edit: Disregard my question in this post. My wife and I were just heading to bed and she had a thought. We have the objectives displaying in the beginning of the level and they are displayed longer than the hud for picking up the scrolls. The light clicked on and I got it to show the script for picking up the scroll to display a little longer. I have been teaching her this program and here she has suddenly taught me something.
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 10th Mar 2009 22:26
Yeah just in the code use timerstart and timergreater then something like




If you post the actual script i can do it for you.


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 11th Mar 2009 01:08 Edited at: 11th Mar 2009 01:09
I would appreciate that. We read about the timerstart and timergreater, but I was not too certain where to place it exactly. Another small item we will learn, make notes on, and carry through other scripts/games we are working on.

Here is a snippet of a code I use in another game when I pick up a padd in a scifi game we are working on. Same concept, just want to delay the hud for a few seconds.



The idea of this script is when the player picks up this item, it displays the hud which says "PADD aquired. Security code is 1234". This code will be used in a switch to input to access the hanger bay. The hud goes real fast, hence the delay in case we wanted to pass a "piece of info" the player will need later in the game.

I had tried to place timerstart right after the wav file, then timergreater=5000 right before hudfadeout=padd. My attempts did nothing, so we had left it for the moment and made a note to return to it when we finished other areas.
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 11th Mar 2009 01:26


Ok i didn't test this but i'm almost certain it works

```````````````````````````````````lesson on timers````````````````

Ok timers are very simple once you learn them.

to use a timer you must use the action timerstart-this starts the timer

now when you want to see if your timer is greater then a certain amount of time you use the condition timergreater=(time in milliseconds)

timergreater must always have timerstart some where in an earlier state of the script so if we had a code like this.

:state=0:timerstart,state=1
:state=1,timergreater=5000:activateifused=1,state=0

This would activate the ifused field every 5 seconds

Little note the timerstart also resets the timer to 0.


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 11th Mar 2009 06:33 Edited at: 11th Mar 2009 06:34
@ hockeykid

Thanks for the lesson on the timers. Gives us more to think about and implement in other areas.

I looked at the script you supplied. When I pick up the padd, it displays the hud but it is not fading out after the time hits the 5 seconds. I will play some more with it and see if I can get the hud to fade after the time is reached.

Hope this is not sounding like a broken record, but once again I do appreciate you taking your time to help out. You and the others have been tremendous in the lessons and my wife and I have learned a lot from you all.
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 11th Mar 2009 21:41


hmm thats weird. try this and tell me if it works


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 11th Mar 2009 23:20
Stuck it in the padd's main script spot. Ran a test and the hud displays, but it too also stays up for the duration of the level.

I'm not too concerned with it. We have a couple of work arounds we can use. I just thought if there was a way to delay the time a hud displays when you pick up an item then it would be good and I would eliminate having to add a trigger, but after multiple attempts it does not seem to want to do it. We're good with that, and I don't want to drive myself or you nuts with trying to get this to work. The one work around is I have a trigger right close to the padd the player would pick up and it displays the hud I wanted to show. Gives them time to read it and note the information passed to them for later on in the level. As they move away then it disappears. Of course if they forget they just have to go to it again, but that is okay.

However, you have been a good source of info for us.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Mar 2009 00:55
This is because when an item is "taken", the state value is automatically increased, this would make the state something OTHER than 1, preventing your timer line from being executed.

Try changing the "timergreater" line to this:
:timergreater=5000:hudunshow=padd

Please be aware that you MUST have one of the later updates in order for this to work as earlier versions of FPSC forced the script to stop running completely when the entity was "taken".


The one and only,


BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 13th Mar 2009 19:10
Ahh, I get it now Thanks for the insight.

I'm getting a better handle on the scripting now thanks to your assistance.
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 13th Mar 2009 21:35 Edited at: 13th Mar 2009 21:36
O i didn't think of that ply
so heres a fix

put this on the padd


apply this to a trigger zone any where in your level





BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 16th Mar 2009 16:45
Plystire and Hockeykid,

Sorry for not getting back to you both. Hectic schedule last few days. Got it working thanks to you both. Have a better understanding now of the script and timers.

Login to post a reply

Server time is: 2024-11-24 21:35:23
Your offset time is: 2024-11-24 21:35:23