Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Restore rusty valve when you die (still unsolved)
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#2
RE: Restore map when you die

There might be needed a lot of scripting to reset a whole map, depending on how many entities and script areas there are in the map. It might be more things to reset, like local variables, particle systems, sounds, lights and etc...
First of all, you will need a checkpoint. If you die, a function will be called. You should put everything that you want to be restored inside that function.
-------------------------------------------------------------
void CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

Sets a checkpoint at which the player will respawn in case he dies.

Callback syntax: void MyFunc(string &in asName, int alCount) <----- Do not forget the callback syntax
Count is 0 on the first checkpoint load!
asName - the internal name
asStartPos - the name of the StartPos in the editor
asCallback - the function to call when the player dies/respawns
asDeathHintCat - the category of the death hint message to be used in the .lang file
asDeathHintEntry - the entry in the .lang file
---------------------------------------------------------------------
Inside the function that will be called after the death, you should use ResetProp on every single entity and script area in the whole map. Then, every entity and script area will be restored.
ResetProp(string& asName);

If you have used local variables in your map, you can reset them by using SetLocalVarInt/Float and use the same value as it was in the beginning.
You can preload particle systems and sounds by using PreloadParticleSystem, PreloadSound, if you have created any particle systems or looping sounds with scripting.

SetLocalVarInt(string& asName, int alVal);
SetLocalVarFloat(string& asName, float afVal);
PreloadParticleSystem(string& asPSFile);
PreloadSound(string& asSoundFile);

You can reset many more things too, but I think everything above might be the most useful things to reset since they usually exists in stories. If you want to reset other things, search for it in the engine scripts.
.
(07-31-2012, 02:57 PM)Steve Wrote: Well I don't know exactly how to explain this but I have a map where you begin running away from a "monster"(not a real monster just some timer that are breaking some doors)
and I want to when you die by this "monster" you have to begin running again. and the whole map is as it was from when you begon with the map. is this even possible I really need to know this.
thanks already Big Grin
07-31-2012, 03:59 PM
Website Find


Messages In This Thread
RE: Restore map when you die - by Mackiiboy - 07-31-2012, 03:59 PM
RE: Restore map when you die - by Steve - 08-04-2012, 07:07 PM
RE: Restore rusty valve when you die - by Steve - 08-05-2012, 10:03 AM



Users browsing this thread: 1 Guest(s)