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

0 Members and 1 Guest are viewing this topic.

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #45 on: September 07, 2013, 09:29:06 pm »
Found by myself.

Beneath #reset ze treasure just add this piece of the code for the prop you placed you'd like to remove.
  #reset ammo crates
      
Code
(scene_prop_get_num_instances, ":num_instances_of_scene_prop", "spr_ammobox"),
   (try_for_range, ":cur_instance", 0, ":num_instances_of_scene_prop"),
(scene_prop_get_instance, ":cur_instance_id", "spr_ammobox", ":cur_instance"),
(scene_prop_slot_eq, ":cur_instance_id", scene_prop_slot_is_spawned,1),
# (call_script, "script_clean_up_prop_instance", ":cur_instance_id"),
(call_script, "script_clean_up_prop_instance_with_childs", ":cur_instance_id"),
  (try_end),



Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #46 on: November 29, 2013, 03:16:14 am »
I downloaded the source code from NW's Moddb page. When I open the "build_module.bat" I can't find where to place the path for my mod, any help?

Offline Gokiller

  • Almost Pride of Ni
  • Major General
  • **
  • Posts: 3913
  • Bydand in the chat lads!
    • View Profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #47 on: November 29, 2013, 09:15:04 am »
module_info.py

Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #48 on: November 29, 2013, 09:27:09 pm »
module_info.py

Ahhh thats right! Thanks mate, feel ridiculous now.

Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #49 on: December 01, 2013, 08:17:18 pm »
Does anyone know where the sailor clothing items are? I can't find them in "module_items.py"

Offline Gokiller

  • Almost Pride of Ni
  • Major General
  • **
  • Posts: 3913
  • Bydand in the chat lads!
    • View Profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #50 on: December 01, 2013, 09:00:24 pm »
Just look for their name in the BRF and use the name that is being used in there in the search function on the module_items.py

Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #51 on: December 04, 2013, 04:52:42 am »
I just figured that it wasn't implemented and I added it. But another problem, I'm adding custom meshes to a faction in "module_items.py" and it is textured in Brf, but not in the game.

Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #52 on: November 26, 2014, 05:58:56 am »
bump, still having trouble with the question above almost a year later

Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #53 on: November 26, 2014, 06:09:13 am »
Oh also I try to add an item in the source code under, "Module_Items," and it just seems to never work so I assume I'm doing something wrong there.

Offline Mercuri

  • Second Lieutenant
  • *
  • Posts: 346
  • Spanish King's Walloon Guard
    • View Profile
    • Comunidad Gamer Hispana
  • Nick: 2aBH_Mercuri / 5thFL_JacksonTeller
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #54 on: November 26, 2014, 09:59:26 am »
I just figured that it wasn't implemented and I added it. But another problem, I'm adding custom meshes to a faction in "module_items.py" and it is textured in Brf, but not in the game.

When you create a new object and add it to game you must edit 3 BRFs in order to it be textured ingame.

Example. You want to create a new uniform in the French Faction. You must edit:
1. mm_french_uniforms.brf (here you import the .smd object)
2. mmmaterials.brf (here you create the material that you assigned to the imported items and for that material you must to assign the textures with the same name that you used to save the .dds in the Texture folder)
3. mmtextures.brf (here you must to create the textures that you assigned to the material with the same name that you used to save the .dds in the Texture folder)

Oh also I try to add an item in the source code under, "Module_Items," and it just seems to never work so I assume I'm doing something wrong there.

Go to module_items.py, search the item that you want your newitem was based, copy it and paste it just later, change the name of the new item and the name of the mesh (name you used in the .brf) of that item.

I think that's your problem.
Cheers.


« Last Edit: November 26, 2014, 10:05:25 am by Mercuri »

Offline Brawn

  • First Sergeant
  • *
  • Posts: 237
  • The Princess of trash, and schedule two narcotics.
    • View Profile
  • Nick: Dobson
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #55 on: November 26, 2014, 07:02:51 pm »
Thanks man, will try it when I reach my comp!

Offline Victorcin

  • Second Lieutenant
  • *
  • Posts: 67
    • View Profile
    • SpainIsLife
  • Side: Neutral
Re: *Scripting Thread*
« Reply #56 on: November 27, 2014, 09:03:06 am »
I have three questions:

1) How can I hide faction in the game?I have been searching and I didn´t found anything that is effective.


