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 / Script needed: reset switches

Author
Message
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 31st Oct 2007 01:45
Hi.

Is it possible to reset switches? In my arena game doors are activated by switches. When the game is over the option "play again" starts everything anew but the doors are still open, the switches are still active.

Is there a way to set them to "switch hasn't been activated" at the start of a new game / close the doors?



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2007 08:59
I have no clue...

In all honesty it doesn't make sense, because in the "gamewon.fpi" and "gamelose.fpi" scripts for arena games, it says this in the script:



So clearly, the current game is destroyed and a new one is made! That should reset all the scripts and entities.



Sorry, I wish I had something better to say here.


The one and only,
~PlystirE~

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 31st Oct 2007 10:28
You could get around it with a trigger zone. Have the player start on a trigger zone that closes all the doors.

"he is coming!..." - WIP in 'Showcase'
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 31st Oct 2007 14:45 Edited at: 31st Oct 2007 14:47
Plystire It should restart. It`s strange anyways as it says "you win" but the `numbers of wins aren`t stored. It says "you win"...then "you lose"...then it starts again with all doors open.

Nickydude Yes...but triggerzones don`t work in multiplayer mode.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2007 21:15
Also, if you were to fix it with a "psuedo triggerzone" via an entity... then all the doors would reset whenever the player spawned again.


The one and only,
~PlystirE~

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 1st Nov 2007 22:04
Quote: "Nickydude Yes...but triggerzones don`t work in multiplayer mode."


Never tried the multiplayer bit, sorry about that

"he is coming!..." - WIP in 'Showcase'
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 2nd Nov 2007 00:08
I just had a thought... are all of your switches named the same thing?

If they are then you could use a psuedo triggerzone like this:

Set this entities If Used to the name of the switches.

give it this script for the Main AI:



This entity will be invisible, so make a new script for it's Spawn AI like this:



Then put that entity on top of all the spawn points...

I have a theory but I'm not sure if it's right or not... the switches all driven by their "state" and not by being activated or not. So perhaps when a repeatgame is given, then maybe the state isn't returned to 0...

Try putting this line at the end of your switch script:



Now, when the player spawns for the FIRST time in the arena, all the switches should revert back to their initial state of 0... and changing the activation in the invisible entity to 1, it won't do it until the game is restarted and the activations are reset...

That is, if the game resets the activation values. If not, this wouldn't work, but at least I gave it a shot.


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 2nd Nov 2007 22:49
Plystire This sounds interesting. I will try it. I didn't understand everything. Please help me out.

I renamed my switches to "SwitchDoor". Each of the four switches has this same name. Switch 1 opens "SD1", switch 2 opens "SD2" etc...SD = security door.

What should I do now?

I don't get this one:

"Set this entities If Used to the name of the switches."
Which entity or entities? Should I create a new entity, with an "if used -> SwitchDoor" and place this entity to every player's starting point?



coming soon...
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 2nd Nov 2007 23:40
I tested it.

I

1) renamed all switches to SwitchDoor
2) created a new entity...a sign.
3) I assigned a custom appear- and mainscript to it.
4) I placed this sign on all eight players' starting points, like a floor. When a player respawns he automatically stands on the sign and steps on it.
5) I created a custom switch.fpi and added your line.

Here is what I got:

1) All weapons and ammo are not on their postions. They are shifted. They are messed up.
2) The switches and doors worked. I won the game (only me in the game, haha)...restarted the game.
3) The switches were not reset. The security doors were still open.

It didn't work. I don't know if I did everything correcly.

The entity I should create and add to the spawn positions was a static one. Maybe its scripts didn't work then?



coming soon...
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 3rd Nov 2007 04:28
I found another solution. I had already tried this before I chose to use the "activate switches, open doors, get win object" mode...but it didn´t work.

Now I tried it again and now it worked.
I don´t need switches any longer. Instead of hiding the win object behind four remote doors that can be activated by switches I simply use FOUR win objects and set them to mission objective 1, 2, 3 and 4. You win when you get all 4. And the are recreated at each start of the game so you can play again!



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 3rd Nov 2007 09:27
Well, that's good that you got it working!

Yeah, if you make an entity static, then it's scripts don't work, it's just geometry... part of the level.

Quick question about your multiplayer game... who wins if both players got 2 of the items?


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 4th Nov 2007 04:01
Damn...it didn´t work. I tried to set four health objects to respawn after a delay. Unfortunately, they can only be mission objectives if they have a maximum total spawn of 1. As soon as they respawn after x seconds it doesn´t work anymore. It only works when they are gone after a player has picked them up.

