Reducing overkill - Page 2

Reducing overkill

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Cool I didn't know BlockShotX picks another target, I thought it only prevented the weapon from shooting.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Yeah, I will have to test this when I get home.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

so, how would this look thrown in a script?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Code: Select all

AimWeapon1(heading,pitch,RandomSeed)
{
   RandomSeed = RAND(0,4)
   If(RandomSeed > 1)
   (
       SET BlockShot1(TARGET_ID,1)
   } else {
   //DO AIMING CODE HERE
   }
   Return(1);
}
... I guess? It's unclear how BlockShot is supposed to be called, and I'm at Work, I don't have enough time to look at the sourcecode... it'd be nice if this was documented a bit more completely.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Probably something like

Code: Select all

BlockShotX(unitID, blockShot) {
	if (unitID) blockShot = TRUE;
}
I think unitID was > 0 for aircraft. So this would make the unit stop targeting it's current target if it was an aircraft. I'd like to know what unitID is good for other than the obvious...

Anyway, you could count the amount of rounds you fired and if it exceeds a certain number have BlockShotX() pick another target and reset the counter. It's always getting called by the way, before AimWeaponX() I think.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

unitID is the same thing that it is in Lua and in the engine (and even in COB) - it's a unique identifier of a unit. You can use LuaCOB to know more (= everything) if you've got its id.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Why's it zero for ground targets then?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

"ground targets" means "attack ground".
Post Reply

Return to “Engine”