2) Can you spawn one prop in a scene?. Example, the character is in a certain place on the map and want to invoke a cannon and appears.

3) It is possible spawn civilians in a scene, or guards at a particular scene (like the citizens of the cities of the native)

Thanks,
Cheers.  :)
« Last Edit: November 27, 2014, 01:29:40 pm by Victorcin »
He visto lo bastante de una guerra para no desear volver a ver otra.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #57 on: December 01, 2014, 01:43:56 pm »
I have three questions:

1) How can I hide faction in the game?I have been searching and I didn´t found anything that is effective.


2) Can you spawn one prop in a scene?. Example, the character is in a certain place on the map and want to invoke a cannon and appears.

3) It is possible spawn civilians in a scene, or guards at a particular scene (like the citizens of the cities of the native)

Thanks,
Cheers.  :)


1) here, https://www.fsegames.eu/forum/index.php?topic=20171.0

2) yes you can, dig through NW module system source for ways to spawn props.
And yes, you can trigger scripts when character is in a certain place, one possible way would be to create new invisible scene prop (for example lets call it "trigger_cannon_spawn"), place it where you want on map,
then write trigger in module_mission_templates which will fire each second or something like that, checks if there are any "trigger_cannon_spawn" props in the scene, and for each found iterate through all agents (characters) in the scene and compare positions between trigger scene prop and agent to find out if the two are near enough to make something happen.
I'm too busy atm to write code for you, but if you're serious about modding then you'll get enough info from code already written by others.

3) yes its possible, for examples of spawning visitors to the scene I think it would be best to check out the native module system source rather than NW.

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #58 on: December 09, 2014, 07:27:13 pm »
I have three questions:

1) How can I hide faction in the game?I have been searching and I didn´t found anything that is effective.


2) Can you spawn one prop in a scene?. Example, the character is in a certain place on the map and want to invoke a cannon and appears.

3) It is possible spawn civilians in a scene, or guards at a particular scene (like the citizens of the cities of the native)

Thanks,
Cheers.  :)


1) I described the best procedure you should follow in NW in this very topic https://www.fsegames.eu/forum/index.php?topic=20171.msg872073#msg872073

2) Absolutely! Let's take your example: spawn a cannon on a player that has pressed a certain button. First of all, bear in mind that spawning stuff MUST be always done serverside, so whatever you're going to do, do it on a server-side trigger (multiplayer_is_server), = your keyword to find or add serverside stuff, or inside server event. Afterwards, you are going to need to call the following commands. Let's assume it's a trigger and you know which agent you're dealing with:

Code
(agent_is_active, ":agent_id"),
(agent_is_alive, ":agent_id"),

(agent_get_position, pos1, ":agent_id"),
(set_spawn_position, pos1),
(spawn_scene_prop, "spr_scene_prop_name"),

That's really all you need. You can modify the position, rotate the prop, put it in a loop, etc... But I dont want to ruin all the fun that comes with modding and coding  ;) Feel free to ask any questions that come to your mind though. You can also spawn items instead of scene props. In this case, all you need to do is use the following code:

Code
(agent_is_active, ":agent_id"),
(agent_is_alive, ":agent_id"),

(agent_get_position, pos1, ":agent_id"),
(set_spawn_position, pos1),
(spawn_item, "itm_rockets", 0, 300), #300 seconds(5 minutes) is the time after that the items gets despawned if it remains on the ground

3) Yes, you could look into commands like spawn_agent or spawn_horse , but i cannot really say how or if they work in NW as I never used them before. You might want to ask to the creators of the Anglo-Zulu war and ask them how they implemented swarms of bots. For citizens, not sure if that's really possible since we're in a multiplayer game and bots are usually hostile. You might have to use some AI paths or script some AI behaviour yourself if you want them to perform certain actions. Still, there could be some good guides on the TW forum that could really help you. For instance, I just went onto the Mod Development section and found this awesome tool http://forums.taleworlds.com/index.php/topic,317313.0.html
« Last Edit: December 09, 2014, 07:32:42 pm by DanyEle »



Offline MaxLam

  • Colonel
  • *
  • Posts: 1343
  • Founder of Minisiege, EU_Commander & Mininaval
    • View Profile
    • Napoleonic Wars Public
  • Side: Neutral
Re: *Scripting Thread*
« Reply #59 on: December 16, 2014, 07:47:03 pm »
Is it possible to have the game regenerate HPs when a player uses a prop such as a gate?