Difference between revisions of "GetCombatTarget"

Jump to navigation Jump to search
13 bytes removed ,  02:20, 10 October 2008
m
Just fixed some grammatical errors and alignment isues
imported>Qazaaq
m (adding tooltip to AoE)
imported>Shademe
m (Just fixed some grammatical errors and alignment isues)
 
Line 5: Line 5:


Player.GetCombatTarget will always return 0 as the game cannot read the player's mind.<BR>
Player.GetCombatTarget will always return 0 as the game cannot read the player's mind.<BR>
''- A loose workaround for this can be done by checking the combat targets of any NPC's within a given proximity of the Player, see below.''
:''- A loose workaround for this can be done by checking the combat targets of any NPC's within a given proximity of the Player, see below.''
==Retrieving the Player's Potential Combat Targets==
==Retrieving the Player's Potential Combat Targets==
*To get the player's potential combat targets, you can either cast an {{Tooltip|AoE|Area of Effect}} spell in the vicinity of the player, with the script attached to the spell could be:
*To get the player's potential combat targets, an {{Tooltip|AoE|Area of Effect}} spell can be cast in the vicinity of the player, with a script attached :


<pre>begin scriptEffectStart
begin ScriptEffectStart
     if ( getCombatTarget == player )
     if ( GetCombatTarget == player )
         ;  Do stuff
         ;  Do stuff
     endIf
     endif
end</pre>
end


To use a centralized script, have the spell pass the NPC's reference to an [[Activate|activator]] [[Activation_Functions|function]]
To use a centralized script, have the spell pass the NPC's reference to an [[Activate|activator]] [[Activation_Functions|function]]
Line 23: Line 23:
  end
  end


The downside - each NPC can't have its own set of variables, but most of the time their not necessary.
The downside to this solution is that each NPC can't have its own set of variables, but most of the time they are not necessary.


* In turn, OBSE's [[GetFirstRef|Reference Walking Functions]] to get the references within a certain proximity to the player, check for their combat targets and do the appropriate code. Make sure this script in second intervals or greater. To track the combat targets, a [[Pluggy|Pluggy]] reference array can be used.
* In turn, OBSE's [[GetFirstRef|Reference Walking Functions]] to get the references within a certain proximity to the player, check for their combat targets and do the appropriate code. Make sure this script in second intervals or greater. To track the combat targets, a [[Pluggy|Pluggy]] reference array can be used.
Anonymous user

Navigation menu