Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #1 
I know you can have more than one spawn point i.e. respawn_west1  and respawn_west2.

Question, how can you ensure certain players spawn at respawn_west1  and others designated only spawn are respawn_west2?
0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #2 
You could have a look at this method that does what your asking for specific groups, this is taken from Kylania's site:-

_respawnLocation = switch (group player) do {
case yellowGroup: {"yellowspawn"};
case blueGroup: {"bluespawn"};
};

_respawnMarker = createMarkerLocal ["respawn_west", getMarkerPos _respawnLocation];
_respawnMarker setMarkerShapeLocal "ICON";
_respawnMarker setMarkerTypeLocal "EMPTY";


In the above case the 2 groups are called YellowGroup and BlueGroup and the 2 respawn markers are called "yellowspawn" & "bluespawn"

The only thing I am not sure about is where the above code goes, I am assuming its in a trigger occuppying the "respawn_west" marker, but don't know. Also not sure if it works with vehicles as well.

Another method would be to respawn at the respawn_west marker, then have you moved to the location you want, but again not sure exactly how to do that as I am assuming your player will be in a tank?



0
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #3 
Thanks Tay, will try it tonight.

Also the other fix you gave me on direction of spawn worked like a charm.  Now i can have the tanks spawn with the proper orientation rather than always facing north.  Thanks again!
0
Santa Six

Avatar / Picture

Colonel
Registered:
Posts: 360
Reply with quote  #4 
I would like to use that code in a mission. Only I have no idea how to set it up. shpagin, if you figure it out can you post it?
0
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #5 
I could not get it to work, am not as good with scripting as Tay.  Has to be very simple for this old grunt.

I did find the following:

Add markers named with the prefix 'respawn_west' with any suffix (eg: respawn_west1, respawn_west_2, etc) for multiple random respawn points


Problem with this is that it is random which spawn you end up using.  I want to have a German force attacking from one direction and another German force attacking from the opposite side.  Want players to use the spawn site that the historical unit they are assigned would have attacked from. Don't want them switching back and forth randomly.  So multiple random spawn does not quite work for what I want to do.  But might work for you though.
0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #6 
Ok this is a slight cruder method but should do the job:-

Ok create your respawn_west marker say 30x30 size. All west players should be placed at the start of the mission in this marker. Also create a trigger covering this marker size maybe 40x40 for each playable named unit. So say you have 2 playable units called s1 and s2 that you want to spawn in different locations, but the same locations each time for that specific unit, you will have 2 triggers encompassing the respawn_west marker. Also create 2 more markers called spawn1 and spawn 2, these will be where your units will be moved to at mission start and every subsequent respawn, so s1 starts at spawn1 and s2 starts at spawn2.


I will example the trigger for unit s1 and the condition of the trigger will be:-

s1 in thislist


The Onactivation

if(isServer) then {tank1 = createVehicle ["LIB_PzKpfwVI_B_camo", getMarkerpos "Spawn1", [], 0, "NONE"]; group1 = createGroup west; "LIB_GER_tank_crew" createUnit [markerPos "spawn_tank_crew", group1, "this moveInDriver tank1"]; "LIB_GER_tank_crew" createUnit [markerPos "spawn_tank_crew", group1, "this moveInGunner tank1"]; tank1 setDir 90; tank1 setVehicleInit "tank1 = this; s1 moveInCommander tank1"; sleep 1; processInitCommands; };   


I believe that you are using triggers for each unit anyway and if so its only the bit that I have highlighted in blue above that you will need to change in your existing triggers. So rather than the tank being created on the position of the player its now being created on the position of the marker.

What actually happens is that your west player will respawn at the respawn_west marker but the tank is being created on the location of the marker defined in the commands, in the case above "spawn1", then your player is moved to the commander position of that tank. So long at your palyers are named and the condition is that that player is in thislist, then it should work ok.

You can also do the same with your east units too.

You can have as many units and spawn locations as you want, so long as the trigger is defined for the specific unit you want to have moved to their respective start locations marker. Just remember that at mission creation all playable units have to be in the triggers around the respawn_west or respawn_east markers.



0
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #7 

Did you ever know that you were my hero?  Everything I would like to be, I could fly higher than an eagle, you are the scripter beneath my wings!!

You the Man!! Thanks Tay!!!!

0
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #8 
TayUK, this is great what you worked out.  It gives tremendous flexibility on spawning.  You could actually have a unique spawn site for every unit if that is what you wanted. 

Now is there a way to have a trigger to move spawn 1 marker if their are no enemy in the area of the trigger?  If I can do that, I can not only spawn designated units where I want them, I can move the spawn 1...n  markers as the battle progresses.

thanks for all the help!!!!
0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #9 
Yes there is and I will post the code later (at work right now), thats actually quite simple as your just moving the marker to a new location once a condition is met
0
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #10 
thanks Tay, you are a great help! 

PS am playing hookie from work today so I can work on my new series 
0
shpagin

Avatar / Picture

Lieutenant
Registered:
Posts: 159
Reply with quote  #11 
Tay, you are right it was easy.  I now can direct unit to a specific spawn point based who my assigning as you gave me above.


But during the battle, if the attacker clears an area, then I can use a trigger to move "spawn1"

this is what I use for Russians attacking:

create a new marker "new_spawn1"

Trigger:

Activation  - Germans, Not Present, Repeatedly

Condition - this

On Activation - "spawn1" setMarkerPos getMarkerPos "new_spawn1";


Now if as a Russian, I am killed and there are no germans in the trigger area, instead of respawning at the old "spawn1"  I will spawn at the "newspawn1".  Can set additional triggers in this fashion.  If Germans are still in the trigger area, then I spawn at the old "spawn1" site.





0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.