Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   RC Plane Script (https://forums.graalonline.com/forums/showthread.php?t=134264426)

Gunderak 08-31-2011 10:00 AM

RC Plane Script
 
1 Attachment(s)
I haven't added everything id like to yet but here is the basic concept of what im making.
Feedback is appreciated :D
Everything is in the zip folder.

Instructions:
1: Place all image files in levels/images and ensure folder config is right.
2: Place all gani files in levels/ganis and ensure folder config is right.
3: Make a weapon named whatever and copy everything from the plane script.
3: If you want this to actually do damage to players upload the projectiles script.

Enjoy.
-Gunderak

Mark Sir Link 08-31-2011 10:08 AM

should probably avoid putting enabledefmovement() in the onCreated event of scripts since it could have unintended consequences if the player receives the item when their movement is intentionally disabled.

doesn't seem like there is a way to cancel out of the weapon after you use it (beyond reconnecting or adding it to yourself again)

if you're using default movement, you should use hitplayer instead of player.hearts -= .5;

Gunderak 08-31-2011 10:26 AM

does hitplayer do 0.5 damage?

Gunderak 08-31-2011 10:39 AM

is there any way to check if a projectile hits a certain x and y?

Mark Sir Link 08-31-2011 10:49 AM

Quote:

Originally Posted by Gunderak (Post 1666366)
does hitplayer do 0.5 damage?

hitplayer is passed a few params, which are player ID, damage, attacker x, attacker y.

passing 0 as the ID would make it hit the own player.

Gunderak 08-31-2011 01:22 PM

is there any way of detecting projectiles at a certain x and y range?
other was il have to make the player follow this.x and this.y and male it a gani.

fowlplay4 08-31-2011 05:30 PM

Shoot projectiles call onActionProjectile2 when they land/hit someone.

PHP Code:

//#CLIENTSIDE
function onActionProjectile2() {
  echo(
"Projectile landed: " params);


Before using shoot it helps if you store the player's account or some unique identifier so you can figure out where it came from when the projectile lands in the projectile's parameters. I.e:

setshootparams("missile", player.account);

callimuc 08-31-2011 08:11 PM

Some feedback:

Style your scripts,

PHP Code:

hideimg(1);
hideimg(2);
hideimg(3); 

should in my oppinion be
PHP Code:

hideimgs(1,3); 

for pressing the keys:
You should place the plane into a gani and use the following in your timeout
PHP Code:

for (a=0;a<4;a++) {
  if (
keydown(a)) {
    
this.x+=vecx(a)*0.5//normal players speed. change the *# to any number you want the speed to be
    
this.y+=vecy(a)*0.5//same
    
this.dir=k;
  }


Didn´t test it but should work

Gunderak 09-01-2011 01:19 AM

iv made it a gani but how would i show a gani away from the player and make it act on projectiles? im confused completly.

callimuc 09-01-2011 02:21 AM

The basics of your script could look like:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.on false;
  
onTimeOut();
}
function 
onWeaponFired() {
  if (
this.on == false) { //I know there are better ways but I still prefer this one, can´t tell why
    
this.on true;
    
disabledefmovement();
  }
  else if (
this.on == true) {
    
this.on false;
    
enabledefmovement(); //currently not sure if you can fire weapons while you are in disabledefmovement()
  
}
}

function 
onTimeOut() {
  if (
this.on == true) {
    for (
04a++) {
      if (
keydown(a)) { //moving keys have been pressed
        
this.plane_x += vecx(a)*0.5//normal players speed. change the *# to any number you want the speed to be
        
this.plane_y += vecy(a)*0.5//same
        
this.plane_dir k;
        
this.plane_ani "YourAniNameHere"//put in the flying gani name of your plane
      
}
      else 
this.plane_ani "YourAniNameHere"//put in the idle gani of your plane
    
}
    
DrawPlane(); //starting the event DrawPlane
    
settimer(0.05);
  }
}

function 
DrawPlane() { 
  
with (findimg(1)) {   
    
thiso.plane_x
    
thiso.plane_y
    
ani thiso.plane_ani;
    
dir thiso.plane_dir;
    
layer 1
  }  


Again couldn´t test it and just quick writed it so if there are any problems just tell me

Gunderak 09-01-2011 01:39 PM

i havnt had a chance to test it yet as im not homw but thanks i really apprifiate you taking time to actually write all that :)
il be sure to test around when im home.

callimuc 09-02-2011 05:07 AM

Lol 100% sure the person won´t response but who neg repped me saying
Quote:

wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben wegbleiben~~~~~~~~~~~~
?

Seems like someone was bored or very mad xD

Gunderak 09-04-2011 07:55 AM

iv made it a gani and done it and it works perfect now :D thanks for your help.


All times are GMT +2. The time now is 01:46 AM.

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