Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-29-2007, 06:48 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Strafe [could be used as a shield block]

Well, here's a stafe thing.
HTML Code:
//#CLIENTSIDE
function onCreated()
{
  movement = this;
}

public function onStaticDirection(newDirection)
{
  if (playerDirection != temp.newDirection)
  {
    playerDirection = temp.newDirection;
  }
  if (keydown2(160, true) && playerShield)
  {
    setani("c_shieldblock", "");
    player.dir = playerDirection;
    scheduleevent(0.05, "StaticDirection", playerDirection);
  }
   else
  {
    playerShield = false;
  }
}
How it's called

HTML Code:
//#CLIENTSIDE
function onKeyPressed(letterCode)
{  
  switch(temp.letterCode)
  {
    case 160:
      playerShield = true;
      movement.onStaticDirection(player.dir);
    return true;
  }
}
Advise, make all the keyPressed actions all in one weapon, and then just send it through there
__________________
Reply With Quote
  #2  
Old 05-31-2007, 01:38 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Make sure you add a a break in that case 160:

Few things that could work only on your server though.

Otherwise nice, I never realised you could do movement = this; on clientside, and then call it from other weapons!
__________________
Reply With Quote
  #3  
Old 05-31-2007, 01:39 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Uhm..

PHP Code:
movement this
That looks retarded. Why not just name the wNPC to "movement" and do movement.SomeFunctionHere() ?
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 05-31-2007, 01:41 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xXziroXx View Post
Uhm..

PHP Code:
movement this
That looks retarded. Why not just name the wNPC to "movement" and do movement.SomeFunctionHere() ?
How so?

Notice this is in the code gallery, so people using it might not have custom Q Menus.

In that case, it could be deleted! That would be bad
There's nothing wrong with what xAndrewx did... I like it.

Better than doing

( @ "-System/Movement" ).doSomething();
__________________
Reply With Quote
  #5  
Old 05-31-2007, 01:44 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by cbkbud View Post
I like it.
Good for you! I don't though.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 05-31-2007, 01:49 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xXziroXx View Post
Good for you! I don't though.
Why not? It seems perfectly logical to me.
__________________
Reply With Quote
  #7  
Old 05-31-2007, 10:44 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I don't use break, as it would carry on with the script. Calling return just stops the function at hand.
__________________

Last edited by Skyld; 05-31-2007 at 11:37 AM.. Reason: I don't know what the hell your problem is lately but stop it. I've had to edit/delete too many of your posts lately.
Reply With Quote
  #8  
Old 05-31-2007, 12:33 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by xAndrewx View Post
I don't use break, as it would carry on with the script. Calling return just stops the function at hand.
It's probably a better practice to always break; at the end of the switch, then use return. Personal preference I suppose though.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.