Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-31-2011, 10:00 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
RC Plane Script

I haven't added everything id like to yet but here is the basic concept of what im making.
Feedback is appreciated
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
Attached Files
File Type: zip RCPlane.zip (3.2 KB, 209 views)
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 08-31-2011, 10:08 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
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;
Reply With Quote
  #3  
Old 08-31-2011, 10:26 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
does hitplayer do 0.5 damage?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 08-31-2011, 10:39 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
is there any way to check if a projectile hits a certain x and y?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #5  
Old 08-31-2011, 10:49 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Gunderak View Post
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.
Reply With Quote
  #6  
Old 08-31-2011, 01:22 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #7  
Old 08-31-2011, 05:30 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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);
__________________
Quote:
Reply With Quote
  #8  
Old 08-31-2011, 08:11 PM
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
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
__________________
MEEP!
Reply With Quote
  #9  
Old 09-01-2011, 01:19 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #10  
Old 09-01-2011, 02:21 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
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
__________________
MEEP!

Last edited by callimuc; 09-01-2011 at 02:38 AM..
Reply With Quote
  #11  
Old 09-01-2011, 01:39 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
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.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #12  
Old 09-02-2011, 05:07 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
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
__________________
MEEP!
Reply With Quote
  #13  
Old 09-04-2011, 07:55 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
iv made it a gani and done it and it works perfect now thanks for your help.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
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 01:46 AM.


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