designation for what a target hit
-
- Fleet Officer
- Posts: 1036
- Joined: Wed Feb 03, 2010 4:28 am
- Location: Researching how to make St. Kats star go supernova.
- Contact:
I was working on an electrocution mod (shots arc from one ship to another) I have the code drawn up, but I hit a problem where A. you have to have a ship targeted, and B. It only arcs from your target. I was wondering if there was a designation like gDamaged or even like a sysFindDamaged to find which ship just got hit by each shot.
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
-
- Militia Captain
- Posts: 779
- Joined: Wed Nov 18, 2009 1:01 am
- Location: Still looking for the csc Antarctica
- Contact:
in the weapon code have the event <ondamagearmor> (or <ondamageshield>)
put something like (setq ship-i-hit gsource) (because the armor you hit is on the ship you just hit, gsource is that ship (iirc (dont quote me ))
-------------------
i have been planing a "taser" like weapon that you have to shot a beam that then hits an enemy ship, wait for the capacitors to charge (while keeping the beam on the same ship) and then send the power down the beam to disable/destroy/fry-shields-on the ship
put something like (setq ship-i-hit gsource) (because the armor you hit is on the ship you just hit, gsource is that ship (iirc (dont quote me ))
-------------------
i have been planing a "taser" like weapon that you have to shot a beam that then hits an enemy ship, wait for the capacitors to charge (while keeping the beam on the same ship) and then send the power down the beam to disable/destroy/fry-shields-on the ship




"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
sdw195 had an idea I like.
in the events <OnDamageShields> and <OnDamageArmor>, gSource is the object that was hit by the projectile.
See here for all the hardcoded aVariables and gVariables used inside those events:
http://wiki.neurohack.com/transcendence ... on_devices
in the events <OnDamageShields> and <OnDamageArmor>, gSource is the object that was hit by the projectile.
See here for all the hardcoded aVariables and gVariables used inside those events:
http://wiki.neurohack.com/transcendence ... on_devices
-
- Fleet Officer
- Posts: 1036
- Joined: Wed Feb 03, 2010 4:28 am
- Location: Researching how to make St. Kats star go supernova.
- Contact:
I've been working more on the mod I mentioned but need some help with it. Mostly, it seems like it always loops the shot back to target the player, as opposed to the nearest ship which is what I want. I found it I'm not targeting what I'm hitting and it is a friendly, it will hit the nearest enemy. Also, it insta-kills any ship it touches without shields. I can't see why it kills instantly, it has really low damage... anyway, my code is here:
Code: Select all
<ItemType UNID="&itLightning;"
name= "Electric Arc Cannon"
level= "1"
value= "1500"
mass= "1500"
frequency= "notRandom"
modifiers= "EnergyWeapon; MajorItem; Illegal"
description= "A weapon created by the Taikon Corporation, this weapon was outlawed because of its tendency to be used by pirates. It's bolts will continue to kill enemies."
>
<Image imageID="&rsItems1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
fireRate= "1"
powerUse= "10"
type= "missile"
lifetime= "50-100"
damage= "ion:1d3"
missileSpeed= "80-100"
hitPoints= "1"
maneuverability= "3-4"
directional= "true"
sound= "&snMissileLauncher;"
vaporTrailLength="6"
vaporTrailWidth="130"
vaporTrailWidthInc="1"
vaporTrailColor="0x10, 0x32, 0xff"
multiTarget= "true"
autoAcquireTarget= "true"
configuration = "alternating"
>
</Weapon>
<Events>
<OnDamageArmor>
(block (target fireAngle)
(setq target (item (sysfindobject gSource "sN:200") 0))
(block (fireAngle)
(setq fireAngle (sysVectorAngle (sysVectorSubtract (objGetPos target) (objGetPos gSource))))
(sysCreateWeaponFire &itLightning; gSource (objGetPos gSource) (sysVectorAngle (sysVectorSubtract (objGetPos target) (objGetPos (objGetPos gSource)))) 100 target)
)
)
</OnDamageArmor>
</Events>
</ItemType>
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
- Arisaya
- Fleet Admiral
- Posts: 5535
- Joined: Tue Feb 05, 2008 1:10 am
- Location: At the VSS Shipyards in the frontier, designing new ships.
Atarlost has a working chain-lightning weapon; you might want to ask him for help
(shpOrder gPlayership 'barrelRoll)
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
Not sure why it always goes for the player. It may be that the object list is sorted by objectID and the player may be generated before any other ships on entering a system. "sN" with no radius is the nearest ship (not a list) and may give better behavior. My weapon uses random instead of item 0, but this obviously is not the behavior you're looking for.
It's instakilling stuff because it's returning the objectID of the shot fired by syscreateweaponfire, which is a large number. Probably the number of space objects in the system, but possibly one higher if object zero is used for an error condition.
The last thing you have in your block is your return value and what you return is the damage dealt. This needs to be aDamageHP.
It's instakilling stuff because it's returning the objectID of the shot fired by syscreateweaponfire, which is a large number. Probably the number of space objects in the system, but possibly one higher if object zero is used for an error condition.
The last thing you have in your block is your return value and what you return is the damage dealt. This needs to be aDamageHP.
Literally is the new Figuratively
-
- Fleet Officer
- Posts: 1036
- Joined: Wed Feb 03, 2010 4:28 am
- Location: Researching how to make St. Kats star go supernova.
- Contact:
I'm not quite sure I follow you on the insta-kill.
I did some code tweaking and not it doesn't target the player. I think it was because it didn't have a command to do if there was an object outside its range. I added a switch that seems to make it work. It also seems to target as I want now but it always comes out of the front of the ship. I made a virtual weapon that is exactly the same but omnidirectional (and lower range) but it still goes out the front. In my switch fall-back I have it make the shot go randomly in a direction, and it goes off at the correct random angle. I am very confused now. My new code is this:
I did some code tweaking and not it doesn't target the player. I think it was because it didn't have a command to do if there was an object outside its range. I added a switch that seems to make it work. It also seems to target as I want now but it always comes out of the front of the ship. I made a virtual weapon that is exactly the same but omnidirectional (and lower range) but it still goes out the front. In my switch fall-back I have it make the shot go randomly in a direction, and it goes off at the correct random angle. I am very confused now. My new code is this:
Code: Select all
<ItemType UNID="&itLightning;"
name= "Electric Arc Cannon"
level= "1"
value= "1500"
mass= "1500"
frequency= "notRandom"
modifiers= "EnergyWeapon; MajorItem; Illegal"
description= "A weapon created by the Taikon Corporation, this weapon was outlawed because of its tendency to be used by pirates. It's bolts will continue to arc and kill enemies."
>
<Image imageID="&rsItems1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
fireRate= "1"
powerUse= "10"
type= "missile"
lifetime= "50-100"
damage= "ion:1d3; EMP1"
missileSpeed= "80-100"
hitPoints= "1"
maneuverability= "3-4"
directional= "true"
sound= "&snMissileLauncher;"
vaporTrailLength="6"
vaporTrailWidth="130"
vaporTrailWidthInc="1"
vaporTrailColor="0x10, 0x32, 0xff"
multiTarget= "true"
autoAcquireTarget= "true"
configuration = "alternating"
>
</Weapon>
<Events>
<OnDamageArmor>
(switch
(leq (objGetDistance gSource (sysFindObject gSource "sN")) 8)
(block (target fireAngle)
(setq target (sysfindobject gSource "sN"))
(block (fireAngle)
(setq fireAngle (sysVectorAngle (sysVectorSubtract (objGetPos target) (objGetPos gSource))))
(sysCreateWeaponFire &vtLightningArc; gSource (objGetPos gSource) (sysVectorAngle (sysVectorSubtract (objGetPos target) (objGetPos (objGetPos gSource)))) 100 target)
)
)
(geq (objGetDistance gSource (sysFindObject gSource "sN")) 8)
(block nil
(sysCreateWeaponFire &vtLightningArc; gSource (objGetPos gSource) (random 0 359) 100 gSource)
)
)
</OnDamageArmor>
</Events>
</ItemType>
<ItemType UNID="&vtLightningArc;"
name= "Electric Arc Cannon"
level= "1"
virtual="true"
>
<Image imageID="&rsItems1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
fireRate= "1"
powerUse= "10"
type= "missile"
lifetime= "5-9"
damage= "ion:1d3;EMP"
missileSpeed= "80-100"
hitPoints= "1"
omnidirectionsl= "true"
maneuverability= "1-2"
sound= "&snMissileLauncher;"
vaporTrailLength="6"
vaporTrailWidth="130"
vaporTrailWidthInc="1"
vaporTrailColor="0x10, 0x32, 0xff"
multiTarget= "true"
autoAcquireTarget= "true"
configuration = "alternating"
>
</Weapon>
<Events>
<OnDamageArmor>
(switch
(leq (objGetDistance gSource (sysFindObject gSource "sN")) 8)
(block (target fireAngle)
(setq target (sysfindobject gSource "sN"))
(block (fireAngle)
(setq fireAngle (sysVectorAngle (sysVectorSubtract (objGetPos target) (objGetPos gSource))))
(sysCreateWeaponFire &vtLightningArc; gSource (objGetPos gSource) (sysVectorAngle (sysVectorSubtract (objGetPos target) (objGetPos (objGetPos gSource)))) 100 target)
)
)
(geq (objGetDistance gSource (sysFindObject gSource "sN")) 8)
(block nil
(sysCreateWeaponFire &vtLightningArc; gSource (objGetPos gSource) (random 0 359) 100 gSource)
)
)
</OnDamageArmor>
</Events>
</ItemType>
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
Regarding the insta-kill, You need to read the OnDamageArmor section on the wiki http://wiki.neurohack.com/transcendence ... ces#events
Particularly focus on the section about the return value of the event.
Particularly focus on the section about the return value of the event.
-
- Fleet Officer
- Posts: 1036
- Joined: Wed Feb 03, 2010 4:28 am
- Location: Researching how to make St. Kats star go supernova.
- Contact:
Thanks for the help. I have it working as intended except for a small issue. When I @#$! a ship, the shots come right back to hit me if I'm within range. The problem is that they only sometimes come in my direction. The rest are from the upper right or lower right, and loop around to hit me. It seems to vary with my angle; If I'm right or up, it works correctly. If I'm down or left, it comes out of the wrong angle.
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?