Changing RTS Unit Speed
by SimU Group · in RTS Starter Kit · 11/30/2007 (2:45 pm) · 6 replies
How could I change the movement speed of different RTSUnits belonging to the same datablock? I tried modifying the 'moveSpeed' field, but it didn't work.
#2
12/01/2007 (8:57 am)
I tried this in the console window but it didn't work:datablock RTSUnitModifierData(test){moveSpeed = 6.0;};
1834.addModifier(test);
#3
1) dont use the datablock name "test", I think is used in other places, so just in case, pick another name.
2) if the problem persist, try
12/01/2007 (10:54 am)
Well its actually working for me... try this two little different angles:1) dont use the datablock name "test", I think is used in other places, so just in case, pick another name.
2) if the problem persist, try
%unit.addModifier(modifierName[b].getId()[/b]);
#4
I guess the same applies for changing building models for buildings of the same daatablock at runtime !!
Thanks
12/01/2007 (11:00 pm)
Yep.. the .getId() thing worked !!I guess the same applies for changing building models for buildings of the same daatablock at runtime !!
Thanks
#5
What I'm trying to acheive is an effect like "The Sims", when you click a fast forward button, time starts to fly quickly and units move at a very fast speed. When I have something around 100 units, the effect doesn't get totally applied before about 5 seconds (i.e. you would see some units walking fast and others walking slowly for 5 seconds), which is an unacceptable effect in my situation:
Any more ideas??
12/02/2007 (12:33 am)
Now there's another problem: the effect isn't applied instantaneously.What I'm trying to acheive is an effect like "The Sims", when you click a fast forward button, time starts to fly quickly and units move at a very fast speed. When I have something around 100 units, the effect doesn't get totally applied before about 5 seconds (i.e. you would see some units walking fast and others walking slowly for 5 seconds), which is an unacceptable effect in my situation:
for (%i = 0 ; %i < $units.getCount() ; %i++)
{
%s = $Units.getObject(%i);
%s.addModifier(Haste.getId());
}I tried to add a line sendAllStatsToClient(%s.client, %s); but that didn't help !Any more ideas??
#6
1) your problem with the modifier, means that you are working with a non-patched version (RTSKit port to last TGE - 2nd Revision). If you cannot change the version now, take a look at this bug fix that corrects a couple of problems with the modifiers implementation: Changes to buff system
2) If what you wanna do is accelerate time, the modifiers are not a very good option. The buff system is more for situattions like "power-ups", like the legendary Stim-pack (temporal stats improvement to a limited number of units).
Besides with that approach, you always have to manually change the stats to all objects, units and process in the game... very clunky. I would think in something more wide-scoped, to not have to worry about iterating through objects, units and process, nor deal with the times it would represent.
Play with the $timescale variable. However, you will have to be care about multiplayer, cause I have'nt test this and the gossip talks about problems in that aspect (read this thread: Gamespeed ?
Edit: Oh, and I forgot to mention, the value of $timescale is multiplier, which means 1 is normal, and 1.5 is just that, the standard time sacale * 1.5.
12/02/2007 (12:16 pm)
Mhhh intresting thing... but lets go for parts1) your problem with the modifier, means that you are working with a non-patched version (RTSKit port to last TGE - 2nd Revision). If you cannot change the version now, take a look at this bug fix that corrects a couple of problems with the modifiers implementation: Changes to buff system
2) If what you wanna do is accelerate time, the modifiers are not a very good option. The buff system is more for situattions like "power-ups", like the legendary Stim-pack (temporal stats improvement to a limited number of units).
Besides with that approach, you always have to manually change the stats to all objects, units and process in the game... very clunky. I would think in something more wide-scoped, to not have to worry about iterating through objects, units and process, nor deal with the times it would represent.
Play with the $timescale variable. However, you will have to be care about multiplayer, cause I have'nt test this and the gossip talks about problems in that aspect (read this thread: Gamespeed ?
Edit: Oh, and I forgot to mention, the value of $timescale is multiplier, which means 1 is normal, and 1.5 is just that, the standard time sacale * 1.5.
Torque 3D Owner Novack
CyberianSoftware
If you mean just set the unit's speed, then the "moveSpeed" field in the datablock should work.
If you wanna change the speed during mission play, you have to use Modifier Datablocks