Multiplayer Scripting?
-
Oh boy, where to start with this.
This has been a work-in-progress for some time now between myself, M0tah, Why485, and KillerJaguar, and something I originally planned to write a full tutorial on in a similar fashion to how I wrote the AI Wingmen Tutorial. However, this was put on hold when we hit the subsequent wall of bugs and glitches - long story short: multiplayer mission scripting is currently useless. While the mission scripts themselves do function, scripting itself was never intended to be used in multiplayer - every time a charfile is loaded from the server (someone logs in, respawns after death, etc.), they create a new mission thread - however, the old ones are never destroyed (after all, you didn’t have logins/respawns in SP), so as a result anything executed by a scripted mission is executed twice, or four times, or ten times, etc. as the threads stack up and up to ever higher counts. Basically, this means if you ran Why485’s simple mission script, it would work fine for the first login (as displayed) - however, if you were to die or login again, everything would spawn twice, you’d get objectives twice, etc. Login a third time, or start adding other players into the mix, and suddenly you have 5 threads per player all stacking on one-another, and everything would spawn 10 times at once, you’d get 10 of every objective, etc.There’s also a few other bugs, such as a “Mission Failed” screen for shooting a neutral NPC, and the inability to invite other players into your group (says every player’s on a mission and can’t be invited). However, we have been able to fix those - you may notice a few hacks related to this over in the Limit Breaking 101 thread.
However, for the multi-mission-threading bug, it’s a big mess, and one that M0tah and I are still working on fixing. M0tah has written a few things into his FLHook builds to try and stop this creation of a billion mission threads per player, and I’ve tried writing a few checks within the mission scripts themselves - however, neither of us have had much success.
All of that said, if you’d like to like to play around with this yourself, here’s the information. I must apologize for never writing anything on this, despite all the numerous bugs - all these issues might have been solved by now if more people had known about it.
This is accomplished via editing freelancer.ini and mpnewcharacter.fl to thread StoryLauncher into multiplayer - simply open up freelancer.ini, browse down to [Initial MP DLLs], and add the line “DLL = Content.dll, StoryLauncher, BELOW_NORMAL” below BaseSupport. From there, open mpnewcharacter.fl and paste in the following at the bottom:
[StoryInfo]
ship_bought = false
Mission = Mission_13 ;Specify mission name here
MissionNum = 0 ;Recommended you leave at 0
delta_worth = -1.000000
debug = 0Edit: Right, totally forgot. Even though usage is extremely limited, it can have its uses. Currently, I am using scripting to setup a small “clamp” to change the way NPCs target things, to display a “tips” section in the F5 mission log, and finally to display a “Welcome to 88 Flak!” message to new players - even though these are fired multiple times, it doesn’t really matter. The full code for this can be viewed here, for those curious:
;88 Flak's data/missions/m13/m13.ini file [Mission] npc_ship_file = missions\npcships.ini ;------ Basic Clamp ------ [Trigger] nickname = clamp_setup system = any InitState = ACTIVE Cnd_True = no_params Act_RandomPop = true Act_RpopTLAttacksEnabled = true Act_RpopAttClamp = false Act_HostileClamp = false Act_PlayerEnemyClamp = 0, 999 Act_GCSClamp = false Act_NNIds = 458831, HISTORY ;"Mission Scripting Active" Debug Message Act_NNIds = 459076, HISTORY ;F5 Tips Log Act_ActTrig = welcome_to_flak ;------ Welcome IDS Entries ------ [Trigger] nickname = welcome_to_flak system = Li07 Cnd_SystemEnter = Li07 Act_NNIds = 459075, OBJECTIVE Act_ActTrig = welcome_look_in_hold [Trigger] nickname = welcome_look_in_hold system = Li07 Cnd_SystemEnter = Li07 Act_NNIds = 024490, OBJECTIVE
-
I have added all things what you told but there is something bad because it doesn’t work. Can you tell me more about this adaptation ?
THX for answering
-
As fox mentioned the multiplayer scripting is buggy, so you should expect a ton of bugs, and errors.
-
I want to try it and i will see what it do and try to do something with it on my own.
-
I wonder if anyone was able to fix this “multiplayer scripting”?
Afair there was some trouble using multiplayer scripting for example as mission on a server as it would be triggered for every user or would work only one time?! (can’t remember correctly).
I think I’ve read somewhere (prolly Procyon) that they’re able to use it.
-
And I suppose, sharing is not of their interest? I assume it is safe to say they profited from the public FLHook code.
-
They dont really take part in the community other by advertising their server AFAIK.
I did a little testing myself on the matter and found, you can simply call a mission with the pub::Controller in content.dll.
Though that’s all I did so far (no further testing), I’ll revisit this soon though. -
Sounds interesting. Am I correct that you could use this to spawn and control NPCs? That’s one of the major things still missing IMHO.
-
M0tah wrote some mission-handling FLHook code, however there are a few issues still. For example, if any player logs out, everyone’s mission thread is ended. Also, if a player dies, the thread he/she creates on respawn is immediately killed off (we worked around that by adding a respawn delay, which seemed to fix it). W0dk4, were you able to launch missions without the StoryHandler thread? Chances are, most of these bugs were caused from using StoryLauncher to handle mission launching, but M0tah never figured out how to fire missions using FLHook directly.
As it is, it’s impossible to use the mission scripting in a live server setting for anything other than quick things to do when a player logs in (we use it to reset certain reputations on login that should always be neutral/friendly, etc.). If anyone wants to build upon the mission-handling code already implemented in his FLHook, the source is available in M0tah’s latest test release: http://www.memes.no/88flak/downloads/beta/reallybeta/FLHook 1.6.7 test 20.7z I’m sure he wouldn’t mind anyone using it as long as his work was credited.
Very cool to see people are still looking into this.
-
w0dk4 wrote:
Yes, Procyon has it.I noticed that when a player joins procyon with their PHook enabled, The moment a new player joins the server and is asked to name their character, they can also choose their rep for new starts.
Maybe something like this can be used to get around the multiple spawning thats happens by only starting the script with a certain rep. (no idea atm how any of this is done).
-
Gisteron wrote:
download why’s huge effects pack. there is a tutorial with code examples for such explosions. thanks on that, why, made that stuff with slight additions in my mod, looks fantasticI don’t need effects pack, glow and other engine upgrades doesnt work on my ancient PC.
I need only fountain explosion HELP PLEASE -
You don’t understand.
Grab Why’s effect pack and SEE how it’s done.
-
Really needed server-side “mission - bot” presence, may be dll that creates phantom player with [storyinfo] in char that is constantly at server without kicks, timeouts