Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-25-2012, 10:12 PM
Bleachlover551 Bleachlover551 is offline
Soul Reaper
Bleachlover551's Avatar
Join Date: Jul 2012
Location: Brunswick
Posts: 34
Bleachlover551 is an unknown quantity at this point
Post Image Following Mouse & Bomb Trail Following Mouse Script

I made this script, but if there is any bug or it doesn't work. Please message me ASAP! Also im aware that u can't use the "If (weaponfired)" Script with this script. Please also note that i'm not sure how to have a activation button like "d" pressed to make the bomb trial follow the mouse


Images(necessary):


Image Following Mouse Script:
PHP Code:
// NPC made by Toshi! (Developer)
if (created){
  
toweapons LOL xD;
setimg crystalflash.gif;
    }
if (
playerenters || timeout){
  
drawaslight;
  
x=mousex-.5;
  
y=mousey-.5;
  
timeout=.05;

Bomb Trail Following Mouse Script:
PHP Code:
// NPC made by Toshi! (Developer)
if (created){
  
toweapons LOL xD2;
}
if (
playerenters || timeout){
  
timeout=.05;
  
putexplosion2 4,1,mousex-1,mousey-1;

Like I stated "Stupid Easy" by the way I think this is GS1 but im not quite sure if it would be GS2. lol anyways leave feedback, and Thanks for taking the time to read my thread ^_^
Reply With Quote
  #2  
Old 07-26-2012, 12:02 AM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
If it's a weapon, than you can use this for your light:
PHP Code:
function onCreated() {
  
findPlayer("yourAccountHere").addWeapon(name); //add the weapon to yourself
}
//#CLIENTSIDE
function onCreated() {
  
this.usingLight false//set the flag to false; not required but I gues its better
  
this.image "crystalflash.png"//I think it will change the inventorys icon, not sure
  
onTimeOut(); //would use it with a onWeaonFired() toggle in a weapon if it shouldnt stay there all the time; made an example below
}
/*
function onWeaponFired() {
  this.usingLight = !this.usingLight; //toggles the flag (true/false)
  if (this.usingLight) onTimeOut(); //if true -> use the timeOut() function
  else { //else stop the timer and hide the image
    setTimer(0);
    hideImg(200);
  }
}
*/
function onTimeOut() {
  
with (findImg(200)) {
    
image "crystalflash.png";
    
mouseScreenX-0.5;
    
mouseScreenY-0.5;
    
alpha 0.75;
  }
  
setTimer(0.05);

And this for your bomb:
PHP Code:
function onCreated() {
  
findPlayer("yourAccountHere").addWeapon(name); //add the weapon to yourself
}
//#CLIENTSIDE
function onCreated() {
  
this.usingBomb false//set the flag to false; not required but I gues its better
  
onTimeOut(); //would use it with a onWeaonFired() toggle in a weapon if it shouldnt stay there all the time; made an example below
}
/*
function onWeaponFired() {
  this.usingBomb = !this.usingBomb; //toggles the flag (true/false)
  if (this.usingBomb) onTimeOut(); //if true -> use the timeOut() function
  else setTimer(0); //else stop the timer and hide the image
}
*/
function onTimeOut() {
  
putexplosion2(41mousex-1mousey-1); 
  
setTimer(0.05);

__________________
MEEP!
Reply With Quote
  #3  
Old 07-26-2012, 01:44 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
You should take a look at Jer's scripting guide. It won't teach you everything but it's a pretty good resource to introduce you to the platform and answer some of the basic questions you'll have.
__________________
Reply With Quote
  #4  
Old 07-26-2012, 03:57 AM
Bleachlover551 Bleachlover551 is offline
Soul Reaper
Bleachlover551's Avatar
Join Date: Jul 2012
Location: Brunswick
Posts: 34
Bleachlover551 is an unknown quantity at this point
Quote:
Originally Posted by callimuc View Post
If it's a weapon, than you can use this for your light:
PHP Code:
function onCreated() {
  
findPlayer("yourAccountHere").addWeapon(name); //add the weapon to yourself
}
//#CLIENTSIDE
function onCreated() {
  
this.usingLight false//set the flag to false; not required but I gues its better
  
this.image "crystalflash.png"//I think it will change the inventorys icon, not sure
  
onTimeOut(); //would use it with a onWeaonFired() toggle in a weapon if it shouldnt stay there all the time; made an example below
}
/*
function onWeaponFired() {
  this.usingLight = !this.usingLight; //toggles the flag (true/false)
  if (this.usingLight) onTimeOut(); //if true -> use the timeOut() function
  else { //else stop the timer and hide the image
    setTimer(0);
    hideImg(200);
  }
}
*/
function onTimeOut() {
  
with (findImg(200)) {
    
image "crystalflash.png";
    
mouseScreenX-0.5;
    
mouseScreenY-0.5;
    
alpha 0.75;
  }
  
setTimer(0.05);

And this for your bomb:
PHP Code:
function onCreated() {
  
findPlayer("yourAccountHere").addWeapon(name); //add the weapon to yourself
}
//#CLIENTSIDE
function onCreated() {
  
this.usingBomb false//set the flag to false; not required but I gues its better
  
onTimeOut(); //would use it with a onWeaonFired() toggle in a weapon if it shouldnt stay there all the time; made an example below
}
/*
function onWeaponFired() {
  this.usingBomb = !this.usingBomb; //toggles the flag (true/false)
  if (this.usingBomb) onTimeOut(); //if true -> use the timeOut() function
  else setTimer(0); //else stop the timer and hide the image
}
*/
function onTimeOut() {
  
putexplosion2(41mousex-1mousey-1); 
  
setTimer(0.05);

will other player be able to see the image as well?
Reply With Quote
  #5  
Old 07-26-2012, 04:32 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 Bleachlover551 View Post
will other player be able to see the image as well?
No. Images are only shown to all players if they're on an index less than 200 and the image is small (I think 64x64 or smaller, but not positive on that). Your server's showimg filter must also allow that image (it will by default).

If your image is small enough you could just change the index in that script to a number below 200.

Note though that the bomb is not placing explosions serverside and probably won't work (either cheat protection will stop it, if enabled (it should be for a live server) or it will only show on the player's screen, I don't know enough about the classic systems to know).
__________________
Reply With Quote
  #6  
Old 07-28-2012, 02:16 AM
Bleachlover551 Bleachlover551 is offline
Soul Reaper
Bleachlover551's Avatar
Join Date: Jul 2012
Location: Brunswick
Posts: 34
Bleachlover551 is an unknown quantity at this point
Oh..Okay Thanks for that info. I'm respect it
Reply With Quote
  #7  
Old 07-28-2012, 10:27 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
(I think 64x64 or smaller, but not positive on that)
Limit was 128x128 I believe.
__________________
Reply With Quote
  #8  
Old 07-28-2012, 10:44 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 Crow View Post
Limit was 128x128 I believe.
That would make sense, that's the size of the light2.png (etc.) images.
__________________
Reply With Quote
  #9  
Old 07-30-2012, 07:59 PM
Bleachlover551 Bleachlover551 is offline
Soul Reaper
Bleachlover551's Avatar
Join Date: Jul 2012
Location: Brunswick
Posts: 34
Bleachlover551 is an unknown quantity at this point
Oh okay.. I think I get it now.. Thanks EVERYONE ^,^
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:43 AM.


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