Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Arch3r said:
Does anyone know any tools for module_presentations or has some tips n tricks?

A tool, I don't know but I know there is an OSP script to get coords in x/y format for putting any mesh onto.
 
Code:
            (0, 0, 2,
   [
       (key_is_down, key_n),
       ],
   [
           (multiplayer_is_server),

       (multiplayer_get_my_player, ":player_no"),
       (player_get_agent_id, ":agent_id", ":player_no"),

       (assign, ":scene_prop_1", "spr_aa_powershot"),

       (agent_get_position, pos5, ":agent_id"),
       (set_spawn_position, pos5),
       (spawn_scene_prop, ":scene_prop_1"),
       
       (scene_prop_get_instance, ":scene_prop_id", ":scene_prop_1"),
       (prop_instance_get_starting_position, pos5, ":scene_prop_id"),
       

       (agent_get_look_position, pos6, ":agent_id"),
       (position_move_y, pos6, 2500),
       
       (prop_instance_animate_to_position, ":scene_prop_id", pos6, 100),
              (assign, "$caster_agent_id", ":agent_id"),

       (agent_set_slot, ":agent_id", slot_agent_is_caster, 1),
       (display_message, "@Powershot created"),
##           (multiplayer_send_int_to_server, event_aa_powershot_done, 1),
   ]),

This creates and "throws" a powershot object to players look location. It usually works but sometimes just moving the last thrown object to determined position and creates the powershot object on my position. (Generally after respawn). Why this happens?

And, it doesnt works on dedicated server. My other mission_template trigger are working (like time teleport doors -teleports the agent on it to specified entry point in every 10 sec-) as hell. Is there a problem at indicating my agent in mission or etc?

Thanks.
 
Sorry for flooding but i have to ask two different question too.

1- How to specify a scene prop or an agent in mission? (For changing speed, adding items, using its position etc.)

2- Is there any operation or something for "completely" deleting a scene prop from map?
 
minnakodunum said:
Code:
           (multiplayer_is_server),

       (multiplayer_get_my_player, ":player_no"),
That is a contradiction: on a proper server, you can't get "my player" or handle a key_is_down operation. You need to have a trigger checking the key_is_down operation on the clients which sends a network message to the server requesting the "power shot", then in the corresponding server network message handler check whether the player is allowed to perform the action, if so apply it. See this old (but good) thread for a basic guide on multiplayer network messages: http://forums.taleworlds.com/index.php/topic,94854.0.html (note that agent_play_sound is synced to nearby clients by the engine, so the specific example in that thread is not necessary unless playing very loud sounds heard at long range).

As I say over and over again on this thread: never waste time trying to test multiplayer code on anything but a dedicated server (unless you really know what you are doing). All sorts of totally wrong code can appear to work for the hoster of a client-server.
 
@Vornne

First, thanks a lot. The topic is useful for me.

As i understand, it could done by following these order:

1-) Check key is down or not
2-) Get my player and determine the spawn position
3-) Send info to the server which is about position
4-) Create scene prop
2a-) Informate the server about creation
3-) Move scene prop
3a-) Informate the server about moving

Right?
 
it can be...but is not recommended like that. what you need is this:
1.check if the key is clicked or not
2.send a message to the server (event message not string or anything else)
3.let the server decide what to do and how: the server will get your player's agent's position, then it will create a scene prop and then you will animate it(or do whatever you want)
 
After a bit work, I tried to do powershot like this but, it still doesnt works.

Codes:
Code:
            (0, 0, 2,
   [
       (multiplayer_is_dedicated_server),
       (key_is_down, key_n),
       ],
   [
       (assign, ":value", 1),
       (multiplayer_send_int_to_server, multiplayer_event_client_send_powershot, ":value"),
   ]),


Code:
      (else_try),
      (eq, ":event_type", multiplayer_event_client_send_powershot),
      (store_script_param, ":value1", 3),
      
       (assign, ":scene_prop_1", "spr_aa_powershot"),
      (neq, ":player_no", 0),

      (player_get_agent_id, ":agent_id", ":player_no"),
      
       (agent_get_position, pos5, ":agent_id"),
       (set_spawn_position, pos5),
       (spawn_scene_prop, ":scene_prop_1"),
       
       (scene_prop_get_instance, ":scene_prop_id", ":scene_prop_1"),
       (prop_instance_get_starting_position, pos5, ":scene_prop_id"),
       
       (agent_get_look_position, pos6, ":agent_id"),
       (position_move_y, pos6, 2500),
       
       (prop_instance_animate_to_position, ":scene_prop_id", pos6, 100),
      
       (agent_set_slot, ":agent_id", slot_agent_is_in_draw_mode, 1),
      
      (get_max_players, ":max_players"),
      (try_for_range, ":cur_player", 0, ":max_players"),
      (player_is_active, ":cur_player"),
            (val_add, ":value1", 1),
      (multiplayer_send_int_to_player, ":cur_player", multiplayer_event_client_do_powershot,":value1"),
      (try_end),
      (else_try),
Code:
   (else_try),
      (eq, ":event_type", multiplayer_event_client_do_powershot),
      (store_script_param, ":value2", 3),
      (val_add, ":value2", 1),
      (str_clear, s1),
      (str_store_string, s1,":value2"),
       (display_message, "@Powershot created"),
      (display_message, "@ {s1} must be a number"),
