Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   help with my script (https://forums.graalonline.com/forums/showthread.php?t=86782)

GULTHEX 07-09-2009 01:12 AM

help with my script
 
PHP Code:

//#CLIENTSIDE
if (weaponfired && onwater(players[0].x,players[0].y)){
setani fishing,fishrod2.png;
freezeplayer 3;
player.rupees =+ int(random(1,5));
fishedweight strtofloat(#s(fishedwieght))+fishweight;
setplayerprop #c,I got a fish ;
sleep 2;


when i fire the weapon near the water it works fine

but when i get the money

it goes to the number of rupees


whats wrong with it?

then goes back to my origional

so example

if ifire it

it changes my rupees to 3

1 second later

it changes back to 0

fowlplay4 07-09-2009 01:22 AM

player.rupees can only truly be edited on the serverside like so.

PHP Code:

function onActionServerSide() {
  if (
params[0] == "caughtfish") {
    
player.rupees += int(random(1,5));
  }
}

//#CLIENTSIDE

function onFishCaught() {
  
triggerserver("gui"name"caughtfish");


And because you're using GS2 you can write the weaponfired like so..

PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
// if stuff
   // do stuff



GULTHEX 07-09-2009 01:25 AM

online i own a server

GULTHEX 07-09-2009 01:35 AM

okay iv got another problem now


function onActionServerSide() {
if (params[0] == "caughtfish") {
player.rupees += int(random(1,5));
}
}

//#CLIENTSIDE
if (weaponfired && onwater(players[0].x,players[0].y)){
setani fishing,fishrod2.png;
freezeplayer 1;
setplayerprop #c,I got a #int pound fish ;
triggerserver("gui", name, "caughtfish");
sleep 2;
}



it says i caught a #int fish

not the int number

how would i do that

fowlplay4 07-09-2009 01:35 AM

Please read these articles then :) The scripting guides, and the GS1 to GS2 should definitely be read.

http://graal.net/index.php/Creation/Dev/GScript

They should be quite helpful.

Edit:

You need to have a variable that holds how big the fish was first.

Then you can do:

PHP Code:


player
.chat "I caught a " int(variable) @ "!"

Substituting variable with what you picked of course.

GULTHEX 07-09-2009 01:38 AM

thank you very much :)


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

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