Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   setani problems (https://forums.graalonline.com/forums/showthread.php?t=134268288)

defaultaccount 06-01-2013 05:02 AM

setani problems
 
I`m having trouble at the simplest script to show a gani. It just makes my character invisible when I use it, I`m trying to make a gunscript I read a lot of topics and how to script and tutorials, but I`m having trouble with set animation, I think it has to do with my servers set-up im not sure. But I`m trying to learn the best I can. I tried searching for a solution but I didn't find anything.

NPC Code:
//#CLIENTSIDE

function onWeaponFired() {
setani ("idle" , null);
}


cbk1994 06-01-2013 05:17 AM

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
setAni("idle"null);


That should work—only difference is no space after setAni. But even if the engine complains about that (and I don't know if it does), that shouldn't turn you invisible.

What do you see in F2, particularly under "Files" and "Scripts"?

defaultaccount 06-01-2013 05:31 AM

I didn`t think of checking in F2 but I will from now on, but at first it said idle gani wasn't in the folder, I thought it would load the default idle gani. I added it now but in file im getting a different error now :
Quote:

Data directory: C:/Users/HP/Graal/
Scanned install files.
Scanning files ...
Scanning done.
File download: loginserver_en.po not foundFile download: http://external.ak.fbcdn.net/safe_im...s%2Ftrynow.png (size: 8366) done
Couldn't open C:/Users/HP/Graal/webfiles/http%058%047%047external%046ak%046fbcdn%046net%047 safe_image%046php%063d%061AQA6eOUZccJHPxYZ%038w%06 1154%038h%061154%038url%061http%0373A%0372F%0372Fw ww%046graalonline%046com%0372Fthemes%0372Fplayerwo rlds%0372Fimages%0372Ftrynow%046png for writing!
File download: ("idle".gani not found
File download: login_icon_developer116.png not found
File download: tempsitcbd.ttf not found
I updated the file even to the old idle gani and it still wont show, it doesn`t read the file in my folders

` File download: ("idle".gani not found `

cbk1994 06-01-2013 05:32 AM

Looks like the problem actually is the space. It's interpreting it like GS1. Just remove the space before the opening parenthesis in setAni.

defaultaccount 06-01-2013 05:43 AM

works now thank you man, I've been waiting 2 days on why this wasn't working. I got two half made gunscripts I can combine and make one. thank you for replying ill keep an eye out for that sort of thing for next time and search the forums before posting

defaultaccount 06-04-2013 03:32 AM

I'm trying to get this to work I'm not setting the variable right can someone help please

NPC Code:
function OnCreated () {
this.idle = "pb_mp5navy-idle";
setani(this.idle, null);
}


dylan 06-04-2013 09:26 PM

Quote:

Originally Posted by defaultaccount (Post 1718798)
I'm trying to get this to work I'm not setting the variable right can someone help please

NPC Code:
function OnCreated () {
this.idle = "pb_mp5navy-idle";
setani(this.idle, null);
}


The function is onCreated() not OnCreated(). :)

Edit: Hmm seems it wasn't that, but setani is a clientside function so you're sure that you're calling it there?

scriptless 06-04-2013 11:52 PM

Quote:

Originally Posted by defaultaccount (Post 1718798)
I'm trying to get this to work I'm not setting the variable right can someone help please

NPC Code:
function OnCreated () {
this.idle = "pb_mp5navy-idle";
setani(this.idle, null);
}


PHP Code:

//#CLIENTSIDE
function onCreated () {
  
this.idle "walk";
  
setani(this.idlenull);


Works for me, tho I tend to do temp.idle rather then this.idle out of habbit because sometimes this.variables can conflict with the object itself.

defaultaccount 06-05-2013 06:08 PM

I also got it working on the test script, i'm going to try to migrate this to the whole gunscript I'll post the script once I'm finished


edit: the whole script isn't working it works without the gani variables but when I try to make it like in the script shown above it doesn't play any of the ganis

here's the script

Quote:

//#CLIENTSIDE
function onEquip () {
this.equiped = true;
freezeplayer(this.equip);
setani("pb_mp5navy-equip", null);
replaceani("walk", "pb_mp5navy-walk");
replaceani("idle", temp.idle);
}
function onCreated() {
this.spread = 0.00; // Controls the spread of weapon
this.speed = 0.2; // Controls the fire rate of weapon
this.reload = 0.1;
this.freeze = 0.1;
this.bulletangle = -.5;
this.equip = 0.2;
disableweapon(sword);
temp.idle = "pb_mp5navy-idle";

all im trying to do is get the ganis set as variables something is wrong with it because it's not playing the setanis or replace anis but on the test script the code im using but the temp.idle is making me invisable

Tim_Rocks 06-05-2013 06:49 PM

In the future I'd try using PHP and http://www.fp4.ca/gs2beautifier/ before posting on the forums. Makes it a lot easier to read.

PHP Code:

// Weapons Script for PB (PLANET BASE) 
// MADE BY: Take(Defaultaccount),Delta(),

//#CLIENTSIDE
function onEquip() {
  
this.equiped true;
  
freezeplayer(this.equip);
  
setani(this.equip2null);
  
replaceani("walk"this.walk);
  
replaceani("idle"this.idle);
}

function 
onCreated() {
  
this.spread 0.00// Controls the spread of weapon
  
this.speed 0.2// Controls the fire rate of weapon
  
this.reload 0.1// Controls the reload of the weapon
  
this.freeze 0.05// Controls the freeze of the weapon
  
this.equip 0.5// Controls the equip time of the weapon
  
this.bspeed 1// Controls the speed of the bullet
  
this.bulletangle = -.5// Controls the angle of the bullet

  
disableweapon(sword);

  
setani(this.idlenull);
  
this.walk "pb_mp5navy-walk";
  
this.idle "pb_mp5navy-idle";
  
this.ewalk "pb_mp5navy-unequiped-walk";
  
this.eidle "pb_mp5navy-unequiped-idle";
  
this.equip2 "pb_mp5navy-equip";
  
this.unequip "pb_mp5navy-unequip";
  
this.fire "pb_mp5navy-fire";
  
this.reload2 "pb_mp5navy-unequip";
}

function 
GraalControl.onKeyUp(codekeyscan) {
  if (
key == "a") {
    
freezeplayer(this.reload);
    
setani(this.reload2null);
  }
  if (
key == "f") {
    
setani(this.unequipnull);
    
replaceani("walk"this.ewalk);
    
replaceani("idle"this.eidle);
    
freezeplayer(this.equip);
    
this.equiped false;
  }
  if (
key == "s") {
    
this.equiped false;
    
replaceani("walk""walk");
    
replaceani("idle""idle");
    return;
  }
  if (
key == "d") {
    if (
this.equiped true) {
      
setani(this.firenull);
      
freezeplayer(this.freeze);
      
this.angle getangle(vecx(playerdir), vecy(playerdir));
      
setshootparams(player.account);
      
shoot(player..3player..3player.zthis.angle random(this.bulletangleabs(this.bulletangle)), 00"pb_bullet1""pb_bullet1.png");
      if (
this.equiped false) {
        
onEquip();
      }
    }
  }
}

function 
onActionProjectile() {
  
player.hearts = -.5;


I am curious to know why you're using

PHP Code:

function GraalControl.onKeyUp(codekeyscan) {
  
//Key up..


Instead of
PHP Code:

function GraalControl.onKeyDown(codekeyscan) {
  
//Key Down..


Although I'm not sure what your issue is without testing it later.

defaultaccount 06-05-2013 07:25 PM

what id really like to do with the gunscript is make it so that I can change the ganis easy for all the different weapon tiers, I have a weapon with 20 different images. I'd like to make it so the gunscript can read the image if I put all the images in the same spot for the different ganis. I'm wondering if their is a way to do this easily. What I want to do is make it easy for me instead of making 20 different ganis for all the different guns

id really appreciate any help on how to approach making the animations on all the weapons, the script you quoted isn't working yet, the variables arnt working or setting animations right

edit: I think I found out what was wrong with the script I needed to group all the this. together, or something else because I redid the script and now its working


edit: I got the script working perfectly so I took it out the post, but id really like advice on how to gani all the weapons, I need something to make the editing easier for all the different weapon levels. I have weapons that level so I need something that can change the ganis quickly within the script


All times are GMT +2. The time now is 08:23 PM.

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