Author Topic: *Scripting Thread*  (Read 88048 times)

0 Members and 1 Guest are viewing this topic.

Offline 51st Regiment Of Foot

  • First Lieutenant
  • *
  • Posts: 365
    • View Profile
  • Nick: 2nd Regiment
  • Side: Neutral
Re: *Scripting Thread*
« Reply #150 on: November 08, 2016, 12:46:02 am »
Hello, Im looking for a working script that prevent players to spawn only in their base flags on conquest mode.
Add me on steam 51st Sam

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #151 on: November 08, 2016, 05:42:49 pm »
How would I go about disabling the anticheat in NW? I'm making a module on it and I can't add items to units without it being removed. Or how would greenlight the items?
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.

Offline 51st Regiment Of Foot

  • First Lieutenant
  • *
  • Posts: 365
    • View Profile
  • Nick: 2nd Regiment
  • Side: Neutral
Re: *Scripting Thread*
« Reply #152 on: November 08, 2016, 06:06:09 pm »
How would I go about disabling the anticheat in NW? I'm making a module on it and I can't add items to units without it being removed. Or how would greenlight the items?
You can't; the way items are assigned be default is entirely based on the client troops.txt; anything the server says that troop can't have it just doesn't give, anything the client doesn't ask for isn't given. Best bet is removing all of the agent's items when they spawn as a certain class, and manually reassigning them equipment

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #153 on: November 09, 2016, 01:31:54 am »
So, the only requirement is that the clients troop.txt and the servers matches up? I think I've tried that before and it hasn't worked. I'll give it a try though and update.

UPDATE: Your method works for normal items. However, anything custom I've added in doesn't allow itself to be spawned.
« Last Edit: November 09, 2016, 01:44:27 am by nukey111 »
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #154 on: November 09, 2016, 02:31:53 am »
So, the only requirement is that the clients troop.txt and the servers matches up? I think I've tried that before and it hasn't worked. I'll give it a try though and update.

UPDATE: Your method works for normal items. However, anything custom I've added in doesn't allow itself to be spawned.

Not sure if you mean add items which don't exist in original NW, or just equipping troops with existing items. Since first option is impossible to do server-side only, I'll take it you mean the second.
Client's and server's troops.txt don't have to match in terms of equipment. But the only kind of change you can make in troops.txt is removing items, while adding items doesn't work. Additionally, spawning with inappropriate clothes (or empty clothes slot) will get you kicked, and this happens because of the anti-cheat check which you can alter or remove in module system.

When adding equipment it is best to leave troops file as it is, and alter the spawning agent's equipment in agent spawn common script in module_scripts. Of course you'd need to write the checks which equip agents based on some criteria (usually based on troop class, but it can be other stuff with some interesting results).

To help you out a bit:
-Check out treasure chest code for an example of how to remove an existing piece of clothes on head slot and equip a pirate hat server-side (module_scene_props.py)
-Search module_scripts.py for "kicked_for_cheating" or something like that to locate a check which is annoying you, from there you can alter or remove it but then keep in mind some hackers could spawn with wrong equipment types

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #155 on: November 09, 2016, 02:56:22 am »
Hey, sorry for that. I'm adding new, custom-made items, like chainmail armors, poleaxes, etc. I've removed any of the scripts (baring admin) referencing kicking the player, but I'm not too good with the script system and I can't get it to compile.
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #156 on: November 09, 2016, 03:17:47 am »
Ah, so you're building a full module that others are meant to download in order to play?
If that's the case you should edit this piece of code in module_scripts like this:
Code
     (try_begin),
       (eq,0,1), #G: this line will make sure this block of code never happens
       (eq,":must_kick",1),
       (str_store_player_username, s2, ":player_no"),
       (str_store_string, s4, "str_player_kicked_cheating_s2"),
           
       (call_script, "script_multiplayer_broadcast_message"), # Broadcast kicked message
       
       (kick_player, ":player_no"),
     (try_end),

That should work, but as for compile errors you are getting they may be caused by you messing up some other piece of code so idk, what errors are you getting exactly?

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #157 on: November 09, 2016, 02:10:28 pm »
UPDATE

