Teleport doors and doors hitpoints. (SOLVED)

Users who are viewing this thread

Hi all.
i started a map, and i need help, because i can't find this clearly explained in tutorials.
i use multiplayer vanilla warband, and want make a map that everyone on standard warband can join/use.
i really need a clear explanation step-by-step, please.

TELEPORTS: i press "use" key on a door and i enter another area....i see on many servers, but no idea how do it.
please explain me the simplest way to do it, do not need other things, just as easy as that : DOOR1 => teleport => DOOR2 .

DOORS (hitpoints): how make an indestructible door or sally door? how set an amount of hitpoints for standard doors and sally doors?

really thanks for your help guys! rememebr, is a multiplayer scene, and i need everyone can join just downloading the map from my server (not dedicated). thanks!
 
Check this thread:
http://forums.taleworlds.com/index.php/topic,160080.msg3856938.html#msg3856938

And:
http://forums.taleworlds.com/index.php/topic,212007.0.html
 
thanks for the answer, but i read both posts before open this topic.
unfortunately in both is not explained how exactly create a working teleport

any idea about indestructible doors ?

thanks
 
ASKING TO A MODERATOR:

is better to split this different topics? i mean, if they are complex explanation can be better!

thanks

PS hope someone help me :smile:
 
ok thanks, i didn't thinked it was so hard, many maps have teleports and indestructible doors.
thanks for the suggestion

anyone can help me, please?
 
i installed python, don't know how use it, but followed that guide:
http://forums.taleworlds.com/index.php/topic,240255.msg5750047.html#msg5750047
and is working....if someone can help me now, i will be really thankful.

 
Hello DLEGION

About our teleporte script, Reggae and another programmer (not sure about nickname-Sorry if you read me :grin:) successed. The idea was to allow level designer to create teleportation between 2 doors which were specially configurate into level design editor like a spawn entry point or a ladder entry point for example.

I'm actually on vacations and could help you much but i suggest you to contact Reggae (or Archivist from IG which installed maps and this special script into the server). The script were compatible with Native like the script used on famous dual server :wink:
 
As requested, here are my rough suggestions if the mod has to be a server side only tweak of Native:

Don't add or remove any scene props from Native, just change the triggers.

To make an existing native door indestructible, you could try removing the sokf_destructible flag and the ti_on_scene_prop_hit and ti_on_scene_prop_destroy triggers entirely in the server code: I don't know what appearance hitting it would have on clients - probably still showing the effect and playing the damage sound - but the hit points bar shouldn't go down.

Adding "teleport" doors is more difficult, at least the linking part: the system used in PW is based on a totally rewritten module system using different methods, too complicated for someone learning; you would want to decide on some sort of simpler method, like searching over all props of the same type to use the first found with the same variation id, which can be set in edit mode as "Value 1". You should pick a door scene prop from native that isn't destructible, try adding a trigger something like this:
Code:
(ti_on_scene_prop_use,
 [(store_trigger_param_1, ":agent_id"),
  (store_trigger_param_2, ":instance_id"),

  (prop_instance_get_variation_id, ":door_link_number", ":instance_id"),
  (scene_prop_get_num_instances, ":door_count", "spr_<your_chosen_native_scene_prop_here>"),
  (try_for_range, ":other_instance_no", 0, ":door_count"),
    (scene_prop_get_instance, ":other_instance_id", "spr_<your_chosen_native_scene_prop_here>", ":other_instance_no"),
    (neq, ":other_instance_id", ":instance_id"),
    (prop_instance_get_variation_id, ":other_door_link_number", ":other_instance_id"),
    (eq, ":other_door_link_number", ":door_link_number"),
    (prop_instance_get_position, pos1, ":other_instance_id"),
    (position_move_y, pos1, 50), # or whatever movement required to put the agent in front of the other door
    (agent_set_position, ":agent_id", pos1),
    (assign, ":door_count", -1), # stop the loop because the linked door was found
  (try_end),
  ]),
This code is entirely untested. For best results, mark only two doors with the each number used.
 
THANKS Vornne !

and THANKS to Lav too, for the door script, i paste it here so everyone can use it:

As for door hitpoints, that should be relatively easy. Search the file module_scene_props.py for "door_destructible". There should be the following section:

Code: [Select]

  (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 2000),
    ]),

You can replace 2000 with whatever number strikes your fancy. This will change hitpoints for all instances of "door_destructible".

If you want to be able to set the hitpoints individually for each door, you will need slightly more complicated script:

