Alright, so here's another tutorial that directly follows along with my current map project :).
This time, we're going to force a bot that we spawn in the world to move to a location of our choosing. For my example, I'll use the other team's flag.
To start out, right click a place in the world and add a trigger. This is going to dump out the Pawn data into Kismet so that we can control him. With that Trigger selected, open up Kismet and right click the empty space to bring up the menu. Add a new event using trigger... > Touch.
Now that you've got the trigger setup, be sure to make a blank object variable below the trigger so that the value of the pawn is dumped somewhere. Create a new action now, New Action > AI > Move to Actor (latent). Now hook these up in the traditional left to right from Touch to In. Now pull the target input into the object variable you created. With that done, now all you need is another object for your movement target. Find something on your map that you want you pawn to go run over to and select it. Bring Kismet back up and right click on the blank input. Create Object using whatever is selected, for me it's RedTeamFlagBase_0.
Now, whenever the bot hit's our trigger, he will immediately stop what he's doing and move to the target location...
This is all well and good, but if you're going along with my example, what do you think is going to happen when the Pawn comes back over that trigger carrying the flag? What about opposing team members? With the way it's setup, any bot who hits the trigger is going to turn around and run for the flag point, so let's add in some more safety precautions.
In order to make sure that your trigger isn't going to be turning the other team away from your base, add a new action into your function. New Action > Team > Get Team Number. Connect the object variable from the trigger into the target input of this node. This will tell the process who it's checking. Next, create a new Int variable underneath the output of the Get Team Number. Now add a new item. New Condition > Comparison > Int. Connect the Int value from the team node into the A slot of the Int compare. Create another Int at B and assign it to either 0 or 1. 0, being red team and 1, being blue team. Depending on what you choose, set this up accordingly. I used 0, so I check to see if my Get Team is = 0, then I connect that output to my Move to Actor function. What this is doing is checking if the pawn who triggered the touch is going to be on Red team. If they are, then they'll be sent over to the flag. If not, then I don't have to worry about making them do anything.
Now, this may or may not be important as I haven't gone to figure out if the bots will run to the Flag or to the Flag Base... but you may want to add in another condition in there that checks whether or not the bot is carrying the flag. This would stop a bot who had the flag from triggering our event and running back to the other base to be killed. So just to be safe, I'll go ahead and add that part in.
That's about it for today. Again, if there's anything you'd like to learn in particular, just ask and I'll be happy to go over it.
No comments:
Post a Comment