Of course it´s impossible for one player to get all health objects.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Nov 2007 06:30
Hmmm, sounds like you may need to rethink your level mechanics.


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 4th Nov 2007 15:01
I'm running out of ideas. Switches as mission objectives didn't work. Mobile switches didn't work. Health picksups didn't work as it is impossible for one player to get all of them without the interference of other players.

With a "play again" nothing is reset, neither switches nor doors. They are all open.

1) I will retry your entity-proposal.
2) Maybe a "anyfurther" will close doors.

Wish me luck.



coming soon...
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 4th Nov 2007 17:43 Edited at: 4th Nov 2007 17:45
Plystire, hours have passed. The problem is that I am totally new to FPI. I just don't have a glue how to get things to work. Your code lines include "activate=1"...shouldn't it be "activateD=1"?

After hours of trying I only managed to open a closed door as soon as the player spawns at the beginning of the level. It should be the other way round...the door should close if it is still open at the start of a level. It seems that switches don't work at all...that they can't be set to on and off with a triggerzone-like entity. Doors can.

This is a small testlevel. Could you help me out and add your code lines yourself please, just to make sure I didn't make any mistakes?

http://www.llcp.at/temp/mptest.fpm

Three switches. One opens door one, two opens door two etc.
The health object in the corner is the mission objective. Collect it to win.

The health objects under the players' starting postions are triggerzone-like entities. They point to S (name of the switches). I fear it won't work that way. Point them to D1 (door1).

Please try those two possibilies. The mission objective doesnt't work when run from the editor so you have to build the game first.
I built the game and THEN edited the FPI-scripts with the code lines.

Editing them as better than pointing new ones to objects as this messes up MP arenas. The mission objective has pickuphealth.fpi as script, the triggerzone-like entities pickuphealthGLOW => build the game and edit the pickuphealthglow-script.

I'd be really thankful if you could try those two things.

EDIT The download link is an FPM file, NOT a zip file. IE always says .zip. Just rename it after downloading.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 6th Nov 2007 07:47
First off, I'd like to know how you made the entity an Objective if I am going to alter this in any way.

MP arenas don't allow entities to be objective.


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 6th Nov 2007 21:33
I presented my "finding" both in the showcase (Project : CP Unknown) and chat thread. It does work. I'll paste it below:

"In the build options you can either select "get x frags", "get the highest amount of frags in x time" or the first option. Mission? Goal? I have the German version, that's why I don't exactly know what the first option is called in the English version.

Anyways...you cannot pick up keys in multiplayer. Nor can you use victory zones and so on and so forth. What you can use: weapons, ammo and health objects. Weapons can't be mission objectives (only maybe when editing the FPE)...but the "flag" can be the health object. It's rather a "get the flag".

I couldn't find this anywhere in the manual but it works.


1. add a health object from ww2. Switch to single player. Edit the entity's properties, make it a mission objective...1.
2. switch back to multiplayer.
3. It does NOT work in the editor! You have to build your game first and select the first victory condition (not frags).
4. Run the exe. You win when you pick up the health object.

To make this more exciting I use remote doors in my game. I can assign switches to different doors (also in single player mode)...
Maybe two health objects work as well, set as mission objective 1 and 2. If it works (haven't tested it yet) to grab object 1 and then get object 2 it could simulate a "capture the flag". "Get it and get back to..." ... object 2 in this case.

I tested it with one object in my LAN and it worked."

EDIT Here are some new findings. It also works to have multiple mission objectives. Create a multiplayer map. When you're done place e.g. four health objects. Switch to single player. Edit the "is mission objective"-field to 1 (1st health object), 2 (2nd health object) etc. ... up to 3 and 4.

Switch back to mulitplayer. Build your game. Get all four objects to win. It works. As you know from other threads I want to include doors and switches. The reasons are as follows:

1) it would work with one health object but it is boring. All players would race for this one object and the other parts of the arena wouldn't be used. Boring.

2) I could add four mission objectives and spread them all over the map. This would work in theory but not in reality. A player only wins if he gets ALL of the objects which is quite unlikely. If he gets one object, player two gets another object etc. nobody will win. If I let the objects respawn that each player can get all objects the mission objective doesn't work anymore.

3) I could use many mission objectives, e.g. ten objects "is mission objective 1", ten objects "is mission objective 2" and so on. You will have to pickup one object from each type / mission objective # but if someone runs around like crazy and collects all he sees nobody will be able to get his set of objects.

