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 Product Chat / Is there a way to make a script to change another script (entity)

Author
Message
The Big ZK
9
Years of Service
User Offline
Joined: 12th Aug 2014
Location: United States
Posted: 26th Nov 2014 04:23
So for the end of my second level I have the power puzzle that after it's completed it opens a door by "If Used". But I would like to also have it turn off an animation from an entity (a power transformer). I've been experimenting with scripts to do this but alas, I've failed miserably :-( Is there even a way to do this? Maybe just suspend it or destroy it if I have to. But it has to be done by the power puzzle and open the door at the same time....
Sinister Spoon
15
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 27th Nov 2014 18:51
See now what I would do here is when the power puzzle is solved have it set a globalvariable say globalvar=1, and then set the value of that variable to 1 so, setvar=1, what this does is set a flag that all other scripts can see, so in the power transformers main script, have a check that checks the value of globalvar=1, and if it detects a value change, either varequal=1 to check the value has reached 1 or varnotequal=0 to detect a change to any number other than 0, it turns off the decal, noise, animation, etc

The main point is that the value of the variable is set in the puzzle scripts fpi and the change is read in the transformers scripts fpi, allowing one entity to affect another, this can be used in numerous other ways but as a flag check to see if the puzzle has been solved it should suit your needs perfectly



smoke em if you got em
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 27th Nov 2014 21:40
Quote: "So for the end of my second level I have the power puzzle that after it's completed it opens a door by "If Used". But I would like to also have it turn off an animation from an entity (a power transformer)."


This should be in the script section...

The short answer is... yes it can be done. If the entity in question (power transformer) can turn on and off via a script, then you can create a script to not only open a door, but turn on/off the transformer. The key is to use the "settargetname=X" and "activatetarget=x" in the one script, and the transformer script would use a loop to check if the "activation" value was passed to it.

A remote door using "switch2.fpi" is a close example, except here you need to put the name of the door entity in the switch's "If Used" field for that switch to activate the door. But you can modify the switch to control a door and turn off an entity (if that entity supports a script to activate/deactivate animations)- all by using the above commands.

There's no problem that can't be solved without applying a little scripting.
The Big ZK
9
Years of Service
User Offline
Joined: 12th Aug 2014
Location: United States
Posted: 1st Dec 2014 05:54
Thanks for the info, I'll see if I can get it to work now. It's the last thing I wanted to do before I released the level to testers. And I guess I didn't have email notifications on or I would have seen your responses sooner...
The Big ZK
9
Years of Service
User Offline
Joined: 12th Aug 2014
Location: United States
Posted: 2nd Dec 2014 02:13
Oops, I just realized there was a script section... I'm just used to always coming straight to FPSC Chat (that's what I have bookmarked) that I forget there's other sections. I'll go post it there as I still can't get it to work with either one of the suggestions. And thanks for the heads up BlackFox, I'll try and remember to use the right section in the future

Login to post a reply

Server time is: 2024-05-03 09:59:37
Your offset time is: 2024-05-03 09:59:37