Hey scripters, I need a little help if you would . . .
I wanted to have a small battle between guards (around 12) and bandits (around 35). I do not want to use the excellent mod " Danaan Tactics" because it “pieces” out the battle, as in bringing a small amount each time until you get the number required. I actually have a role for that later with big battles.
My intent is to have a wave of horsemen pouring down from the hills at one time. I tried a couple of conventional ways (IE setting waypoints for each attacker, spawning waypoints for attackers, etc) but either the attackers come piecemeal (meaning a few, or even one, at a time) or they don’t move at all or some other thing happens that does not fit the mood.
I know Claudius33 has some battles in his modules (which I was unable to replicate) so I know it can be done. Does anyone have any ideas?
The trick is to use ActionForceMoveToObject, the object usually being a waypoint, but could be a placeable or a creature too.
ActionForceMoveToObject ensures that that involved creature is warped to the target after a delay you fix (the last parameter), in case it remains stuck for whatever reasons.
As a sample the Al Andalus final battle script. 4 groups of allies attack 4 different objectives (waypoints).
// Guadalquivir : init fight
void MoveTroops(string sTag, string sWP)
int n = 0;
object oWP = GetObjectByTag(sWP);
object oAllied = GetObjectByTag(sTag);
AssignCommand(oAllied, ActionForceMoveToObject(oWP, TRUE, 2.0f, 18.0f));
case 0 : s = "Allahu Akbar!"; break;
case 1 : s = "Saqr Quraish!"; break;
case 2 : s = "Qurtuba!"; break;
oAllied = GetObjectByTag(sTag, n);
object oGate = GetObjectByTag("gate_cordoba");
SetLocalInt(oGate, "Fight", 1);
Another good tip (which I intend to make better use of myself) is to have your troops already present in the game, but set them as ScriptHidden so they do not render or do anything until you want them to. i.e. A player does not see them in the game, nor do they do anything.
Then, when required, make the ScriptHidden FALSE on every creature required and perform the scripts like Claudius suggests. You could probably even include the function to “unhide” them in the same script as above (not tested). The advantage is you are not forcing the engine to create a large number of creatures in one or two loops, which may cause a slight jump in a game, as they are already “there”. It would likely resolve your piecemeal issue.
You may need to allow a slight timing delay between making ScriptHidden FALSE and any actions you need of them.
EDIT: I already use this method in a cutscene where I wanted a small band of guards to be ready to confront the player as they entered an area.
That was the script I chose to try. However when I used it in a new area, my horde of desert nomads just sat there and did not move. All I did was change the tags as the following: ```
MoveTroops(“syrian_guadal”, “WP_syrian”); with MoveTroops(“n_desertbandit”, “WP_desertbandit”); and deleted the other MoveTroops commands.
Is there something else that needs to happen? Maybe some variables? Or does it matter that the nomads are hostile rather than friendly to the PC?
Thanks Lance, but that I want them to be seen. The scenario is that the PC party comes upon a desert caravan that notices a band of desert nomads on the hill in front of them. The caravan does not want to move forward (trying to avoid provoking them) and cannot head backward because they need water at the nearby oasis. When the PC talks to the Merchant, the conversation ends with a Here-they-come and the camera swings to this large amount of nomads pouring down the hill.
But thanks for the advice.
Sorry about the delay, I had a meeting I participate in.
Anyway, sorry I misunderstood your situation. For some reason I had imagined you needing to spawn them first (when you said, “spawning waypoints for attackers”), and I had imagined it was their spawning that had been sporadic. If they are already present, then I see no reason why they should not all move without issue.
If they are hostile (or turned hostile), you could always replace ActionForceMoveToObject with the Action Attack function and target the PCs directly.
Let us know how you get on.
Be sure that all bandits are properly tagged “n_desertbandit” and the waypoint “WP_desertbandit”.
The bandits must be “HOSTILE”, if you want them to attack the party. In the above script I’m moving "DEFENDER"s.
Issue a ChangeFaction before assigning ActionForceMoveToObject if needed.
I’ll give it another go with your advice . . .
So I took the script and tried to stay as close to it as I could. I split the nomads into four groups (with the appropriate waypoints) and . . .
They finally poured down the hill.
I don’t know if I had mis-typed something or what was going wrong but thanks for the help!
Excellent! The past few weeks have been busy at work, but this and your screenshot sure give more motivation to find time to get the riders pack done as soon as possible!
You’ve done an amazing job on the riding mod. I can’t sing your praises enough.
Hey I noticed something about the riding mod. Some of the female faces get deformed when in “mount” mode. It looks to be the “override” heads but I can’t be sure.
Something like that?
In that case, this should fix the issue (only for the idle animation at the moment though).
Once I finish the HHM version, I’ll update the HHF set and upload the HH? package (which should cover most of the needs I guess).
@4760 Question. What would be the script to use to mandatory party dismount? I want to make sure we don’t have mounted players heading inside caves, buildings, etc.
Wait is it ga_cast_spell_at_object(0,"$PC",1521,"",0,0,0,0,0)?
The spell number is the right one
Don’t forget to set the variables to prevent them to mount again:
RIDE4760_NO_HORSES = Horses not allowed in this area..
RIDE4760_NO_MOUNTING = Horses may not be ridden in this area and anyone attempting to do so should be forcibly dismounted
Do you think it’s preferable if dismounting is automatic (so you won’t have to resort to calling spell #1521)?
Much preferable. I’m not much of a scripter so I was just pillaging yours.
The “no horsing around” variables.