Author Topic: Teleporting through dialog  (Read 6806 times)

Teleporting through dialog
« on: November 17, 2015, 09:21:29 pm »
Hello everyone,

I'm making this FOnline solo project, and I'm a total noob when it comes to programming. Therefore, my project only requires one bit of script, something that would allow for the player to be teleported to another map/location when he chooses the right dialog line while talking to a NPC. Anyone knows if it is possible and how to do it? (Please keep in mind I'm very, very, very nooby!)

Edit: and a bonus question while I'm at it: I remember there was a file where you basically were able to disable FOV line of sight, turn your mod into singleplayer, etc, anyone remembers which file it is?
« Last Edit: November 18, 2015, 12:15:57 pm by Marten Broadcloak »

Offline Ghosthack

  • Rotator
  • Bytecruncher
Re: Teleporting through dialog
« Reply #1 on: November 21, 2015, 12:53:25 pm »
Hi,

Take a look at this dialog: https://github.com/rotators/fo2238/blob/master/Server/dialogs/event_teleporter.fodlg

There are a few functions in this https://github.com/rotators/fo2238/blob/master/Server/scripts/event_utils.fos#L135 script that can do teleporting via dialog.

About singleplayer, take a look at this http://fodev.net/forum/index.php?topic=29612.0
Another file you probably want to take a look at is config.fos: https://github.com/rotators/fo2238/blob/master/Server/scripts/config.fos

There's no good scripting tutorial in english that doesn't assume knowledge in programming, so you'll at least need some knowledge of C-like languages to be comfortable with AngelScript.
Hope that helps a little.

Re: Teleporting through dialog
« Reply #2 on: November 21, 2015, 01:50:17 pm »
Thank you very much Ghosthack. I will take a thorough look at this.

I agree with your warning, it is obvious that developing a FOnline project without C# or Angelscript knowledge will be tough, but I hope I will encounter few problems and that they will be easy to solve if I ask the community the right questions.

Re: Teleporting through dialog
« Reply #3 on: December 06, 2015, 01:29:08 am »
I feel I'm going to have a lot of questions in the coming weeks, but I'm keeping them all in this topic to avoid spamming new threads.

Hey Ghosthack, I made some progresses on some issues and finally got to look at the files. For now I've been trying to cleanup the SDK a bit to suit my simple needs, and I didn't get to the dialogs yet.

Config.fos sure raised a lot of questions. The most pressing matter, though, is that of the FOV. Basically, config.fos reads this:

Quote
    // Look modifiers
    __LookChecks = 0;                                 // See Look checks in _defines.fos
    SETFLAG(__LookChecks, LOOK_CHECK_DIR);            // Nerfe look by directions of look
    __LookDir0 = 0;                                   // Nerf 0% of look radius with direct look
    __LookDir1 = 20;                                  // Nerf 20% of look radius with front side look
    __LookDir2 = 40;                                  // Nerf 40% of look radius with back side look
    __LookDir3 = 60;                                  // Nerf 60% of look radius with back look
    __LookDir4 = 60;                                  // UNUSED. Nerfe 60% of look radius with back look (Square geometry)
    SETFLAG(__LookChecks, LOOK_CHECK_SNEAK_DIR);      // Nerfe opponent sneak by directions of look
    __LookSneakDir0 = 72;                             // Nerf %dp% of opponent sneak with direct look
    __LookSneakDir1 = 36;                             // Nerf %dp% of opponent sneak with front side look
    __LookSneakDir2 = 12;                             // Nerf %dp% of opponent sneak with back side look
    __LookSneakDir3 = 0;                              // Nerf %d% of opponent sneak with back look
    __LookSneakDir4 = 0;                              // UNUSED. Nerf 0% of opponent sneak with back look (Square geometry)

From there, of course, I took a look at _defines.fos:

Quote
// Look checks
#define LOOK_CHECK_DIR                           (0x01) // Nerfe look by directions of look
#define LOOK_CHECK_SNEAK_DIR                     (0x02) // Nerfe opponent sneak by directions of look
#define LOOK_CHECK_SNEAK_WEIGHT                  (0x04) // Nerfe sneak by current weight
#define LOOK_CHECK_TRACE                         (0x08) // Tracing for wall aviablility
#define LOOK_CHECK_SCRIPT                        (0x10) // Allow bool check_look(...) in main.fos, all other defines ignored
#define LOOK_CHECK_ITEM_SCRIPT                   (0x20) // Allow bool check_trap_look(...) in main.fos, for items with ITEM_TRAP flag

It got me really confused. Like, what is _defines.fos doing? Is it taking action prior to config.fos, or after that? And why is it not just a part of main.fos then? Many questions. Not really important ones. Because, of course, there's the dreaded client_fov.fos. By the content of this file, I reckon you rotators have coded an entire new FOV system from scratch. The problem is, I see no switch to turn it off and I'm starting to wonder: did you erase the old no-FOV way in the process, and should it be coded from scratch again if one decided to disable FOV, or is it the engine's default view? If so, how to turn it back on? Removing the whole Look code from the three files just prevents the server from booting.

P.S. If I die while I'm still young, please tell my family this forum's captcha got me. Seriously, this is suicide material.
P.P.S. Almost forgot. Proof that the development is going smoothly! Or, well, starting smoothly. Right?

« Last Edit: December 06, 2015, 10:28:54 am by Marten Broadcloak »

Re: Teleporting through dialog
« Reply #4 on: December 07, 2015, 04:38:30 pm »
If I can ask... what do you do? ;) Is it Oil Rig Enclave base from Fallout 2, isn't it?

