Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Questions and Answers / Re: How do we add effects to items?
« Last post by Slowhand on February 04, 2025, 10:32:21 am »
https://fodev.net/forum/index.php/topic,30344.msg263772.html#msg263772

Check that on how to change carry weight from extensions.

Once it works, all you need to do is change the formula based on your idea, an example would be if character has backpack in Slot 1 or Slot 2, they would receive extra carry weight and also this solution would be moderately simple to implement. Keep in mind to write simple changes or you will leave server hanging, crashing etc.

This is your current extension function for it:
Code: [Select]
EXPORT int getParam_MaxWeight(CritterMutual& cr, uint)
{
int val = max(cr.Params[ST_CARRY_WEIGHT] + cr.Params[ST_CARRY_WEIGHT_EXT], 0);
val += CONVERT_GRAMM(25 + getParam_Strength(cr, 0) * 25);
if(cr.Params[PE_PACK_RAT])
{
val*=4;
val/=3;
}
val+=20000;

const Item* armor=cr.ItemSlotArmor;
val+=checkBonus(armor, BONUS_ARMOR_CARRY_WEIGHT)*1000;

return CLAMP(val, 0, 2000000000);
}

You might want to add your change before where the conversion to gramms is called, for example to make the bag add 50 extra, you could do something like:

Code: [Select]
#define PID_BAG                             (46)
#define PID_BACKPACK                        (90)
#define PID_BROWN_BAG                       (93)

EXPORT int getParam_MaxWeight(CritterMutual& cr, uint)
{

int val = max(cr.Params[ST_CARRY_WEIGHT] + cr.Params[ST_CARRY_WEIGHT_EXT], 0);
int extra = 0;
if (cr.ItemSlotExt->Proto->ProtoId == PID_BACKPACK || cr.ItemSlotMain->Proto->ProtoId == PID_BACKPACK) {
extra += 50;
}
val += CONVERT_GRAMM(25 + getParam_Strength(cr, 0) * 25 + extra);
if(cr.Params[PE_PACK_RAT])
{
val*=4;
val/=3;
}
val+=20000;

const Item* armor=cr.ItemSlotArmor;
val+=checkBonus(armor, BONUS_ARMOR_CARRY_WEIGHT)*1000;

return CLAMP(val, 0, 2000000000);
}

So here I only change for backpack, but you would need to add the all the defines that your server uses for backpacks and change to code accordingly.

NOTE: I did not test it, as I want to make a more complex version, but should be able to get started from here.
22
Features & Articles / Re: FOClassic tutorials
« Last post by Slowhand on February 04, 2025, 10:19:02 am »
A small answer about extensions, for those who do not know what they are. These are DLL's stored in the script folder of your server that affect certain mechanics like if the critter can see another critter, most of their parameters like Strength, Carry Weight, etc. so when your AS script calls for these parameters, these are right before that, so they take effect. This would not be required since we have the engine source open, but before this, it was not open source and recompilable for devs, only AS script were. To change some crucial things, extensions were invented or something along these lines. So they are staying, note that if you cannot find something working differently than expected and you checked the engine and AS as well, you might want to check extension code if it exists for that specific change.

For those who never did it before - Recompiling extensions

Example how to change max character weight:
  • Follow the step in this guide where you earlier had to install Visual Studio 2017 with compile tools for Visual Studio 2010.
  • Launch the extensions solution via VS2017 found in: ../PReloaded/Server/extensions/extensions.sln
  • The IDE might ask questions about old solution file version, just accept all and let him transform to newer version.
  • Press Ctrl + Shift + F to search in all files in the project and search for weight finding the one of the result in parameters.cpp and do your desires changes
  • Now rebuild the solution and you are done, because the rebuild script will also copy the create DLLs to their respective place, in case it does not, you can find the DLLs in ../PReloaded/Server/extensions/Release/ folder and you need to copy them to your scripts folder ../PReloaded/Server/scripts/
23
General Discussion / Re: .
« Last post by Slowhand on February 04, 2025, 09:57:39 am »
If you had a question that you found answer for, then please do not remove topics like this, instead leave the original question and post your answer/solution.
24
Share Your Work / Discord Status Server
« Last post by kompreSor on February 04, 2025, 09:53:01 am »
Hello everyone, 

Since the FOnline Status from fodev has been down for a while, I decided to create an alternative. I've set up a Discord server where bots display the current number of players on various FOnline servers and log historical player counts for reference. 

If any servers are missing, please send me a private message—preferably on Discord. Your message should include: 
- Server name 
- IP address 
- Port 
- Avatar image for the bot 
- Server website link 
- Server Discord link 