(else_try),
Is the all problem with the key_is_down operation? And would this work if i manage to check key is down trigger in dedicated server?
 
the main problem is this operation (multiplayer_is_dedicated_server). this is true when the current procces/program running this code is a dedicat server. if it is client or a normal server(hosted from ingame menu), it will be false.
so you would wanna put this (neg|multiplayer_is_dedicated_server) - means negation of the current operation, so this will be true when it is client, else it will be false

And would this work if i manage to check key is down trigger in dedicated server?

the dedicated server is only that little black background white text box, that runs the server. you won't be able to check if a key is down from it, since it is the server, and not the client.
 
I already tried that at dedicated server. And unfortunately it doesnt works. So i tried this:
Code:
            (10, 0, 0,
   [
       (multiplayer_is_dedicated_server),
       ],
   [

              (assign, ":scene_prop_1", "spr_aa_powershot"),
              
       (try_for_agents, ":agent_id"),
       (agent_is_alive, ":agent_id"),
       (agent_is_human, ":agent_id"),
              (agent_get_position, pos5, ":agent_id"),
              (agent_get_look_position, pos6, ":agent_id"),
                     (position_move_y, pos6, 1000),

                     (set_spawn_position, pos5),
       (spawn_scene_prop, ":scene_prop_1"),
              
       (scene_prop_get_instance, ":scene_prop_id", ":scene_prop_1"),
              
       (prop_instance_get_starting_position, pos5, ":scene_prop_id"),
                      
       (prop_instance_animate_to_position, ":scene_prop_id", pos6, 100),
       
       (try_end),

This works, for a while... Creates the scene prop for everybody and they all move to the position "for 2 or 3 times". And after third move (20-30 sec), it still creates scene props in every 10 seconds but they dont move. (Sometimes 1 or 2 props are moving but if we wait enough they also stop moving).

Whatever, I think the "spawn and move" is not such a problem but is there any way to specify the agent which is used the "powershot"?
 
i am running into a problem...i wanna to sync the weather and the time between the server and the client. i use these lines of code
Code:
(multiplayer_send_4_int_to_player, ":player_no", multiplayer_event_set_scene_weather, "$mpcoop_time_of_day","$mpcoop_cloud","$mpcoop_haze","$mpcoop_rain"),
Code:
(else_try),
          (eq, ":event_type", multiplayer_event_set_scene_weather),	
				(store_script_param, "$mpcoop_time_of_day", 3),
				(store_script_param, "$mpcoop_cloud", 4),
				(store_script_param, "$mpcoop_haze", 5),
				(store_script_param, "$mpcoop_rain", 6),
				
				(set_global_cloud_amount, "$mpcoop_cloud"),
				(set_global_haze_amount, "$mpcoop_haze"),
				(scene_set_day_time, "$mpcoop_time_of_day"),
				
				(assign, ":rain_amount", "$mpcoop_cloud"),
				(assign, ":rain_type", "$mpcoop_rain"),
				(try_begin),
					(lt, ":rain_amount", 75), #less than = no rain
					(assign, ":rain_amount", 0),
					(assign, ":rain_type", 0),
				(try_end),
				 
				(set_rain, ":rain_type" , ":rain_amount"), #1=rain 2=snow
				
				(assign,reg1,"$mpcoop_time_of_day"),
				(assign,reg2,"$mpcoop_cloud"),
				(assign,reg3,"$mpcoop_haze"),
				(assign,reg4,"$mpcoop_rain"),
				(display_message,"@DEBUG: time:{reg1}   rain:{reg4}  cloud:{reg2}  haze:{reg3}"),

and in game i get the correct debug message. the problem is that the weather and the time don't change when i join the server! they are only changed as i want when i rejoin. so my conclusion was that the clouds/fog/day time can be set only when the map is loaded(or something like this), but then i remembered that there are plenty of mods that change ingame weather and time. what should i do so that it will take instant effect?
 
Ask one of the teams doing real-time weather - it involves sending parameters to shaders and swapping skyboxes. As far as I know those operations are pretty much single-player (that is, you need to call them before the mission is even initialized), with the exception of scene_set_day_time. Other mods have added the weather system as a bunch of particles.
 
so after a bit digging, i realised that the mods that I knew that can change weather/time no longer works. i think that they (game devs) removed the in scene weather control..the only thing that can be controlled while you are in the server is the fog...the rest are set when you enter/load the server/mission template.
 
cmpxchg8b said:
Changing weather/time never worked in-scene.

as far as i remembered they worked...with nirecotive mod...i know that i was on a server, pressed escape->nirecotive options->weather and the sun position changed, together with the shadows projections
 
Swordyke said:
What are the copyrights on maps made by the community?

I mean, is a simple credit enough to fulfill the copyright-requirements?
Depends, I would guess that some people only want their scenes to be used by a certain modification or server and therefor won't go along with it with just credits. Just message the creator of the scene and ask for permission.
 
To anybody that has tinkered with presentations, can you recommend any good way of making a game_button look inactive? Apparently overlay_set_color doesn't work on them, but I haven't really checked the others out.
 
Status
Not open for further replies.
Back
Top Bottom