Stalker Posted May 25, 2003 Share Posted May 25, 2003 can somebody describe how to use loop responses and what they are good for ??????????????? Quote Link to comment Share on other sites More sharing options...
Jack57 Posted May 26, 2003 Share Posted May 26, 2003 For what it's worth I have just been doing some mission scripting today and wanted to separate the Player Platoon into it's teams so I could teleport each team to a different insertion zone. I though I'd post it as it's a very good example of using a loop. _________________________________ Group: <Default> Comment: Trigger Event: The simulation is starting. Responses: Set PlayerPlatoon to (The player-controlled platoon). Use GetPlayerTeams to loop over all teams in PlayerPlatoon after this block. Group: GetPlayerTeams Comment: Trigger Event: A team loop is ready to process ThisTeam. Responses: Allow this block to be reactivated. Increment PlayerTeamCount. Set Charlie to ThisTeam. Continue executing responses if ((The value of PlayerTeamCount) is less than 3). Set Bravo to ThisTeam. Continue executing responses if ((The value of PlayerTeamCount) is less than 2). Set Alpha to ThisTeam. 'NextTeam' is just an ActorReference you create to give the program a 'handle' so it can loop the platoon. EDIT: Just be a little careful with this script. If there is only one team then that team will have all the names Alpha, Bravo and Charlie. If there are two teams then Bravo will also have the name Charlie. So if you have script that does something based on a query of the team name you can see it may lead to trouble. Make sure you first query the number of teams before applying any responses designed for Bravo or Charlie. Alternatively put the scripts in seperate Blocks for each team, and only enable the Group if the team exists. For example: Group: GetPlayerTeams Comment: Trigger Event: A team loop is ready to process ThisTeam. Responses: Allow this block to be reactivated. Increment PlayerTeamCount. Set Charlie to ThisTeam. Enable the Charlie script blocks. Continue executing responses if ((The value of PlayerTeamCount) is less than 3). Set Bravo to ThisTeam. Enable the Bravo script blocks. Disable the Charlie script blocks. Continue executing responses if ((The value of PlayerTeamCount) is less than 2). Set Alpha to ThisTeam. Enable the Alpha script blocks. (or omit this and use the Default Group for Alpha) Disable the Bravo script blocks. ___________________________________________________ Once you have the teams identified you can then use 'QueueLoop Actors in Team' and teleport them where you like. ___________________________________________________ Here is how to split up the player members and teleport them to an effect to simulate a para drop: You need to place 9 effects where you want the players to be teleported to (or six if it is for single pplayer only), making sure they are not going to land on top of a building or similar. Caution: don't go too high on urban maps or you may have problems. Trial and error will get you there Make the player platoon invincible in the StartUp block . 1) This one requires less scripting but may cause lag. Trigger Event: The simulation is starting. Responses: Set PlayerPlatoon to (The player-controlled platoon). Use ParaDrop to loop over all actors in PlayerPlatoon after this block. (you have to create this new group) Group: Paradrop Trigger: An actor loop is ready to process NextActor. Responses: Allow this block to be reactivated. Increment ParaDropCounter. (you will need to create this counter) Teleport NextActor to Effect_9. ContinueIf ParaDropCounter is less than 9 Teleport NextActor to Effect_8. ContinueIf ParaDropCounter is less than 8 Teleport NextActor to Effect_7. ContinueIf ParaDropCounter is less than 7 Teleport NextActor to Effect_6. ContinueIf ParaDropCounter is less than 6 Teleport NextActor to Effect_5. ContinueIf ParaDropCounter is less than 5 Teleport NextActor to Effect_4. ContinueIf ParaDropCounter is less than 4 Teleport NextActor to Effect_3. ContinueIf ParaDropCounter is less than 3 Teleport NextActor to Effect_2. ContinueIf ParaDropCounter is less than 2 Teleport NextActor to Effect_1. 2) For this one in addition to what's below, you will need to create a new Group with one block only and with the Teleport function in each - this is for the Redirect. It is a bit more involved but if you are having trouble with lag, use it instead. Allow this block to be reactivated. Increment ParaDropCounter. ReDirectIf ParaDropCounter is equal to 1 (Redirect to Group ParaDrop_1) ReDirectIf ParaDropCounter is equal to 2 (Redirect to Group ParaDrop_2) ReDirectIf ParaDropCounter is equal to 3 (Redirect to Group ParaDrop_3) ReDirectIf ParaDropCounter is equal to 4 (Redirect to Group ParaDrop_4) ReDirectIf ParaDropCounter is equal to 5 (Redirect to Group ParaDrop_5) ReDirectIf ParaDropCounter is equal to 6 (Redirect to Group ParaDrop_6) ReDirectIf ParaDropCounter is equal to 7 (Redirect to Group ParaDrop_7) ReDirectIf ParaDropCounter is equal to 8 (Redirect to Group ParaDrop_8) ReDirectIf ParaDropCounter is equal to 9 (Redirect to Group ParaDrop_9) Jack out . . . Quote Link to comment Share on other sites More sharing options...
Stalker Posted May 26, 2003 Author Share Posted May 26, 2003 boah, thanks for your help , Jack a question: why do you know the name of the boat, you blow up in the last BIA mission ( <n>.... ??? ) and how can i find the name of MapObjects???? Quote Link to comment Share on other sites More sharing options...
Jack57 Posted May 26, 2003 Share Posted May 26, 2003 In Igor under the View menu select Map Labels. Now any map objects will display their names. If it contains <dyn> it means it is dynamic and can (usually) be hidden or destroyed. You can even hide most of the buses on the Embassy map although there will still be a sizable collision zone where it normally is. All of these map objects can also be used for tank targets which can be very useful. For example, you can give a tank a plan to DestroyTarget 303_<n><door>01, which might be on the other side of the map somewhere. If there are objects between the tank and the target it will still shoot towards it but the shells will strike the intervening objects. In this way you can give the illusion that it is shooting at something else. Jack Quote Link to comment Share on other sites More sharing options...
Stalker Posted May 26, 2003 Author Share Posted May 26, 2003 god should save you Quote Link to comment Share on other sites More sharing options...
EricJ Posted May 28, 2003 Share Posted May 28, 2003 In Igor under the View menu select Map Labels. Now any map objects will display their names. If it contains <dyn> it means it is dynamic and can (usually) be hidden or destroyed. You can even hide most of the buses on the Embassy map although there will still be a sizable collision zone where it normally is. All of these map objects can also be used for tank targets which can be very useful. For example, you can give a tank a plan to DestroyTarget 303_<n><door>01, which might be on the other side of the map somewhere. If there are objects between the tank and the target it will still shoot towards it but the shells will strike the intervening objects. In this way you can give the illusion that it is shooting at something else. Jack That's something I've been looking for. Though unfortunately soldiers won't blow a door down. Maybe wrong ordnance (tried it with a dude carrying an M16/203) or just plain doesn't work. Would work nice for a few missions. As for the Map Labels, thanks Jack57, now I can probably tweak a few more stuff as well.. Quote Link to comment Share on other sites More sharing options...
Stalker Posted May 31, 2003 Author Share Posted May 31, 2003 ok, I want to assign all players of the playersplatoon a specific weaponkit: should it look like this: Trigger Event: Startup Response: Use <Weapon> to loop over all actors in the player controlled platoon Trigger Event: Loop Actors ( an actor loop is ready to process <Next Platoon Member> Response: block preserve Set actor kit.......... (assign <OICW.kit> to <Next Platoon Member> ???????????????????????????????? (hope thats right) Quote Link to comment Share on other sites More sharing options...
Jack57 Posted May 31, 2003 Share Posted May 31, 2003 Looks pretty good to me If it works, it means you got it right Quote Link to comment Share on other sites More sharing options...
Stalker Posted May 31, 2003 Author Share Posted May 31, 2003 hehe Quote Link to comment Share on other sites More sharing options...
Jack57 Posted June 6, 2003 Share Posted June 6, 2003 Though unfortunately soldiers won't blow a door down. Maybe wrong ordnance (tried it with a dude carrying an M16/203) or just plain doesn't work. Give him a kit with rockets then give him a destroy target plan. Works like charm If you make a new kit with rockets as the primary he will also use rockets against the players Quote Link to comment Share on other sites More sharing options...
NGRU_Crazy1 Posted October 13, 2003 Share Posted October 13, 2003 Hi jack I was reading you post recently about the queue loops . Just one thing i couldnt work out and which you dont make plainly obvious in your explanation. Trigger Event: A team loop is ready to process NextTeam. Responses: Set Alpha to NextTeam. Ok what response is "Set Alpha to NextTeam" I cant find it . Is it queue loop teams in platoon? and query? how do you arrive there? Would appreciate your help in this. NGRU Crazy 1 out. Quote Link to comment Share on other sites More sharing options...
Jack57 Posted October 13, 2003 Share Posted October 13, 2003 "Set Alpha to NextTeam" is the VariableSetTeam response - as this loop block doesn't have a block preserve, it will only execute once. So, the first team to be processed by the loop will have the variable team reference 'Alpha' assigned to it - the loop will then be deleted so it won't process any more teams. (The tags 'Alpha' and 'NextTeam' are created by you and can have any name you wish.) Hope that helps? Jack Quote Link to comment Share on other sites More sharing options...
NGRU_Crazy1 Posted October 14, 2003 Share Posted October 14, 2003 Thanks jack that helps but I have another question for you now hehe. is " Next team " and actor reference or a team reference? Quote Link to comment Share on other sites More sharing options...
Jack57 Posted October 14, 2003 Share Posted October 14, 2003 It's a team reference because we are looping the teams in the player controlled platoon Quote Link to comment Share on other sites More sharing options...
NGRU_Crazy1 Posted October 16, 2003 Share Posted October 16, 2003 Thanks a lot for the help jack. Crazy 1 out. Quote Link to comment Share on other sites More sharing options...
X69RZX Posted October 18, 2003 Share Posted October 18, 2003 (edited) Ok. How do you make a loop just go over all the actors in a company once? Like when triggered by a timer. Thirty seconds has elapsed, use loop bla bla bla over all actors in company bla after this block. Then how do I make it only go over them once? It is doing it twice each time around. Edited October 18, 2003 by X69RZX Quote Link to comment Share on other sites More sharing options...
Matt03 Posted October 18, 2003 Share Posted October 18, 2003 That is weird. Maybe your block that activates the timer goes off twice but from what you said with the 30 elapsed it shouldn't. Make sure you don't have the timer go off twice. Quote Link to comment Share on other sites More sharing options...
Jack57 Posted October 18, 2003 Share Posted October 18, 2003 Then how do I make it only go over them once? It is doing it twice each time around. Yeah Matt's right - if it's doing it twice something in the script must be telling it to do it twice. Maybe you have a BlockPreserve in the TimeElapsed trigger block? If not then use the search function with the summary to look for the name of the loop block (group) to see if it's being called from somewhere else as well. Cheers, Jack Quote Link to comment Share on other sites More sharing options...
X69RZX Posted October 18, 2003 Share Posted October 18, 2003 Ok. Every 30 secs a block is triggered. It ques a call to a block that uses a loop for actors. That loop makes some determinations, then posts a readout. The readout is coming out twice. This is a MP script, and yes, I am using block preserve, because I want it to repeat every 30 secs. Should I use call? That isn't the same as a loop right? Quote Link to comment Share on other sites More sharing options...
Matt03 Posted October 19, 2003 Share Posted October 19, 2003 A call is different from a loop. But they work with the same basic principles. I don't think in this case you need a call because all you should do is have the block preserve on the 30 sec trigger and use the loop. I see no need for the timer. Quote Link to comment Share on other sites More sharing options...
Jack57 Posted October 19, 2003 Share Posted October 19, 2003 QueueCalls just call a block and execute it - once for each time it is called. QueueLoops also call a block but they execute it once for each of the sub-entities in the entitiy that you have specified for it to loop through. Your problem might lie in where you execute the DisplayMessage response. If it is in the loop block then it will display each time the condition is met. There are two ways around this - use a Display Box so that successive messages will display on top of previous ones, or use a counter and a StopIf query (below the block preserve, so you can use it again), then each time you call the loop block reset the counter. Jack Quote Link to comment Share on other sites More sharing options...
X69RZX Posted October 20, 2003 Share Posted October 20, 2003 Thanks Jack, I have been using flags in place of the counters, but I see that would be the same if you reset the counter to zero every rotation, then increment and continue if. I will continue to fight the good fight. Soon all will hopefully benifit. Quote Link to comment Share on other sites More sharing options...
Recon Posted May 16, 2004 Share Posted May 16, 2004 I am really stuck. I have made a plan so quite a few platoons of actors walk to a point and I want each actor to disappear (HideThing) when they reach it. Can I use loops so each actor disappears individually instead of hiding the whole platoon when the first one reaches the zone (what I have now)? Please help me! Quote Link to comment Share on other sites More sharing options...
Stalker Posted May 16, 2004 Author Share Posted May 16, 2004 Trigger: A member of Platoon X is within 10m of zoneY Response: Block Preserve HideActor--- The actor nearest zoneY Quote Link to comment Share on other sites More sharing options...
Recon Posted May 16, 2004 Share Posted May 16, 2004 Trigger: A member of Platoon X is within 10m of zoneY Response: Block Preserve HideActor--- The actor nearest zoneY Just tried that. As soon as the first actor reaches the zone I get a CTD. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.