Modding Question

Users who are viewing this thread

Zabrak678

Banned
Hi all. I have been practicing Scene editing and I have three questions.
First of all and the more important one, How do I add Npcs to a scene?(Mostly Guards and townsmen) And how can I make the townsmen move if I can? But walkers aren't that important I mostly want guards so It will look cooler.
Second how do I move NPCs?
Three, How can I edit where a Passage that I added leads to and how can I make a place for that to go to?
 
I think you might want to check out Jik's tutorial

http://forums.taleworlds.com/index.php/topic,56798.0.html

It has a section on how to add units to scenes.
You can also have a look at the native code. For instance, look in the "town" menu for the menu entry where you take a walk in the street, or in the castle menu for courtyard and then follow what's going on there. The basic code is (set_visitor, ":entry_no", ":walker_troop_id"), but there's a bit more to it than that.

I've never messed with the walkers, but again, taking a cue from native:

There are several scripts used. First the walkers are initiated at game_start. This adds walkers to towns and villages, so the same ones are always in the same place. Then there's a few more, but the action seems to be done with this:

A trigger in the mission template calls for the  # script_tick_town_walkers. Looking at that script, it runs a check through all the available walkers. It checks the position of the entry point where the walker originally spawned, then does some stuff with that.. not sure what init_position does (I guess it initializes a position to something. Maybe just 0,0,0?). Or position_transform_position_to_parent for that matter. As usual the header_operation is fantastically documented  :neutral: 

Anyway, at the end of the script, there's a 1 in 5 chance for a call to the next script, which is script_set_town_walker_destination
This script will choose a new destination. It might be a bit confusing at first (it was for me, anyway) but what it does is add a bunch of possible destinations to regs. Then it checks that one of them is not the current location of the walker. If it is, it dumps that one out of the choices.

Then it shuffles the options and picks one (the one that's shuffled into reg0 as long as it's higher than 0). Then it does the same stuff that the other script does, I think this is to get a location near the entry point. And then it tells the walker to walk there, with a maximum speed of 5

So basically, if you're making a scene and just want to use the native scripts. Make sure you stick to those entry points for your walkers, cause then you can just copy and alter the triggers from the normal mission templates. You might have to make your own versions of the scripts anyway, if you don't want your walkers to overlap with the native ones. But you can copy/paste and rename them and then change the (is_between) to the constants that have your walkers in them. Of course you'll also have to initiate them properly, etc. But with a bit of digging and testing, you should be able to figure it out. If you don't want such a complicated system, you can just make your own trigger that makes them walk by getting the position and using the agent_set_scripted_destination

Passages are linked to the town_menu. So I think 0 is the first menu option, 1 is the 2nd, etc. Again, the easiest way is to look at a native scene, check how the passages are set up, then look in the menu tuple. This also means that if you're adding something new to a town menu, add it at the bottom so you don't have to change all the native passages.

Hope that helps somewhat. I'm sure there are ppl who are more experienced with this who can help you out more.




 
Back
Top Bottom