Weapon hit detection
-
- Militia Commander
- Posts: 451
- Joined: Sat Jul 25, 2015 11:41 pm
- Location: repairing armor
I'd also be interested in this. It'd be cool, for example, to have a missile that heals friendly targets but does nothing to hostile targets. (EDIT: A barrel launcher that uses armor repair paste, repair kits, etc. to heal its target?)
Last edited by gunship256 on Mon Feb 29, 2016 5:23 pm, edited 1 time in total.
I summarized how hit detection works here, but I'm not sure that helps for this.
It might be tricky, but I think what you want should be possible using the <OnFragment> event. This replaces the weapon's normal fragments with a script, which could search for objects within a certain distance and repair their armor, increase their internal HP, etc., if they are friendly to the firing ship.
It might be tricky, but I think what you want should be possible using the <OnFragment> event. This replaces the weapon's normal fragments with a script, which could search for objects within a certain distance and repair their armor, increase their internal HP, etc., if they are friendly to the firing ship.
Maybe use events like <OnDamage> and others to control what happens when a shot hits.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
- AssumedPseudonym
- Fleet Officer
- Posts: 1190
- Joined: Thu Aug 29, 2013 5:18 am
- Location: On the other side of the screen.
It sounds like what you want might be the <OnShotDestroyed> event implemented in API 27.
Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)
My mods on Xelerus: Click here!
Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
-
- Militia Commander
- Posts: 451
- Joined: Sat Jul 25, 2015 11:41 pm
- Location: repairing armor
AssumedPseudonym wrote:It sounds like what you want might be the <OnShotDestroyed> event implemented in API 27.
Thanks! I assume that gItem is the shot that was destroyed, right? Can I still get information on gItem even if the shot doesn't exist any more?Added <OnCreateShot> and <OnDestroyShot> for weapons. These are called when a shot is created and destroyed. They are called after OnFireWeapon and for each shot created. gSource is the shot object.
- AssumedPseudonym
- Fleet Officer
- Posts: 1190
- Joined: Thu Aug 29, 2013 5:18 am
- Location: On the other side of the screen.
Actually, gSource is the projectile, in this case. I'll be better able to give a rundown on what all of the populated variables are tomorrow night whe I get back hom, if you need.
Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)
My mods on Xelerus: Click here!
Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
-
- Militia Commander
- Posts: 451
- Joined: Sat Jul 25, 2015 11:41 pm
- Location: repairing armor
That would be helpful - thanks! If gSource is the projectile, is there a way to access the object the projectile hit? Would I need to use distance detection code to find the object?AssumedPseudonym wrote:Actually, gSource is the projectile, in this case. I'll be better able to give a rundown on what all of the populated variables are tomorrow night whe I get back hom, if you need.
EDIT: I'm thinking about creating a missile that acts like the Lumnious tame cube (using quantum cubes as ammo?) in that it would be able to enslave another ship. <OnDestroyShot> wouldn't tell me anything about what kind of damage the shot did, right? For example, if I wanted the missile's probability of enslaving the ship to be proportional to the amount of armor or internal HP damage it did, would there by any way to know that?
EDIT #2: Is there a way to make the shots themselves carry information? For example, could I load the shot with playership data like shield and armor status and then access the data later? It would be interesting to make the probability of capturing the ship based on the relative conditions of the attacking and target ships' armor status. If a special launcher were made to do this that would take barrels of armor repair paste, repair kits, repairing nanos, regen nanos, and patcher arms as ammo, the shot could be given data based on what ammo was used to fire it, and a healing device could be installed on the target to repair its armor if ship capture is successful.