fodev.net

FOnline Development => General Discussion => Topic started by: Ulrek on April 13, 2011, 01:09:21 am

Title: How to get mercenaries in the FOnline SDK?
Post by: Ulrek on April 13, 2011, 01:09:21 am
Hey...

Well, i've looked over the files, and i've found settings, but i cant quite figure out how to create mercenaries/followers. can anyone point me in the right direction?

-Ulrek-
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Michaelh139 on April 13, 2011, 01:11:20 am
Pretty sure this is a 2238 only thing, ya know, they made and scripted themselves.  Unless you mean like, Followers from fo2?
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Ganado on April 13, 2011, 01:18:33 am
Unless you mean like, Followers from fo2?
I don't think that's part of the FOnline Engine SDK either.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Ulrek on April 13, 2011, 01:41:58 am
Quote
   /// Mercenary settings
#define MERC_BEGIN                  (800)
#define MERC_END                    (809)
#define MERC_COUNT                  (MERC_END-MERC_BEGIN+1)
#define MERC_MASTER_ID              (800) // Id õîçÿèíà ìåðêà
#define MERC_ALWAYS_RUN             (801) // Ïðèçíàê, ìåðê ïåðåìåùàåòÿ áåãîì ïðè ñëåäîâàíèè çà õîçÿèíîì
#define MERC_CANCEL_ON_ATTACK       (802) // Ïðèçíàê, îòìåíÿåò ëè ìåðê ñëóæáó, åñëè õîçÿèí àòàêóåò ñàìîãî ìåðêà.
#define MERC_LOSE_DIST              (803) // Äèñòàíöèÿ, ïðè ïðåâûøåíèè êîòîðîé ìåðê "îòñòàåò" îò õîçÿèíà è îòìåíÿåò ðåæèìå ìåðêà.
#define MERC_MASTER_DIST            (804) // Äèñòàíöèÿ, êîòîðîé ïðèäåðæèâàåòñÿ ìåðê â ðåæèìå ñëåäîâàíèÿ çà õîçÿèíîì
#define MERC_TYPE                   (805) // Òèï ìåðêà. Ñì. merc_h
#define MERC_DEFEND_MASTER          (806) // Ïðèçíàê: ìåðê çàùèùàåò õîçÿèíà, åñëè òîò àòàêîâàí
#define MERC_ASSIST_MASTER          (807) // Ïðèçíàê: åñëè õîçÿèí àòàêóåò öåëü, ìåðê ïðèñîåäèíÿåòñÿ ê àòàêå
#define MERC_CANCEL_TIME            (808) // Âðåìÿ çàâåðøåíèÿ ñëóæáû
#define MERC_CANCEL_ON_GLOBAL       (809) // Ïðèçíàê: ìåðê îòìåíÿåò ñëóæáó, åñëè õîçÿèí âûøåë íà ãëîáàëüíóþ êàðòó.

This is from the "_defines" file. so there does seem to be settings made for it. at least for a prototype.

Anyone have any ideas?

-Ulrek-
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Wipe on April 13, 2011, 01:57:22 am
This are only param numbers; check most obvious - merc.fos and q_npc_v13_dclaw.fos as an example of use. Eventually look for "Merc2Player" in other *.fos files.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Ulrek on April 13, 2011, 01:58:19 am
This are only param numbers; check most obvious - merc.fos and q_npc_v13_dclaw.fos as an example of use. Eventually look for "Merc2Player" in other *.fos files.

Alright, thanks.

-Ulrek-
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Janusz2238 on April 13, 2011, 01:08:27 pm
I write simple function for you. If you call it from dialog, you will get merc. I dond check any demand, so you can use it for build some more complex function. If you build more code, share with others.

Code: [Select]
#include "_defines.fos"
#include "_npc_pids.fos"

import bool GetFreeHex(Map& map, uint radius, uint16& hx, uint16& hy) from "caravan";
import void r_AddMerc2Player(Critter & player, Critter @ npc) from "merc";

// Dialog result
void r_AddMercenary(Critter& player, Critter@ npc)
{
Map @mapa = player.GetMap();
if(@mapa!=null)
{
uint16 hX = player.HexX;
uint16 hY = player.HexY;
GetFreeHex(mapa, 1, hX, hY);
Critter@ merc = mapa.AddNpc(NPC_PID_BountyHunter_10,  hX, hY, player.Dir,null,null,null);
r_AddMerc2Player(player, merc);
merc.Say(SAY_NORM_ON_HEAD, "I will save your ass Ulrek boy");
}
}
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Ulrek on April 13, 2011, 03:57:11 pm
Alright, if i manage to create something more complex i'd be happy to share.

And once again thank you.

