Sign in to follow this  
SugarCarrot

[Modding] How can my character be able to stop the time?

Recommended Posts

SugarCarrot    1

I did one mod recently and i need to add an ability to stop the time(w hotkeys and stuff, yeah)

I tried to find some scripts(from Sakuya Izayoi mod, for example) but all was in vain, bc i add those scripts in modmain.lua and stuff, but there's a problem like

The game said that there's no "end" to close "if", but "end" WAS there and emmm...maybe y'all have some other scripts that works..? I'll be REALLY so pleased if ya have something like this

Edited by SugarCarrot

Share this post


Link to post
Share on other sites
Ultroman    696

How "stop time"? Does your character stop time for the whole server?

The error you're describing sounds like something that could be solved easily. You may simply have pasted it in at the wrong place or something. Do you still have a version of your mod with the code that gave you the error? If so, attach a zip of your mod to a reply so I can take a look.

Even if it complains about a missing "end", the error can be something else, like something else that isn't closed properly, leading it to misinterpret the source of the problem.

Share this post


Link to post
Share on other sites
SugarCarrot    1
31 minutes ago, Ultroman said:

How "stop time"? Does your character stop time for the whole server?

The error you're describing sounds like something that could be solved easily. You may simply have pasted it in at the wrong place or something. Do you still have a version of your mod with the code that gave you the error? If so, attach a zip of your mod to a reply so I can take a look.

Even if it complains about a missing "end", the error can be something else, like something else that isn't closed properly, leading it to misinterpret the source of the problem.

yeah, here's an ability to stop the time for the whole server, ig...

and um...i'll just leave this screen here 

image.png.dbba983f56c964cd487b17de1d815130.png

and the zip.file too

beb.zip

Share this post


Link to post
Share on other sites
Ultroman    696

With the zip you posted I get another error:

[00:04:05]: [string "scripts/networkclientrpc.lua"]:828: bad argument #1 to 'lower' (string expected, got nil)
LUA ERROR stack traceback:
        =[C] in function 'lower'
        scripts/networkclientrpc.lua(828,1)
        scripts/networkclientrpc.lua(846,1) in function 'AddModRPCHandler'
        scripts/modutil.lua(524,1) in function 'AddModRPCHandler'
        ../mods/extended sample character-DST/modmain.lua(374,1) in main chunk

This error stems from you using a variable called "characterName" in several places, but it isn't declared anywhere.

Edited by Ultroman

Share this post


Link to post
Share on other sites
SugarCarrot    1
49 minutes ago, Ultroman said:

With the zip you posted I get another error:


[00:04:05]: [string "scripts/networkclientrpc.lua"]:828: bad argument #1 to 'lower' (string expected, got nil)
LUA ERROR stack traceback:
        =[C] in function 'lower'
        scripts/networkclientrpc.lua(828,1)
        scripts/networkclientrpc.lua(846,1) in function 'AddModRPCHandler'
        scripts/modutil.lua(524,1) in function 'AddModRPCHandler'
        ../mods/extended sample character-DST/modmain.lua(374,1) in main chunk

This error stems from you using a variable called "characterName" in several places, but it isn't declared anywhere.

Aaand is that means that here's a trouble w those variables? Then, what should i do w them? 

Share this post


Link to post
Share on other sites
Ultroman    696

I hardly have an idea of what is happening here. I've never worked with networking stuff nor AddClassPostConstruct.

I did look at other mods, and noted that you have to include the path to the widget as the first parameter, as in:

AddClassPostConstruct("widgets/esctemplate_skillbutton", AddSkillButton)

However, after fixing this, I kept going through error after error, and now I have to thrown in the towel.

After fixing the above problem, I encountered that most of your code used TheWorld, which is not available in modmain.lua, where you instead have to use GLOBAL.TheWorld (an exception is that you MUST instead use TheWorld in modmain, if it is in a function which you do not call in modmain but only call from within a prefab or component, like your SetVal function in AddComponentPostInit("health", function ...blabla)). This leads me to believe that you may have copied code from a prefab/component Lua file from within which TheWorld IS available. This isn't a hard a problem to fix (and I did fix it), but I cannot fathom how you've stitched this rather elaborate mod together with the code as it is. Was it never tested during development? Is it all copy/paste from different sources?