Re: Teleporting through dialog
« Reply #5 on: December 07, 2015, 05:24:45 pm »
What FoV model do you want exactly?

No Line of Sight check
or
With line of sight check?

Re: Teleporting through dialog
« Reply #6 on: December 07, 2015, 05:34:10 pm »
If I can ask... what do you do? ;) Is it Oil Rig Enclave base from Fallout 2, isn't it?

Yes, it's a new level for the oil rig. I'm uncomfortable with talking about the project further now, though. It's singleplayer, that's all I can tell.

What FoV model do you want exactly?

No Line of Sight check
or
With line of sight check?
No LOS. Similar to Fallout 1/2.

Re: Teleporting through dialog
« Reply #7 on: December 07, 2015, 10:16:12 pm »
Its not within your copy paste but all you need to do is comment or delete the lines that look like this.

    SETFLAG(__LookChecks, LOOK_CHECK_TRACE);       
    SETFLAG(__LookChecks, LOOK_CHECK_SCRIPT);     
    SETFLAG(__LookChecks, LOOK_CHECK_ITEM_SCRIPT); 

All other further concerns, go on #fodev and contribute to the river of tears.

Re: Teleporting through dialog
« Reply #8 on: December 07, 2015, 11:23:21 pm »
Oh yes, in config.fos! Great, thanks. But the view is still limited, distant NPCs do not appear. I tested a few things and ST_PERCEPTION seem to limit that. Possibly through a script in client_fov.fos, but I haven't be able to determine which one...

Re: Teleporting through dialog
« Reply #9 on: December 08, 2015, 07:00:03 pm »
If you want full vision of everything all day everyday, just set  __LookNormal   to a really high value.

Re: Teleporting through dialog
« Reply #10 on: December 09, 2015, 11:48:40 am »
It worked! Thank you very much, devis.

Re: Teleporting through dialog
« Reply #11 on: December 10, 2015, 03:24:20 pm »
Yes, it's a new level for the oil rig. I'm uncomfortable with talking about the project further now, though. It's singleplayer, that's all I can tell.

OMG yes I still wait for fonline singleplayer game. Good luck and I wish you will complete and release game earlier than "soon" :)

Re: Teleporting through dialog
« Reply #12 on: December 10, 2015, 11:36:36 pm »
OMG yes I still wait for fonline singleplayer game. Good luck and I wish you will complete and release game earlier than "soon" :)

Well it won't be done anytime soon, although it's not a huge project. I'm running into several issues. Right now, a minor dialog editor issue is blocking me but otherwise the biggest problem will be about making the game singleplayer: removing the need to launch the server prior to the client, adding save/load features, cleaning up the FOnline SDK and so on. Ironically, my biggest problems are not related to my project but to the engine itself.

Offline Wipe

  • Rotator
  • Random is god
Re: Teleporting through dialog
« Reply #13 on: December 11, 2015, 01:09:39 pm »
Ironically, my biggest problems are not related to my project but to the engine itself.
Welcome to FOnline development :)
Games are meant to be created, not played...

Re: Teleporting through dialog
« Reply #14 on: December 11, 2015, 09:13:28 pm »
Those features are all "available" with the SDK.