Author Topic: FOnline SDK - Question  (Read 168612 times)

Offline Wipe

  • Rotator
  • Random is god
Re: FOnline SDK - Question
« Reply #450 on: September 05, 2013, 05:05:44 pm »
2) I've managed to create a map. How would I use admin commands to teleport to the map? I haven't modified any files to refer to it, if that is of any importance. The map is called "AAAFirst".
Map names are unused by scripts, all what you work on are Locations and Maps PIDs (Prototype ID). From basic commands provided by engine, ~addloc wil be the one interesting you. Depending on what server you work on, there might be scripted commands too. In any case, they create new Location instance (and optionally teleport you into first Map of it) what is enough for testing purposes.
 
4) Is there a collection of example scripts with comments on what each part does? Without any documentation, it might as well be written in a dead language for a newb such as myself.  :-[
One of biggest problems of FOnline :P If you need to get examples, you have to make research on your own, sadly~

Edit1 (05/09/2013, 13:59 GMT): 7) Where can I get the file "MAPS.TXT"? It's referenced in the "Locations.cfg" file, but there isn't one with the fo2238 source.
Obsolete; leftover from previosly used SDK mechanics, where Locations and Maps was defined in separated files.
Games are meant to be created, not played...

Re: FOnline SDK - Question
« Reply #451 on: November 01, 2013, 05:31:30 pm »
Alright, I finally got it set up(after finally deciding to take a minute to read and such) but here's some questions that popped up:

can I use Tunngle(it provides me an IP address) to have people join my network as long as they have Tunngle?

I've noticed some text is in Russian(the NPC's that aren't controlled by the language filter) how can I change that?

Re: FOnline SDK - Question
« Reply #452 on: November 01, 2013, 05:57:12 pm »
I was able to have friends connect to my server via hamachi so I guess tunngle would work.

Re: FOnline SDK - Question
« Reply #453 on: November 01, 2013, 07:00:02 pm »
Alright, that answered one question, and to you/anyone, what about the character chats in Russian?

figured out how to open the "console" and now my problem is it's in Russian.
« Last Edit: November 02, 2013, 07:56:06 pm by GeneralSturnn »

Re: FOnline SDK - Question
« Reply #454 on: September 12, 2016, 05:40:00 pm »
You can collect all town Locations inside start() function and set turn based mode for every Map inside. Assuming that every town exists only in one copy:
Code: [Select]
array<uint> tbTowns = { LOCATION_Den, LOCATION_Klamath, LOCATION_Whatever };
for( uint t=0, tLen=tbTowns.length(); t<tLen; t++ )
{
    Location@ location = GetLocationByPid( tbTowns[t], 0 );
    if( valid(location) )
    {
        for( uint m=0, mLen=location.GetMapCount(); m<mLen; m++ )
        {
            Map@ map = location.GetMapByIndex(m);
            if( valid(map) )
            {
                map.SetTurnBasedAvailability( true );
            }
        }
    }
}

Nice that is possible set all locations in one place. How implement to this code players settings (combat mode depends on config) ?

Re: FOnline SDK - Question
« Reply #455 on: December 20, 2016, 05:51:50 pm »
Is there any commands that would allow me to reset/redo quests?
If so where can I find the quest ID's?
I'm also interested in this. I'm considering rerolling my character(s), but I'd like to keep all the stats. I'd also like to be able to retry certain quests, if something goes wrong on the first try and the quest fails. Therefore, I present to you these questions:

1. How do I change the status of a quest (failed, completed, in progress)?
2. Is there a way to give / remove a quest from a character?
3. How do I set a character's town reputation level?
4. How do I set kill counts?
5. Is there a way to "purge" faction member database and prevent it from being cluttered by "player not found" entries? Or alternatively, is there a way to create a new character with the same ID as the old one?

Offline Lexx

  • Rotator
  • Mexican Apple Thief
