Tutorial. Safe using of Single Player scripts in MultiPlayer
-
IN ADVANCE – SORRY FOR MY BAD ENGLISH!!!
Let’s begin. We know enough about problems with SP scripts in online.
1. Duplicating of script instances by every player.
2. Duplicating of storyinfo inside player file.
3. Wrong working with “Player” variable.We can avoid this! But we need to learn my rules.
Rule 1. Do not write anything inside NewPlayer file!
In basic tutorial of SP in online recommended to activate Mission 13 in NewPlayer file. Don’t do this! FL trying to resave StoryInfo with current mission state, but forget about removing previos.
But how activate storyline scripts without it?
You can activate it by GenericMission. Example from Freelancer BETA:
[StoryInfo]
Mission = GenericMission, \missions\tutorial\tutorial.ini
MissionNum = 0
delta_worth = -1
debug = trueGenericMission have bug. If you run script and SP and resave it - FL will lost this mission and will save “GenericMission” without link to any script. We can use it! If FL will try to resave StoryInfo, he will trying to save not working mission!
That’s all! FL can’t active broken GenericMission and we can forget about duplicates - anyway they will be non-working.
Remember - with GenericMission you can use any script in any location. Forget about default 13 missions - create new scripts!
But how write this strings to Player file? Use Restarts!
Rule 2. Use only ONE SP instance at the same time.
Example. You are admin and want to create event. You will be “team leader”.
- create restart file with activated story script
- use this restart
- done! mission activated
Any next logging of player can reset “Player” variable inside script. But this will not corrupt activated SP instance.
In total. Mission activated. Without duplicates. And new player logins will not corrupt it.
Remember - you can use only 1 mission type at the same time. Second mission (different mission script) will ignored by FL.
Rule 3. Use single player scripts only for spawning, destroying and reaction of it (running fuses, spawning new NPC, etc).
You can’t use dialogs, objectives and thn-scrupts. More than it - server will crash after trying to run thn script.
But how to run THN scripts? You can use THN inside some bases. For example, on landing or launching. Players won your event and will land on victory base. After dock they will see cutscene “thank you, this applause for you!” or “you beat Nomad City and seeing last hypergate scene from mission 13”. You can everything - just do it.
You can’t use friendly NPC with fomations - Player variable changes after any player logging in.
You can’t change reputation of NPC. To set reputation use restarts or setreps of your FLHook or FLShell. (but you still can change reputation between spawned NPCs)And… that’s all! Simple 3 rules and now you can create any event on your server. More interactive with active spawn of special NPCs and without any programming.
But I can’t did this event in MP… because I have not enought players. FL is dead and that’s wery big problem for run this events…
Anyway. That’s only tool. And that’s working.
-
Instead of restarts binary patch for saving SP things is needed.
But how about Dynamic Missions plugin? -
Instead of restarts binary patch for saving SP things is needed.
Needed for… what? SP things is not required to save. You have event > You start event (by restart) > Event completed > SP mission is completed (by Act_ChangeState in last trigger). SP deactivated and don’t distrub anyone.
But how about Dynamic Missions plugin?
You about adoxa’s plugin? Plugin working in MP, and SP scripts will not hurt it.
-
“You about adoxa’s plugin?”
As i remember - W0dka’s plugin with M0tah’s support