Combat Targets?

Post » Sat Feb 19, 2011 8:14 am

Thanks in advance for any assistance.

Trying to create base effects for weapons that run custom scripts when I strike a target.

The problem is... I need to know the target I'm striking, and the only way I see to do that is with the player.GetCombatTarget function.

However, this doesn't seem to work very well.

If I strike the target with a melee weapon, which on touch runs a script that calls this function, I can get several hits off on the target before the function returns the right ActorID for the target. Why it sometimes works on like the third or fourth strike, I don't know.

Is there a better way to do this? I need the target's ID so I can do things like check if they're a creature, modify their attributes, etc.
User avatar
emma sweeney
 
Posts: 3396
Joined: Fri Sep 22, 2006 7:02 pm

Post » Sat Feb 19, 2011 6:22 am

So for the sake of documenting things here... turns out my confusion was in not understanding how you can get from an Object Effect to an Actor Effect, and how when you use the CastImmediateOnSelf function from the right location, such as a script that runs on melee strike, you're causing your TARGET to cast the effect on HIS OR HERSELF.

(This was confusing because it seemed that CastImmediateOnSelf function OUGHT to have meant causing the PLAYER to cast a spell on himself... but that wasn't the case.)

Also, even though the commands might be something like (ActorID).GetIsCreature.... you can leave out the ActorID in a script attached to an Object effect because the game knows who you're targeting, since you just struck them with a weapon that caused the effect in the first place. So just GetIsCreature is good enough.

Sadly once you get past basics in the Wiki, there are so many things you can only discover through trial/error... so if you're new to making mods like me, just stick with it and keep trying things. I made myself a pretty sweet WoW style "sap" today, just took a while to get it working realistically. Now if only there were a better model available than the police baton... lol
User avatar
luis dejesus
 
Posts: 3451
Joined: Sun Aug 19, 2007 7:40 am


Return to Fallout 3