Re: FOnline SDK - Question
« Reply #456 on: December 21, 2016, 09:00:52 am »
You will have to reset the local variables of the character. There is no unified "undo quest x" command, as they are basically just a bunch of variables.

Re: FOnline SDK - Question
« Reply #457 on: December 26, 2016, 08:01:37 pm »
You will have to reset the local variables of the character. There is no unified "undo quest x" command, as they are basically just a bunch of variables.
Thanks for the hint, I was able to figure out how to change kill counts, reputation values and quest statuses. It took a bit of digging, but eventually it paid off. This is how kill counts and reputation values can be set, in case someone else is wondering the same thing. The clues were found in _defines.fos file.

Kills:
`param 0 260 3
   --> Kills: 3 men
260 Men
261 Women
262 Children
263 Super Mutants
264 Ghouls
265 Brahmin
266 Radscorpions
267 Rats
268 Floaters
269 Centaurs
270 Robots
271 Dogs
272 Manti
273 DeathClaws
274 Plants
275 Geckos
276 Aliens
277 Giant Ants
278 Big Bad Boss
279 Desert Stalkers
280 Venus Man Traps
281 Rad Toads
282 Thornslingers
283 Pashtshuurs

Reputation:
`param 0 602 3
   --> Brotherhood of Steel reputation 3
602 Brotherhood of Steel
603 The Enclave
604 The Unity
605 New California Republic
606 Citizens of Vault City
607 Raiders
608 Mordino Family
609 Slaver's Guild
610 The Slags
611 Kokoweef Mine
612 Morningstar Mine
613 Broken Hills Humans
614 Broken Hills Mutants
615 Wright Family
616 Bishop Family
617 Salvatore Family
618 NCR Rangers
619 Vortis' Slavers
620 Communists
621 Tanker Vagrants
622 Crypts
623 Fools
624 Hub Criminals
625 Crimson Caravans
626 Far Go Traders
627 Water Merchants
628 The Heights Residents
629 Regulators
630 LA Scavengers
631 Gun Runners
632 Followers of the Apocalypse
633 Bounty Hunters
634 Free Traders
635 Guttersnipes
636 FLC
637 Slaves
638 Lara's Gang
639 Children of the Cathedral
640 New Reno Sex Workers
641 Hubologists
642 Cathedral of the Lost
643 New Reno Corsican Brothers
680 Klamath Citizens
681 Den Citizens
682 Modoc Citizens
683 Courtyard Citizens
684 Gecko Ghouls
685 Redding Citizens
686 Broken Hills Ghouls
687 Population of New Reno
688 Necropolis Ghouls
689 Junktown Citizens
690 Hub Citizens
691 LA Citizens

Changing quest statuses was a bit harder nut to crack, but this is how it can be done:
Open the correct map in Mapper and click on the NPC who gives you the quest. Make note of the number after ST_DIALOG_ID.
Open _dialogs.fos and search for the dialog number. This will reveal you the dialog name.
Open the correct dialog file in Dialog Editor and look for the name of the quest and what values it can have.
Open _vars.fos and do a search using the name of the quest in order to find out its ID number.
Now you know the quest ID and the values it can have.
Then use ~myinfo command to see your character ID.
Then use the command "~setvar tid_var master_is_npc master_id slave_id value" without quotes.
I don't know what the other parameters do, but everything seemed to work fine when I set them to 0 like this:
~setvar [quest ID] 0 [character ID] 0 [value]

Offline Lexx

  • Rotator
  • Mexican Apple Thief
Re: FOnline SDK - Question
« Reply #458 on: December 27, 2016, 06:37:34 am »
Quest ID isn't the only thing a quest has. There can be a truckton more variables assigned to the NPC or the player. It might already be enough just to have one more local variable that prevents a dialogue from appearing twice.

Re: FOnline SDK - Question
« Reply #459 on: March 18, 2018, 05:02:54 pm »
*bump*


How to use the following function?

