View Single Post
  #8  
Old 05-22-2014, 10:08 AM
i8bit i8bit is offline
Registered User
Join Date: Jul 2013
Posts: 146
i8bit is an unknown quantity at this point
Quote:
Originally Posted by Tigairius View Post
I don't post on the Graal forums anymore and I shouldn't care, but I was just checking in and it irked me that such a simple question wasn't fully answered yet. There's several ways to do this. As Callimuc mentioned, one of the nicer ways is using a triggeraction.

Clientside, you'll specify a x,y as well as an "action" name (for when the object/player gets hit) and the action's parameters.

Example:
PHP Code:
//#CLIENTSIDE
// triggeraction(hit x, hit y, action name, action parameter(s))
triggeraction(player.1.5 vecx(player.dir) * 1.5player.vecy(player.dir) * 1.5"Hit"player.account); 
Here, the "hitter" will "trigger an action" on anything that is at the specified hit x and hit y. In this case, it is directly in front of the hitter. We should also pass the hitter's account to the object/player being hit.
For an explanation on vecx and vecy and how they work in the above example, see a post of mine from a couple of years ago: http://forums.graalonline.com/forums....php?p=1649547

Now, the object being hit can expect to have the following to handle the action:
PHP Code:
function onActionHit(acct) {
  
this.chat "I've been hit by " acct;


TIG!! Thank you so much sir. You are a big help to new scripties like myself trying to learn. You explain very well!



Graal forums are so kind to me
Reply With Quote