Forum

> > Stranded II > Maps/Editor > keyhitxx script not working for me
Forums overviewStranded II overview Maps/Editor overviewLog in to reply

English keyhitxx script not working for me

11 replies
To the start Previous 1 Next To the start

old keyhitxx script not working for me

ModJuicer
Super User Off Offline

Quote
I have been trying for a while now, and although it seems mind-bogglingly simple I still cannot get this to work.

I am writing code in game.inf to make so different keys would trigger global events to make it easier to write multiplayer scripts because multiplayer scripts don't allow the msgbox command thus I need a new way of doing multiple actions. Also, using keys are simpler.

Even after all my years in modding stranded II, this simple problem has stumped me. I can't figure out why it doesn't work

also, i've tried doing it without "global" added, and it didn't work. (Adding "global" to the end didn't change anything, though.)

My code that doesn't work in game.inf >



my debugging code >



note: I misclicked and put this in Maps/Editor. If a moderator sees this, can you please put it in scripts?
edited 1×, last 07.05.21 02:06:45 am

old Re: keyhitxx script not working for me

JasJack67
Super User Off Offline

Quote
you probably didn't assign the key to be a scripted key when hit. Add this to the top pf your game.inf file with the other assigned settings.
1
2
3
4
5
scriptkey = 16
scriptkey = 17
scriptkey = 18

etc.

old Re: keyhitxx script not working for me

ModJuicer
Super User Off Offline

Quote
It won't work with any ids over 20, which is fine if I just want to only use about five letters, but I need more than that.

Maybe someone knows how to get around this.
Anyone? user DC ? user JasJack67 ?
edited 2×, last 18.05.21 07:55:36 pm

old Re: keyhitxx script not working for me

DC
Admin On Online

Quote
Sorry, this is indeed limited to 20 keys. See https://www.strandedonline.de/s2_definitions.php?#game - description available in German only though. There is no way around this. To change it you would have to change the source code of the game.

20 is a rather arbitrary limit that I used back then because I though that this must be enough and that supporting more keys would be too slow anyway. It probably wouldn't be an issue to increase that value.

old Re: keyhitxx script not working for me

ModJuicer
Super User Off Offline

Quote
So that was why it was only limited to 20... That helps. I'll check this out.

Edit: That is just for keys that are already being used. I want to use keys that aren't currently in use to avoid accidently doing two things at once. This is for the Battle Mod, by the way, so it's important.

Maybe I'll just skip that and scrap all my complex code for a simpler method, like holding down (using keydownxx) for rapidfire (one of the uses planned) and then using keyreleasexx to stop the shooting. Maybe right click for bomb and so on. The key combos could get pretty complex though, because I'm have script for dropping bombs, shooting bullets, shooting rockets (both types), and there may be even more functions in the future.

Code that needs this >


user JasJack67 : Maybe you could help work on the battle mod. My newest project. If I can fix some of these problems I'm having I'll probably pause progress and Stranded II Enhanced and focus completely on the battle mod, which would finally be something completely original for me.
edited 2×, last 20.05.21 03:07:52 am

old Re: keyhitxx script not working for me

JasJack67
Super User Off Offline

Quote
You are mistaken...look carefully ingame in OPTIONS: There is Controls 1 and Controls 2.

Controls 2 is all the scripted keys you added in the game.inf. You CLICK ON THE KEY THERE AND CHANGE IT TO WHAT EVER KEY YOU WANT TO.

When you zip the game for others to download, the keys will be saved/set to what YOU set them to.

I have no time currently to work on my mod, or a new mod, thank you for the invite though. However, I will try to help you through any issues, as you move forward...as we do here in the forum.

old Re: keyhitxx script not working for me

ModJuicer
Super User Off Offline

Quote
Thanks. I'll see if I can make more progress on it.

It worked!

Here's some pictures of the results:

https://www.mediafire.com/view/e9uvd2kbidthlhh/screen_00019.bmp/file
https://www.mediafire.com/view/ahxaatp471ax9am/screen_00018.bmp/file
https://www.mediafire.com/view/b8knyp8u1y4syk0/Screenshot_%2528111%2529.png/file
https://www.mediafire.com/view/da1i5i39j201eh0/Screenshot_%2528110%2529.png/file
edited 2×, last 20.05.21 11:21:26 pm
To the start Previous 1 Next To the start
Log in to reply Maps/Editor overviewStranded II overviewForums overview