Code: [Select]
void Action  ( int  action,   int  actionExt,  Item @+  item  )


I am trying to add a function to the GUI, in which you CTRL-Click any item in your inventory and it equips/uses/consumes certain items based on their type. I have been trying with MoveItem but then i found this function and its exactly what i need.

But for some reason it doesn't work at all, i could only make it work with ACTION_DODGE for testing and those which do not have parameters or item defined for them, so i guess the problem lies there.

the idea is simple, i ctrl+click an armor in my inventory and the character takes off the armor and puts on the new one
Code: [Select]
target.Action(ACTION_MOVE_ITEM_SWAP, SLOT_ARMOR, itm);   //this doesnt work

Re: FOnline SDK - Question
« Reply #460 on: March 18, 2018, 05:37:20 pm »
If I'm not mistaken, void Action is a server side function that has to do something else than you're trying to. If you follow the documentation, this function calls client local binded "critter_action" func with send arguments. I think that if you are working with client side, you might consider using SetChosenActions function instead, it's pretty simple and effective when it comes to scripting player character behaviour.

Like, i.e if you want a player critter to move armor item from armor slot to inventory you might doing it like this:
                   
   
Code: [Select]
uint[] actions = {CHOSEN_MOVE_ITEM, item.Id, 1, SLOT_INV, 0,0};
SetChosenActions(actions);

Try searching through your scripts for CHOSEN_MOVE_ITEM to find all list of possible types of actions and their arguments.

P.S As I get the logic chain, both Critter.Action on server side and SetChosenAction on client side ends up in some code on client side. Critter.Action might possible be used when you want a server to ask a client to do something that server can't. Also for Critter.Action aswell as SetChosenActions you might probably to create your own logic in critter_action that will process recieved arguments as you wish.

P.P.S Looking at my own critter_action, it seems like it helps to perform some "additional" stuff on top of hardcoded thingies that happen when you use those methods.
« Last Edit: March 18, 2018, 06:25:15 pm by Vice Dice »

Re: FOnline SDK - Question
« Reply #461 on: March 18, 2018, 06:43:05 pm »
If I'm not mistaken, void Action is a server side function that has to do something else than you're trying to. If you follow the documentation, this function calls client local binded "critter_action" func with send arguments. I think that if you are working with client side, you might consider using SetChosenActions function instead, it's pretty simple and effective when it comes to scripting player character behaviour.

Like, i.e if you want a player critter to move armor item from armor slot to inventory you might doing it like this:
                   
   
Code: [Select]
uint[] actions = {CHOSEN_MOVE_ITEM, item.Id, 1, SLOT_INV, 0,0};
SetChosenActions(actions);

Try searching through your scripts for CHOSEN_MOVE_ITEM to find all list of possible types of actions and their arguments.

P.S As I get the logic chain, both Critter.Action on server side and SetChosenAction on client side ends up in some code on client side. Critter.Action might possible be used when you want a server to ask a client to do something that server can't. Also for Critter.Action aswell as SetChosenActions you might probably to create your own logic in critter_action that will process recieved arguments as you wish.

P.P.S Looking at my own critter_action, it seems like it helps to perform some "additional" stuff on top of hardcoded thingies that happen when you use those methods.

thanks, managed to make it work that way.

here it is, if anyone is interested

