Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   i dont understand why this wont work, help (https://forums.graalonline.com/forums/showthread.php?t=134266794)

Fatel 07-11-2012 09:32 PM

i dont understand why this wont work, help
 
need help /:
PHP Code:

//#CLIENTSIDE
function onWeaponFired(){
if(
clientr.spellevel >= 10){
player.hearts player.fullhearts;
setani("lift",NULL);
}



DustyPorViva 07-11-2012 09:55 PM

You can't edit player.hearts on the clientside, you'll need to trigger the server to do so:

PHP Code:

// Recieve the triggeraction, with cmd being the first parameter passed
function onActionServerside(cmd) {
  if (
cmd == "heal") {
    
player.hearts player.fullhearts;
  }
}
//#CLIENTSIDE
function onWeaponFired() {
  if(
clientr.spellevel >= 10) {
    
// Call a trigger to the server
    // "gui" simply tells it that it needs to trigger a gui, which is actually a weapon
    // name simply references the name of the weapon itself, so it's triggering itself
    // "heal" is simply a parameter you're going to pass
    
triggerserver("gui",name,"heal");
    
setani("lift",NULL);
  }


You also need to work on your formatting some so it's easier for us to read.

Fatel 07-12-2012 12:45 AM

im sure you have figured this out, im new

Fatel 07-12-2012 12:48 AM

what if i wanted to add a light image when the weapon is fired on the player?
this is most likely horribly wrong bt ill give it a shot
PHP Code:

// Recieve the triggeraction, with cmd being the first parameter passed
function onActionServerside(cmd) {
  if (
cmd == "heal") {
    
player.hearts player.fullhearts;
  }
}
//#CLIENTSIDE
function onWeaponFired() {
  if(
clientr.spellevel >= 10) {
    
//i know this is wrong just exampling
    //might be setimg not sure

    
showimg light1.png player.x,player.y;
    
triggerserver("gui",name,"heal");
    
setani("lift",NULL);
  }



Skyld 07-12-2012 11:59 AM

Concerning showimg, take a look at http://gscript.graal.net/showimg for some details on how it works.
Concerning the thread tile, take a look at the scripting subforum rules and guidelines.


All times are GMT +2. The time now is 10:12 AM.

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