Code: [Select]

  (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (prop_instance_get_variation_id_2, ":hp", ":instance_no"),
      (try_begin),
          (eq, ":hp", 0),
          (scene_prop_set_hit_points, ":instance_no", 2000),
      (else_try),
          (var_mul, ":hp", 100),
          (scene_prop_set_hit_points, ":instance_no", ":hp"),
      (try_end),
    ]),

Then for each instance of "door_destructible" on the scene, you can change it's variation number #2 to change it's hit points. If you need to know what variation numbers are and what they are used for, you can read question 4 here.

So with this code, if variation number #2 is zero (default), then the door hitpoints will be 2000 (default). If you set them to any other number however, then that number will be multiplied by 100 and used as that door hit points number. You can change the default hp and the multiplier as you wish of course, this is just an example.


THANKS guys! without your help i was lost! thanks for your great work!
 
Vornne, i need a bit more help :smile:

i placed your code behind:    door_d    in      module_scene_props.py    but when compiling it gives me all syntax errors....i must have done something wrong, forgive me please!  :sad:

the prop i intend to use is "door_d" , can you please explain me exactly where place it?

thanks a lot!


EDIT: i post the full code of door_d i used:

("door_d",sokf_moveable,"door_d","bo_door_a", [
  (ti_on_scene_prop_use,
    [(store_trigger_param_1, ":agent_id"),
    (store_trigger_param_2, ":instance_id"),

    (prop_instance_get_variation_id, ":door_link_number", ":instance_id"),
    (scene_prop_get_num_instances, ":door_count", "spr_door_d"),
    (try_for_range, ":eek:ther_instance_no", 0, ":door_count"),
      (scene_prop_get_instance, ":eek:ther_instance_id", "spr_door_d", ":eek:ther_instance_no"),
      (neq, ":eek:ther_instance_id", ":instance_id"),
      (prop_instance_get_variation_id, ":eek:ther_door_link_number", ":eek:ther_instance_id"),
      (eq, ":eek:ther_door_link_number", ":door_link_number"),
      (prop_instance_get_position, pos1, ":eek:ther_instance_id"),
      (position_move_y, pos1, 50), # or whatever movement required to put the agent in front of the other door
      (agent_set_position, ":agent_id", pos1),
      (assign, ":door_count", -1), # stop the loop because the linked door was found
    (try_end),
    ]),
 
DLEGION said:
If you want to be able to set the hitpoints individually for each door, you will need slightly more complicated script:
Adjusting the hit points only on the server will work for how many hits it takes to destroy the door, though the hit point bar on unmodified Native clients will still show the old value, so will be an incorrect indicator.
DLEGION said:
i placed your code behind:    door_d    in      module_scene_props.py    but when compiling it gives me all syntax errors...
Simple: you missed an extra last "])," to end the triggers list and scene prop entry - the code I posted was a single standalone trigger.
 
it works perfectly!
huge THANKS !
i will mark this thread as "solved".

Vornne and Lav , you two are awesome! thanks guys

everyone using this topic information should credit you.
as a side note, if you like the idea, i will send you a preview of my map when its nearly done!

THANKS AGAIN!
 
hello, i'm here again, sorry.

the problem this time is that it works for me (the server) but teleports do not work for the others.
is there any way to make it so also people connecting to me can use teleports ?

really thanks for your help
 
Hmm, I wasn't sure that adding a use trigger server side only would work - I know that the trigger is only ever activated on the server, but maybe clients need it defined to request the server to start using. I would try replacing the trigger block of any Native door prop that has a use trigger; from memory they are all destructible, rotating ones, but that shouldn't matter - just delete the entire triggers block and replace it with the previously posted code.
 
hm... please, what you mean exactly with: 

"try replacing the trigger block of any Native door prop that has a use trigger; from memory they are all destructible, rotating ones, but that shouldn't matter - just delete the entire triggers block and replace it with the previously posted code."

?

thanks Vornne! you are awesome

PS: i try to help saying what happens exactly: i see the "open door" or "raise ladder" when i look at teleport doors. people without my (edited) scene_prop.txt do not have this interactivity avaible. they just see them as normal doors.
 
That's why we can't use the "on scene prop use" trigger.

Instead, something like this would work:

SonKidd said:
Lav said:
There aren't many, and most of them are already used.

With these constraints, I'd rather go for distance or scene_prop_has_agent_on_it detection.

Though it complicates the scripts somewhat.

Multiplayer version, using scene_prop_has_agent_on_it:

Mission_templates:
Code:
	(0,0,0,[], [
		(this_or_next|multiplayer_is_server), # not really necesary
		(neg|game_in_multiplayer_mode), # not really necesary
		(scene_prop_get_num_instances, ":num_tele", NATIVE PROP NAME),
		(try_for_range, ":cur_instance", 0, ":num_tele"),
			(scene_prop_get_instance, ":cur_instance_id", NATIVE PROP NAME, ":cur_instance"),     
			(try_for_agents, ":agent"),
				(scene_prop_has_agent_on_it, ":cur_instance_id", ":agent"),
				(call_script, "script_activate_teleporter", ":agent_id", ":prop_instance_id"),
			(try_end),
		(try_end),
	]),

Scripts: (No change)
Code:
  # script_activate_teleporter:
  # This script is called when a teleporter object is activated on the scene.
  # It will use teleporter's first variation-no to determine what entry point to teleport agent to.
  # INPUT: arg1 = agent_id, arg2 = prop_instance_id
  # OUTPUT: none
  ("activate_teleporter", [
    (store_script_param_1, ":agent_id"),
    (store_script_param_2, ":prop_instance_id"),
    (prop_instance_get_variation_id, ":variation_id", ":prop_instance_id"),
    (try_begin),
      (gt, ":variation_id", 0), # Value 0 means deactivated teleporter
      (lt, ":variation_id", 64), # Any reasonable upper limit
      (entry_point_get_position, pos60, ":variation_id"),
      (agent_set_position, ":agent_id", pos60),
      # FOR EXTRA BELLS AND WHISTLES:
      # 1. SPECIAL EFFECTS CAN BE ADDED AT THE POINTS OF DEPARTURE AND ARRIVAL
      # 2. TELEPORTER MAY BE TEMPORARILY DEACTIVATED AFTER USAGE
    (try_end),
  ]),

Untested, but should work.

Obviously it's not the most efficient way to do things... But if it works, it works.


 
DLEGION said:
hm... please, what you mean exactly with: 

"try replacing the trigger block of any Native door prop that has a use trigger; from memory they are all destructible, rotating ones, but that shouldn't matter - just delete the entire triggers block and replace it with the previously posted code."
If you were going to convert spr_door_destructable from rotating to teleport, remove the entire red section in the spoilered code (the existing triggers), placing the trigger I previously posted inside the blue square brackets (the prop trigggers list). You should also probably remove the flags highlighted orange, so players can't destroy the door (though it might appear they can from their clients).
("door_destructible",sokf_moveable|sokf_show_hit_point_bar|sokf_destructible|spr_use_time(2),"tutorial_door_a","bo_tutorial_door_a", [
    check_item_use_trigger,

  (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 2000),
    ]),

  (ti_on_scene_prop_destroy,
    [
      (play_sound, "snd_dummy_destroyed"),

      (assign, ":rotate_side", 86),

      (try_begin),
        (this_or_next|multiplayer_is_server),
        (neg|game_in_multiplayer_mode),

        (store_trigger_param_1, ":instance_no"),
        (store_trigger_param_2, ":attacker_agent_no"),

        (set_fixed_point_multiplier, 100),
        (prop_instance_get_position, pos1, ":instance_no"),

        (try_begin),
          (ge, ":attacker_agent_no", 0),
          (agent_get_position, pos2, ":attacker_agent_no"),
          (try_begin),
            (position_is_behind_position, pos2, pos1),
            (val_mul, ":rotate_side", -1),
          (try_end),
        (try_end),

        (init_position, pos3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (position_move_y, pos3, -100),
        (else_try),
          (position_move_y, pos3, 100),
        (try_end),

        (position_move_x, pos3, -50),
        (position_transform_position_to_parent, pos4, pos1, pos3),
        (position_move_z, pos4, 100),
        (position_get_distance_to_ground_level, ":height_to_terrain", pos4),
        (val_sub, ":height_to_terrain", 100),
        (assign, ":z_difference", ":height_to_terrain"),
        (val_div, ":z_difference", 3),

        (try_begin),
          (ge, ":rotate_side", 0),
          (val_add, ":rotate_side", ":z_difference"),
        (else_try),
          (val_sub, ":rotate_side", ":z_difference"),
        (try_end),

        (position_rotate_x, pos1, ":rotate_side"),
        (prop_instance_animate_to_position, ":instance_no", pos1, 70), #animate to position 1 in 0.7 second
      (try_end),
    ]),

    (ti_on_scene_prop_hit,
    [
      (play_sound, "snd_dummy_hit"),
      (particle_system_burst, "psys_dummy_smoke", pos1, 3),
      (particle_system_burst, "psys_dummy_straw", pos1, 10),
    ]),

  ]),
 
Back
Top Bottom