Code: (client_interface.fos, include chosen_actions_h.fos) [Select]
if(GUI_GetActiveScreen() == CLIENT_SCREEN_INVENTORY && GUI_IsKeyPressed(0x1D)) // CTRL click equip/consume/use
{
if(item.GetProtoId()==PID_ADVANCED_BENCH || item.GetProtoId()==PID_WORKBENCH_RAIDERS || item.GetProtoId()==PID_AMMO_FACILITY || item.GetProtoId()==PID_WORKBENCH || item.GetProtoId()==PID_MED_MACHINE ||  item.GetProtoId()==PID_WORKBENCH_PRIMITIVE || item.GetType()==ITEM_TYPE_CONTAINER)
return "";

if(item.CritId > 0 && valid(item) && item.CritId == chosen.Id)
{
if((item.GetType() == ITEM_TYPE_ARMOR) && ((item.GetProtoId() >= 719) && (item.GetProtoId() <= 749)) ) // check for helmet, 723 and 724 *should* probably be excluded
{
Item@ slotItem = chosen.GetItem(0, SLOT_HEAD);
if(valid(slotItem) && (item.Id == slotItem.Id) )    // check if the clicked item is in one of the inventory slots
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_INV, 0, 0, 0};    // if yes, put it back to the inventory
SetChosenActions(action);
}
else
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_HEAD, 0, 0, 0};    // if not, put it in an active slot
SetChosenActions(action);
}

}
else if(item.GetType() == ITEM_TYPE_ARMOR)
{
Item@ slotItem = chosen.GetItem(0, SLOT_ARMOR);
if(valid(slotItem) && (item.Id == slotItem.Id) )
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_INV, 0, 0, 0};
SetChosenActions(action);
}
else
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_ARMOR, 0, 0, 0};
SetChosenActions(action);
}

}
if(item.GetType() == ITEM_TYPE_WEAPON)
{
Item@ slotItem = chosen.GetItem(0, SLOT_HAND1);
if(valid(slotItem) && (item.Id == slotItem.Id) )
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_INV, 0, 0, 0};
SetChosenActions(action);
}
else
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_HAND1, 0, 0, 0};
SetChosenActions(action);
}

}
if(item.GetType() == ITEM_TYPE_MISC || item.GetType() == ITEM_TYPE_AMMO || item.GetType() == ITEM_TYPE_KEY)
{
Item@ slotItem = chosen.GetItem(0, SLOT_HAND2);
if(valid(slotItem) && (item.Id == slotItem.Id) )
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_INV, 0, 0, 0};
SetChosenActions(action);
}
else
{
array<uint> action = {CHOSEN_MOVE_ITEM, item.Id, item.GetCount(), SLOT_HAND2, 0, 0, 0};
SetChosenActions(action);
}

}
if(item.GetType() == ITEM_TYPE_DRUG)
{
array<uint> action = {CHOSEN_USE_ITEM, item.Id, item.GetProtoId(), TARGET_SELF, chosen.Id, ITEM_MODE_USE, 0};    // Use drugs via ctrl+click
SetChosenActions(action);

}
}
}




i'm curious whether similiar implementation can be applied to Barter dialog or not
« Last Edit: March 18, 2018, 07:21:01 pm by Zinthos »

Re: FOnline SDK - Question
« Reply #462 on: April 12, 2018, 01:31:15 pm »
Is it possible to animate a critter in a range of frames?

For example, i choose an animation set, like USE and i specify that only the frames 3,4,5 will play

Re: FOnline SDK - Question
« Reply #463 on: December 13, 2018, 09:25:28 pm »
You can collect all town Locations inside start() function and set turn based mode for every Map inside. Assuming that every town exists only in one copy:
Code: [Select]
array<uint> tbTowns = { LOCATION_Den, LOCATION_Klamath, LOCATION_Whatever };
for( uint t=0, tLen=tbTowns.length(); t<tLen; t++ )
{
    Location@ location = GetLocationByPid( tbTowns[t], 0 );
    if( valid(location) )
    {
        for( uint m=0, mLen=location.GetMapCount(); m<mLen; m++ )
        {
            Map@ map = location.GetMapByIndex(m);
            if( valid(map) )
            {
                map.SetTurnBasedAvailability( true );
            }
        }
    }
}

While this works unexpectingly (works on all maps for me, regardless of added to the list or not) the AI somewhat lacking when it can't reach you, so you have to wait until it's panic ends with a timeout.
Anyone tried to optimize AI for a turn based mode?
« Last Edit: December 13, 2018, 09:28:28 pm by Voiddweller »