4) Doors! Switches! It only works for the first time as all doors remain open, even when "play again" is selected. Reloading the game from start would work but my arena is large and takes 6.5 minutes on my computer to load. That's too long just for one game. Therefore I really need a solution to close the doors before the start of a new match.

5) A solution to 4) is to place four new switches behind the locked doors. The doors are opened by switches all over the map...once open the player walks through them and closes all four days with the second set of switches. Problem: they will only be closed for him but not for other players. I could place such switches next to all spawn points but it would be up to the fairness of a player to use them for a new match. Bad idea.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Nov 2007 00:58
Okay... a few things:

1) The map I downloaded from the link you gave only had doors and segments on it. No spawn point, switches, health pickups, etc.

2) Following what you said, I was unable to build an MP game. While in MP mode there are very little options for entities. Namely, I couldn't put in scripts for switches, so you may need to go into how that is done.

The way I gave a switch a script, is I changed to single player mode, made it dynamic, gave it the desired script, then changed back to multiplayer mode. However, upon doing that, the switch is now static and cannot run scripts.

I will either need a downloadable map that contains everything already in it, or a more detailed description of what needs to be done to get it to work.


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 7th Nov 2007 01:53
What version of FPSC do you have? I have 1.07. All the objects are in the map. Don't know why they aren't there when you open it.

You can't assign a new script to a switch because the map will be messed up or they won't work anylonger. You can only leave them, build the game and edit the fpi afterwards, from the built game.

Just start from scratch. Create a small level in multiplayer mode. Add remote doors (sci-fi) as segments and switches as entities (I use the sci-fi switch with green and red lights reading open and lock or something). Rename the doors with individual names such as door1, door2, door 3. Save the map. Continue creating it...by switching to single player mode. More options will be available. Now right-click on the first switch and fill in "door1" in the field "if used" (whatever it's called in the English version). Then point another switch to "door2" and a third one to "door3".

Once you're done DO NOT SAVE your map but switch back to multiplayer first. Then you can save your map. Run it from the editor.

When you save the map in single player mode it can mess up your map. I experimented much and found that you should always add, place, name etc. your objects in multiplayer mode. Only change something in single player mode that can't be done in multiplayer mode (that isn't available in mp mode). Also, don't apply scripts in single player mode. Use the default scripts, build your game and edit the code lines afterwards.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Nov 2007 02:47
I see... the whole script thing doesn't make any sense, but whatever, lots of things made by TGC don't make a whole lotta sense.

I'll try it again real quick.


The one and only,
~PlystirE~

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Nov 2007 03:21 Edited at: 7th Nov 2007 03:25
Okay, I just made a test arena game, got it to build...

This is what I found.

1) The activation values as WELL as the state values of scripts DO NOT RESET WHEN STARTING ANOTHER GAME!

2) Because of findings in #1, I was able to activate the "invisible entity" (In my case, I used a blood splat decal under all player starting points) inside the script for the Objective item. Do this using the If Used field and the "activateifused=1" action.

3) Everything worked as planned... in fact, it worked better than I thought it would. Everything returned to normal before the player even spawned. Doors closed, switches reset.

4) Perhaps not worth mentioning but I'll say it anyway. I was able to give entities different scripts while in the single player mode, and it didn't effect the building process.


Here's what I did, and I did it exactly as you said:

1) Build the level, put in the switches and doors and name them accordingly while in multiplayer mode.

2) Put in the objective item and the blood splats under the player spawn points.

3) Save now.

4) Go into single player mode and alter all the if used fields. Give the Objective Item it's "Objective" field a value of "1". Also, give the blood splats a different Main AI script (I made a test.fpi for this one, which I made ahead of time), turn their "Static" property to "No" so that they can run scripts, and make them "Always Active".
[EDIT]
Here are the If Used values for each notable entity.
blood splats: If Used = switch
switch: If Used = corresponding door
Objective item: If Used = blood splat
[/EDIT]

5) Go back into Multiplayer Mode, save, and build.

6) Go and alter the scripts that need altering. You CAN alter the scripts before you build, but if you did not then alter them now. I shall give you the entire script for each one, just in case.

Switch1 script:



Door Remote script DOES NOT NEED TO BE ALTERED!

pickuphealthglow.fpi script:

The only thing changed in there is the addition of the "activateifused=1" in the first line of code. This will activate the blood splat code which will in turn reset the doors and switches.

test.fpi script: (This is the script I used for the blood splats)



There, you now have all the scripts worth noting.

