Jump to content

WoW-like targeting


psyduck

Recommended Posts

i want to write WoW like targeting and i dont know how to make it good

my idea is something like that i shot a player/ped/element and i get its id (onPlayerDamage?) and store it somewhere (setElementData?) attaches arrow its id will be available to other functions and if other element is shooted it deataches arrow and removes target and sets new one

i was messing around with getPedTarget and other methods but it just was crapp

  
  
  
function playerDamage_text ( attacker, weapon, bodypart, loss ) --when a player is damaged 
  
local target = getPedTarget ( source )  
  
outputChatBox ( "dmg "..getPlayerName(attacker).." "..getPlayerName(source), getRootElement (), 255, 170, 0 ) 
  
setElementData ( source, "tempdata.target", getPlayerName(source) ) 
  
local targettest =getElementData( source, "tempdata.target" ) 
outputChatBox("test target"..targettest) 
  
end 
addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) 
  
  
  
  
  
function skillTemp(thePlayer, cmd) 
   local value = getElementData( thePlayer, "tempdata.target" ) 
   local player = getPlayerFromName (value) 
   outputChatBox("test target"..value) 
   setPedOnFire (player, true) 
  
end 
addCommandHandler("dg", skillTemp) 
  
  
  
  
  

anybody have some protips how to write it right?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...