I've implemented the changes you've brought up, and that fixes the anti-cheat problem. However I'd like to add the items in as their own pieces and have it spawn through troops.txt, as I'm redoing whole load outs with custom items. What would the check for new items be? Or is their a coded limit in NW?
« Last Edit: November 10, 2016, 12:18:11 am by nukey111 »
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #158 on: November 10, 2016, 03:06:23 pm »
Simply altering equipment in module_troops will often work good enough with a few caveats which you may run into and will have to try and fix them.

To add new items, you just add all the items into module_items.py, look at other items for examples. If your item is similar in function to some other item you can just copy/paste that other item's entry and change item ID, name and model name, along with tweeking other properties if needed. Item ID is for calling in code ("itm_new_armor"), name is the item name you see ingame, and model name is reference to model name as you named it in openBRF.

Order of the item on the list (in module_items.py) can sometimes matter, you can get unexpected bugs during game run, NW performs some checks where order of items count, I don't know them all by heart but it is best you just keep items of similar class grouped together (so for example put new pistol with old pistols), ideally add new items somewhere in the middle rather than below existing items of same class.

 If you added your items to module_items and equipped both players and bots with them in module_troops, and you still see naked people running around, check if you did rigging part properly (is your armor actually attached to the test model in 3e view of openBRF) and if not read up on some basic tutorials about adding items in NW or WB module systems.

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #159 on: November 11, 2016, 12:02:07 am »
See, that's the thing. All the models are rigged properly. They're all added properly- I've done it manually AND with Morgh's tool- and they'll show up on my character in the preview screen, however, my character wont _spawn_ with them. It doesn't make any sense, however, I guess it just doesn't like me :( I'll have to just remesh existing items and change their names/stats, which while is going to be excruciatingly aggravating, I don't have much of a choice I guess. Unless I'm full on missing something, I've gone through tutorials so many times with no success.
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.

Offline Thunderstormer

  • FSE Developer
  • ****
  • Posts: 6309
  • Worse than Hotler
    • View Profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #160 on: November 11, 2016, 12:08:29 am »
worse case scenario, you could go to the script that assigns you the items you spawn with, and have the game add them to you there.(or rather the troops class)   not the best way, but at least you can use the items.
Should you need to talk to me regarding NA1 or or something regarding admining or the admins, PM me here on the forums and not on steam.  *

*This does not include Official Server Admins.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #161 on: November 11, 2016, 12:39:39 am »
See, that's the thing. All the models are rigged properly. They're all added properly- I've done it manually AND with Morgh's tool- and they'll show up on my character in the preview screen, however, my character wont _spawn_ with them. It doesn't make any sense, however, I guess it just doesn't like me :( I'll have to just remesh existing items and change their names/stats, which while is going to be excruciatingly aggravating, I don't have much of a choice I guess. Unless I'm full on missing something, I've gone through tutorials so many times with no success.

Well reasons can be several, can you send me your entire module_items and module_troops files? Also names of items you added to troops in module_troops. There is probably some silly mistake you're making and it might be solved fast if I see the files.
« Last Edit: November 11, 2016, 12:43:52 am by Grozni »

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #162 on: November 11, 2016, 01:41:45 am »
https://gyazo.com/17e944214570db6e364d626548a7908f
https://gyazo.com/6801bbd84276c841d816748f8a63738a

I've redone the units and started it all fresh, so that's out of the issue now. But, it's giving me the weapon choice slide, allowing me to pick either the poleaxe or armor. How would I disable this and give it all to my troop?
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #163 on: November 11, 2016, 03:11:10 am »
Well I did ask for whole files for a reason, this way I can't say much except that if your poleaxe and armor are next to each other like in that sample you sent you should separate them and put them into proper places in a way I described two posts up.

Offline nukey111

  • Private
  • *
  • Posts: 26
    • View Profile
  • Nick: Roland
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #164 on: November 11, 2016, 03:41:37 am »
Do not argue with idiots. They will drag you down to their level, and then beat you with experience.