If you have any problems getting it to work now... please give a detailed description of what you did to build the test game. Just know that it worked perfectly for me.

I wish you the best of luck, because needing to do this for DYNAMIC MP arenas is absolutely imperative.


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 7th Nov 2007 12:24
It works? I can't believe it. Plystire, thank you so much for your time and effort. If it really works I don't have to forget my arena.

I will test it later on and tell you if it works for me as well.

Thanks again!

PS You say you could apply new scripts in single player mode. Maybe it worked in your level but in mine I sometimes had problems. Once I had applied a new script all weapon and ammo objects were messed up. They changed their positions, were floating in the air...changed their x and y values. That's why I wrote that scripts should'nt be applied in single player mode. Maybe it is arena-dependent or whatever.



coming soon...
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 9th Nov 2007 01:16 Edited at: 9th Nov 2007 01:37
Plystire It worked. Created a small test and it worked. I had some problems though. After building the game I edited the scripts and all I got was an error: "...has encountered an error and needs to close" or something like that. Couldn´t get it to work.

I then rebuilt the game again and started it without editing the scripts. No error. I added the modified healthglow...no error. Finally, I added the switch-script...and the game worked. This time I didn´t open the fpis but modified them in another dir. and copied them into the game dir.

Did you experience this as well?

================

EDIT What the...? In fact it doesn´t work. There´s a strange phenomenon going on. When I run just the game it doesn´t work. When FPS Creator is open (even in idle mode with no map loaded) it works. I´m really confused now. I tried it several times with the same result.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 9th Nov 2007 03:28
That is a very odd phenomenon... we usually refer to these as glitches. And, in my experience, they are the hardest to get rid of.

I would take some time to duplicate your error, but I am currently about to leave and won't have time until later. Perhaps, someone may be able to help before I get back? *wink wink* to everyone.

But if what you say is true, then yeah, I wouldn't have gotten the error you had since I had FPSC open in the background when testing it... very strange, indeed.


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 9th Nov 2007 12:08
Good news! It works now on both computers in our LAN. I just reloaded the level yesterday but it seems that the error occured while building the game. Maybe some of the editor's exes had a problem. I didn't reboot the computer yesterday but I booted it today and now everything works just fine.



coming soon...
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 9th Nov 2007 22:08
I implemented this system into my Project : CP Unknown. It works! Thank you so much for helping me out. I would have never been able to script it myself.

Now there's only one problem left. Multiplayer freeze. When you decide to play again the screen freezes for all but the winner. Do you know a way to get around this problem? I don't know if this happens to my arena (haven't tested it yet) but it definitely affects frag arenas.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 10th Nov 2007 03:11
Sorry, Leander, I don't dab into MP development very much. Helping you was the very first MP file I ever made, lol.

Glad to hear you got it working, though!


The one and only,
~PlystirE~

Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 10th Nov 2007 04:06
Houston, we have a problem.
After "play again" the weapons are floating in the air. Everywhere.
Could it be that the reset-object (blood splat) is too big? Or are weapons too close to the reset-objects (under spawning points)?



coming soon...
Leander
17
Years of Service
User Offline
Joined: 20th Sep 2007
Location: Austria
Posted: 10th Nov 2007 14:46
I give up. Multiplayer is too buggy. I bought FPSC for multiplayer only and now I'm really disappointed. I worked like 150 hours on my arena.

Anyway, thanks for your help. Maybe an update solves my problems.

Final results:

O switches and doors are reset but for the winner only. The losers' switches are still active.
O "Play arena again" lets the weapons of joining players float in the air.
O The point systm doesn't work at all (# of wins).

O Frag mode: weapons also float in the air.
O The time counter doesn't work. For the host it says 120/900 seconds have passed. That's ok. For the joining player it says e.g. 2199/900 seconds have passed.
O It's sad when an English software says "You loose" instead of "You lose".
O My test arenas always froze for joining players when somebody has won.

LAST CHANCE:

Project : CP Unknown as frag-arena in case it doesn't freeze.

OR

I have to cancel my arena and hope that a FPSC update does the job of solving those horrible bugs.
Maybe I create a smaller arena that doesn't take so long to load and players have to host again instead of clicking on "play arena again" to get round the freeze.



coming soon...
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Nov 2007 02:06
I'm sorry to hear the, Leander. :,(

I know multiplayer is still very buggy. I wish you the best in the future.


The one and only,
~PlystirE~

Login to post a reply

Server time is: 2024-11-24 02:00:16
Your offset time is: 2024-11-24 02:00:16