Gadget: https://github.com/ZeroK-RTS/Zero-K/blo ... _radar.lua
Example LUS: https://github.com/ZeroK-RTS/Zero-K/blo ... rmmerl.lua
This is a gadget that shows how I block firing at radar dots. It is a bit more complicated than that partially because I implemented the mechanic in some optional unit AI. I have some units with precise, long ranged, low AoE weapons so it is often wasteful for them to shoot at wobbly radar dots. The method in this gadget could probably be used for any type of conditional targeting.
I said that this gadget is messy but it is the method which is messy rather than the code. Units seem to acquire targets in many ways. Also I do not know which engine it was written for but it works with 97.0+ and I doubt I have looked at it in two years.
Units can fire while moving so must be able to acquire targets without any command handling. Units can also give themselves attack commands when idle and this command seems to interfere with SetUnitTarget. So both SetUnitTarget and command queue editing have to be used. I distinguish between commands given by units (internal commands) and those issued by players by not removing the player command. This means that a unit told to attack an illegal target will wait until the target is legal.
This gadget uses AllowWeaponTarget. The important thing about this callin is that it is called every 16 frames. This is fine by me because it seems to be called for every unit within the range of every other unit, the performance implications are scary.
The limitation of AllowWeaponTarget leads to the tedious part of implementing this for all units in a game. Units which use this gadget need to call a notification function in script.AimWeapon and a block check in script.BlockShot. The gadget is only reliable due to BlockShot and this can add targeting delay.
Blocking radar dot fire example
Blocking radar dot fire example
Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)
Moderator: Moderators
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Jump to
- Community
- ↳ General Discussion
- ↳ Help & Bugs
- ↳ Ingame Community
- ↳ Spring Clans
- ↳ Tournaments
- ↳ Linux
- ↳ Mac OS X
- ↳ Off Topic Discussion
- Content Development
- ↳ Game Development
- ↳ Game Development Tutorials & Resources
- ↳ Game Releases
- ↳ Map Creation
- ↳ Map Tutorials & Resources
- ↳ Map Releases
- ↳ Lua Scripts
- ↳ Art & Modelling
- ↳ Modelling & Texturing Tutorials & Resources
- ↳ Sound Effects & Music
- ↳ Project Subforums
- ↳ Balanced Annihilation
- ↳ Balanced Annihilation Reloaded
- ↳ Conflict Terra
- ↳ The Cursed
- ↳ Evolution RTS
- ↳ Jauria RTS
- ↳ Kernel Panic
- ↳ Journeywar
- ↳ Ludum Dare
- ↳ MechCommander: Legacy
- ↳ Metal Factions
- ↳ MOSAIC
- ↳ NOTA
- ↳ Phoenix Annihilation
- ↳ SpringBoard
- ↳ Spring: 1944
- ↳ Star Wars: Imperial Winter
- ↳ TA Prime
- ↳ Tech Annihilation
- ↳ XTA
- ↳ Zero-K
- ↳ Project Archive
- ↳ Argh's Projects
- ↳ Caydr's Projects
- ↳ Damned
- ↳ Dune: Evolution
- ↳ Engines Of War
- ↳ Evolution RTS
- ↳ Progressive Annihilation
- ↳ Supreme Annihilation
- ↳ Spring Tanks
- ↳ PanzerStahl
- Development
- ↳ News
- ↳ Engine
- ↳ Dedicated Developer Discussion
- ↳ New Developer Discussion
- ↳ Meeting Minutes
- ↳ AI
- ↳ Lobby Clients & Server
- ↳ Infrastructure Development
- ↳ Lobby Meeting Minutes
- ↳ SPADS AutoHost
- ↳ SpringLobby Client
- ↳ Feature Requests
- ↳ Bounty Offers
- ↳ The Werewolf Game
- ↳ News Submissions
- Site content
- ↳ Community Blog
- ↳ Site content
- ↳ Banners
- ↳ Welcome images
- ↳ Videos
- ↳ Videos - contributions
- ↳ Screenshots
- ↳ Screenshots - contributions