Thanks for the help everyone. I've pretty much finished my little project of adding persistant equipment to Native Multiplayer. It's been a great learning experience for certain! I'm not quite sure what I am going to do with the mod from this poin though. I think all I wanted was to just figure it out.
There is none - script_multiplayer_calculate_cur_selected_items_cost gets called every time, and a text overlay is created in g_presentation_obj_item_select_12.
I've rewritten the process and I am simply trying to insert into reg0 from a different location. I've tried defining a new player slot but this doesn't seem to work. Any suggestions?
Quick Question about the multiplayer GUI. I've got my database sending equipment data when the player chooses a "troop" this works fine except that the icons do not populate the slot view (you can mouse over a seemingly empty slot and the tool-tip text will show). If I hit ESC and go back into the troop selection, the icons for equipment will show up without issue.
I think I'm missing something. Is there an easy way to make the presentation 'refresh' without exiting and then going back into the selection screen?
Edit - I neglected to mention that clicking on an 'empty' icon populates all of the slots that appeared empty.
When a player selects a troop/equipment, a network message is sent. So check that message and mimic what it does in the url_response script (You want to assign gear based on data from a database right?).
As for weapon proficiencies and the rest, they're set via troops, ie. you can't set them per agent. If you want to set them per player, you're going to have to get creative. If the cRPG source is still open, look there.
I'm already reading and writing equipment data to and from my database but I wanted to separate the selections a little bit and I thought doing it by class would be easiest. I think I know exactly which network message you're referring to so thanks for that hint there.
I tried getting the old crpg souce but the link is no longer working Anyone have a copy of it by chance?
Firstly, thanks to everyone for all of your assistance. I'm able to now read and write equipment data to and from my database and have it populate the approriate slot...at least for the inital spawn. I have some additional questions; hopefully short and easy ones.
1) Which script(s) are fired when a player selects their 'Class' from within the gui? I am looking to set saved equipment from the database to the gui based on their class selection. This might not be possible so my plan B is to lock that character into a class once they've made their initial selection. I'm good either way
2) What functions are used to set Attributes, Skills, and Weapon Profs?
Once I can get this inventory thing solved, I think I'll be nearly finished. However, I am not quite sure how to loop through the Troop_Slot indexes. Is there any example code out there?
Yes, the *_set_slot or * _get_slot etc operations refer to arrayed variables that are called slots.
These should not be confused with the equipment slots ek_* that identify where items go on a troop/agent/player.
(This arrayed variable type of slot is explained in the syntax thread you've been pointed to that is in my sig.)
Does this function regard slots differently than (player_add_spawn_item,player_id, item_slot_no, item_id),
I've got my database equipment code almost working but when I use the ek_item* slots, only the last item is populated (within the first slot). However when I use function (player_add_spawn_item,player_id, item_slot_no, item_id), with the same item and slot ids, the equipment is spawn where I'd expect it to. I'm so close to getting this working though
Awesome. This explains why it wasn't working Changing the ID to a valid number (in my case, 9 worked nicely.
I believe I am close. When my character is logged in, he gets the equipmentids which are saved within the database. The items are equipped but are invisible from the selection menu because I have not yet messed with presentations.py. I can click on the vanilla available selections and change the equipment which then is reflected in the player slots as expected.
Does the equipmentID in the slot have to exist in the troop.py file for that particlar troop in order to show in Vanilla?
Where reg7 is my playerId, 5000 is the identifier I am going to use in the Client events (not sure about this part), and the remaining reg8, reg9, and reg10 are item id's. Do I have this right?
63.75 (since the value is an integer / 4, max is 255 / 4), but as cmpxchg8b said recently in this thread, it's a module system limit rather than a game engine one (I don't know the engine limit, but you could ask him). What I have used to get around it:
I want to keep the vanila select screen but just replace the default equipped weapons and such with the db values. I thought it would be simple but it appears that the script ("multiplayer_set_default_item_selections_for_troop") doesn't allow me to call send_message_to_url directly which prevents me from accessing the database. Perhaps this is because it's called by the client and won't allow send_message_to_url? How would I get around this?
As I said, the native equipment selection system uses item and troop slots, which is not really what you want. I wouldn't have the client request the server and then the server request the web server - too much potential for abuse - but rather when the player joins the warband server it requests the web server for the equipment, then stores it in player slots and sends to the client (player) with network messages, which also stores it in player slots, then convert the client presentations to use them instead of troop slots, have the client reply to the server with what equipment you have chosen, the server check to ensure the items are in the player slots stored earlier, and if so, add to the spawn items. Not something easy to start off with.
I'm still struggling with populating decault items from my database.
All I am looking to do is replace the default troop euipment that is equipped whenever a player joins the server with whatever is saved for them wihtin my database. I want to keep the vanila select screen but just replace the default equipped weapons and such with the db values. I thought it would be simple but it appears that the script ("multiplayer_set_default_item_selections_for_troop") doesn't allow me to call send_message_to_url directly which prevents me from accessing the database. Perhaps this is because it's called by the client and won't allow send_message_to_url? How would I get around this?
I found that send_message_to_url doesn't work from scripts like; multiplayer_display_available_items_for_troop_and_item_classes. Is this because the script actually fires from the client?
If so, can I use the 'send network message' function called within the above script to then call send_message_to_url ?