Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Image Following Mouse & Bomb Trail Following Mouse Script (https://forums.graalonline.com/forums/showthread.php?t=134266852)

Bleachlover551 07-25-2012 10:12 PM

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):
http://bleachlover551.webs.com/crystalflash.gif

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 ^_^

callimuc 07-26-2012 12:02 AM

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);



cbk1994 07-26-2012 01:44 AM

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.

Bleachlover551 07-26-2012 03:57 AM

Quote:

Originally Posted by callimuc (Post 1700133)
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?

cbk1994 07-26-2012 04:32 AM

Quote:

Originally Posted by Bleachlover551 (Post 1700144)
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).

Bleachlover551 07-28-2012 02:16 AM

Oh..Okay :) :blush: Thanks for that info. I'm respect it ^^

Crow 07-28-2012 10:27 AM

Quote:

Originally Posted by cbk1994 (Post 1700145)
(I think 64x64 or smaller, but not positive on that)

Limit was 128x128 I believe.

cbk1994 07-28-2012 10:44 AM

Quote:

Originally Posted by Crow (Post 1700389)
Limit was 128x128 I believe.

That would make sense, that's the size of the light2.png (etc.) images.

Bleachlover551 07-30-2012 07:59 PM

Oh okay.. I think I get it now.. Thanks EVERYONE ^,^


All times are GMT +2. The time now is 04:11 PM.

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