https://discord.gg/7hCvxz2GsH
25
General Discussion / Re: [ How to ] SDK - Fixboy - Craft time
« Last post by Vaultpunk on January 30, 2025, 09:44:44 pm »
nice
26
General Discussion / .
« Last post by Vaultpunk on January 27, 2025, 01:18:20 pm »
remove topic because bad question
27
General Discussion / Re: SDK - Fixboy - Craft time
« Last post by Feltzer on January 19, 2025, 12:00:25 am »
ty based kilgore


You probably need a small workaround for that in main.fos

for example, to remove the cooldown completely, put this inside void items_crafted:

Code: [Select]
    uint[] param(1);
    param[0] = crafter.Id;
    CreateTimeEvent(__FullSecond+REAL_SECOND(0), "_CraftingTimeOutPatch", param, false);

and this outside of void items_crafted:

Code: [Select]
uint _CraftingTimeOutPatch(uint[]@ Id)
{
        Critter@ crafter = GetCritter(Id[0]);
        crafter.TimeoutBase[TO_SK_REPAIR] = __FullSecond+REAL_SECOND(0);
        crafter.TimeoutBase[TO_SK_SCIENCE] = __FullSecond+REAL_SECOND(0);
        return 0;
}

Took it from Xenom long ago.
To set craft timeout you'd need to identify the type of item crafted and set appropriate cd.

hope it helps, cheers
28
Questions and Answers / How do we add effects to items?
« Last post by cthulchu on January 03, 2025, 11:22:38 pm »
Hi there!

I don't think we have a guide on how to add special effects to items. I use the FOClassic engine.

My particular case is something I saw on fo3: I want bags and backpacks to add a percentage to player's max carry weight when equipped in hands.

I looked at how other things are implemented like the mirrored shades, but I'm not sure about all the steps I need to take to properly add some logic to an item. It would be great if someone could share the steps. Thanks!
29
Share Your Work / Re: How Do I Do With a simple textEditor.
« Last post by remake on October 26, 2024, 12:37:13 pm »
SublimeText is free to use in lifetime but it is a shareware... it pop up shitty window to buy license every use of ST's features. You can crack it easily if it's too disturbing...
Even easier - you can buy personal license. One license for all your workstations and all OS. 99 USD it's not so expensive for that.
30
Share Your Work / How Do I Do With a simple textEditor.
« Last post by adumbperson on October 19, 2024, 04:10:10 pm »
Hello Everybody.

I saw people speaking bad about the tools... alike they are unreliable...  :-X

You should be very careful to what you say in programming. It says a lot about your background.

hacker's manifesto "I don't care who/how you are, I care to what you say."

First of all, learn C programming and Then C++ then you'll be very comfortable to use the SDK.

I personnaly use Sublime Text 3 to do all my coding. I never been comfortable using Integrated Development Editor...

SublimeText is free to use in lifetime but it is a shareware... it pop up shitty window to buy license every use of ST's features. You can crack it easily if it's too disturbing...

Here are my building tools that I integrated myself to Sublime Text's building(popen) system.

requirement: You need append full path to ascompiler to your system PATH environment to be able to use it.

like so.
Code: [Select]
;C:\Users\UserName\Desktop\r513.sdk\Tools\ASCompiler
definition: This trigger ascompiler(using defines from server/mapper/client) on the actual file you working on. It permits to track development error(s).

filename: C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\User\AsServer.sublime-build
Code: [Select]
{
        "shell_cmd": "ASCompiler.exe $file"
}

filename: C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\User\AsMapper.sublime-build
Code: [Select]
{
"shell_cmd": "ASCompiler.exe $file -mapper"
}

filename: C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\User\AsClient.sublime-build
Code: [Select]
{
"shell_cmd": "ASCompiler.exe $file -client"
}

You trigger them by selecting the one you want into build system option from SublimeText3 and using ctrl+b

it returns something like this in a pane bottom the editor:
Code: [Select]
Compiling C:\Users\UserName\Desktop\r513.sdk\Server\scripts\guard.fos ...
Success.
Time: 453.552 ms.
[Finished in 0.6s]

To exclude compiled files into the sublime text's file browser.
filename: C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\User\Preferences.sublime-settings
Code: [Select]
{     
        "file_exclude_patterns":
[
"*.fosb",
"*.fosp"
]
}

To have syntax color with *.fos scripts.
filename:C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\User\C++.sublime-settings
Code: [Select]
{
"extensions":
[
"cpp",
"cc",
"cxx",
"c++",
"h",
"hpp",
"hxx",
"h++",
"inl",
"ipp",
"fos"
]
}

Happy hacking.
Pages: 1 2 [3] 4 5 ... 10