The aforementioned SetVal function is also being completely overwritten in the health component of all entities which have one, which is pretty bad. If another mod (or even the game code) has extended the SetVal function for ANY entity, this approach effectively deletes their code completely, leading to the loss of a feature and quite possibly crashes. One should always extend existing game functions instead of overwriting them, where it is possible and applicable.

Another problem was that you're using two functions on the worldstate component which do not exist in neither DS nor DST, namely "pushCharacterHistory" and "clearCharacterHistory" (I could not find them in my searches of both DS game files, DST game files and my collection of mods, at least). You may have missed copying some code from whatever mod you copied it from, unless I've missed them in my search.

I only have a slight idea about how your mod works, since it's complex and I didn't build it and there are no comments. With this many errors I can't just start fixing problems, because I wouldn't have any idea of what "the correct code" should be, since I don't know what a lot of the code actually does or what it is supposed to do. The latter is only in your head right now.

I know this must all be frustrating to read, and I'm sorry for that. I don't know what to tell you :( I would start over, after familiarizing myself more with the functions and features I was trying to use, and maybe start with a simpler mod that doesn't require a lot of network and widget stuff, which are the some of the more finicky things to get right.

Sorry I can't be of more help :(

Edited by Ultroman

Share this post


Link to post
Share on other sites
SugarCarrot    1
10 hours ago, Ultroman said:

I hardly have an idea of what is happening here. I've never worked with networking stuff nor AddClassPostConstruct.

I did look at other mods, and noted that you have to include the path to the widget as the first parameter, as in:


AddClassPostConstruct("widgets/esctemplate_skillbutton", AddSkillButton)

However, after fixing this, I kept going through error after error, and now I have to thrown in the towel.

After fixing the above problem, I encountered that most of your code used TheWorld, which is not available in modmain.lua, where you instead have to use GLOBAL.TheWorld (an exception is that you MUST instead use TheWorld in modmain, if it is in a function which you do not call in modmain but only call from within a prefab or component, like your SetVal function in AddComponentPostInit("health", function ...blabla)). This leads me to believe that you may have copied code from a prefab/component Lua file from within which TheWorld IS available. This isn't a hard a problem to fix (and I did fix it), but I cannot fathom how you've stitched this rather elaborate mod together with the code as it is. Was it never tested during development? Is it all copy/paste from different sources?

The aforementioned SetVal function is also being completely overwritten in the health component of all entities which have one, which is pretty bad. If another mod (or even the game code) has extended the SetVal function for ANY entity, this approach effectively deletes their code completely, leading to the loss of a feature and quite possibly crashes. One should always extend existing game functions instead of overwriting them, where it is possible and applicable.

Another problem was that you're using two functions on the worldstate component which do not exist in neither DS nor DST, namely "pushCharacterHistory" and "clearCharacterHistory" (I could not find them in my searches of both DS game files, DST game files and my collection of mods, at least). You may have missed copying some code from whatever mod you copied it from, unless I've missed them in my search.

I only have a slight idea about how your mod works, since it's complex and I didn't build it and there are no comments. With this many errors I can't just start fixing problems, because I wouldn't have any idea of what "the correct code" should be, since I don't know what a lot of the code actually does or what it is supposed to do. The latter is only in your head right now.

I know this must all be frustrating to read, and I'm sorry for that. I don't know what to tell you :( I would start over, after familiarizing myself more with the functions and features I was trying to use, and maybe start with a simpler mod that doesn't require a lot of network and widget stuff, which are the some of the more finicky things to get right.

Sorry I can't be of more help :(

Ah, k, em... Maybe i should watch or read some tutorials abt this >з>

Anyway, thx you, ig i understand my mistakes and i'll fix this somehow uзu

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this