-Ulrek-
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Janusz2238 on April 13, 2011, 04:16:28 pm
No problem. If someone else woudl use this code, I write instruction "just in case":
- make new script, and paste code from post; (file: your_script_file_name.fos)
- add script to scripts.cfg
Quote
@ server module your_script_file_name      
- add to dialog, result function(via dialog editor):
Code: [Select]
your_script_file_name@r_AddMercenary
(http://newfmc.pl/files/obrazki/DialogFunctionResult.png)
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Jimmy BoyX on April 19, 2011, 08:06:16 am
What mercenaries do I get? How it work? Can I make example in NCR mercenaries Rangers and in Navarro Enclave guys? What about prices?
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Janusz2238 on April 19, 2011, 08:29:38 am
You must implement prices by yourself.
Choose NPC in NCR, and edit his dialog file(Server/Dialogs). To edit dialog you use(/Server/Tools/DialogEditor).
You must add result script, I show it in last post.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: BlindMaster on May 30, 2011, 08:26:21 pm
How to chose an answer?
or dialog node?
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Surf on May 30, 2011, 08:29:14 pm
A good start would be to open the dialogeditor.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Cactus on July 22, 2011, 01:02:43 am
Heya, i was just wondering.. i need a way to set the AI to the merc. I can spawm him and he follows me only in local map.
Ive found that merc.fos is the main script for him and it includes merc dialog and all.
So there must be a way to link "merc.fos" or the AI to him.
At least a way to include it as a new AI package

Thanks
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: muhoooool on June 16, 2012, 07:55:41 pm
Hello!
Here is the scrip edit for proper mercs!
These guys attck and defend.

Code: [Select]
#include "_defines.fos"
#include "_npc_pids.fos"


import bool GetFreeHex(Map& map, uint radius, uint16& hx, uint16& hy) from "caravan";
import void r_AddMerc2Player(Critter & player, Critter @ npc) from "merc";

// Dialog result
void r_AddMercenary(Critter& player, Critter@ npc)
{
Map @mapa = player.GetMap();
if(@mapa!=null)
{
uint16 hX = player.HexX;
uint16 hY = player.HexY;
GetFreeHex(mapa, 1, hX, hY);
Critter@ merc = mapa.AddNpc(NPC_PID_MercenaryMale,  hX, hY, player.Dir,null,null,null); // NPC_PID IS NPC FROM _npc_pids.fos /server/scripts
r_AddMerc2Player(player, merc);
merc.Say(SAY_NORM_ON_HEAD, "Yessir");
merc.StatBase[ ST_AI_ID ] = 55; // AI OF NPC FROM _ai.fos /server/scripts ( set to vic defensive )
merc.StatBase[ ST_TEAM_ID ] = 0; // TEAM FROM _teams.fos ... set to plyer?
merc.StatBase[ ST_DIALOG_ID  ] = 30000; // DIALOG
merc.MercBase[ MERC_DEFEND_MASTER ] = 1;
merc.MercBase[ MERC_ALWAYS_RUN ] = 1;
merc.MercBase[ MERC_ASSIST_MASTER ] = 1;
merc.MercBase[ MERC_CANCEL_ON_ATTACK ] = 1;
merc.SetScript( "merc@_MercInit" );

}
}
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Donseluke on June 17, 2012, 07:24:44 pm
Nice work! simple too. Easy to understand. I imagine that slavery would be similar and would just need a little more beef in the middle when it comes to using a rope and such.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: muhoooool on June 17, 2012, 09:55:48 pm
Awesome idea!
Can you post the script when you figure it out!
Also it would be a good idea to STiCKY the figured out things! :)
Thanks
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Donseluke on June 18, 2012, 06:38:57 pm
Sure, i'll see what i can do. I think there will need to be new critters though. (Copied from certain critters that you want enslavable with a different name and ID and the originals having a pause coded in when knocked unconscious to do a call for the rope.) Would involve editing the rope proto, and the main.fos aswell maybe.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Pip.Boy.CZ on September 23, 2012, 09:57:40 pm
please guide for stupid. What I do not understand where attributed. Thank you.

For example: the name of the script -> Add the line "I am a moron" -> open dialog "blah blah" and add the line "I need a mercenary"
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: JovankaB on September 23, 2012, 10:14:19 pm
please guide for stupid. What I do not understand where attributed. Thank you.

For example: the name of the script -> Add the line "I am a moron" -> open dialog "blah blah" and add the line "I need a mercenary"

I don't understand your question. Use full phrases and try to explain the problem more clearly,
not some arrows and "blah blah". If you are too lazy to write a proper question, do not expect
much success with scripting.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: Pip.Boy.CZ on September 23, 2012, 10:20:43 pm
I do not know how can I add to my Fallout mercenaries. if I have to create / edit the script, or just edit the dialogue ... I did not understand it.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: JovankaB on September 23, 2012, 10:29:25 pm
I do not know how can I add to my Fallout mercenaries. if I have to create / edit the script, or just edit the dialogue ... I did not understand it.

The function in the script which adds mercenary does not run magically by itself, it must be triggered by something.
So you must for example call the function from a dialog (from dialog node result). So you need the script AND a dialog
which calls the scripts when talking to an NPC. Janusz2238 explained it quite clearly.
Title: Re: How to get mercenaries in the FOnline SDK?
Post by: SEGA_RUS on September 24, 2012, 12:00:18 pm
here (http://fonline.ru/forum/showthread.php?t=21430) u can find a very "crude" merc control
but there is a small trouble about control packets:
How to change it in real time?
How to add new control packets?(better with detailed FAQ)