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 01-13-2009, 07:02 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Robbing; help

So I have this script, I know its not the most effecient, but I am still learning. I am having trouble using the triggeractions, obviously, and also getting it to only effect the player who grabbed the safe.

I have this in the class:
PHP Code:
function onActionServerside() {
  
player.guild "Robbing!";
  
playerrupees += 1000;
}
//#CLIENTSIDE
function onCreated()
{
  for (
pl:allplayers) {
    if (
player.guild "test") {
      
player.chat "Alert:" SPC player.account SPC "is robbing the safe at" SPC player.level;
  }
}
  
robbing false;
  
setTimer(0.05);
  new 
GuiProgressCtrl("Rob_Progress") {
    
profile GuiBlueProgressProfile;
    
0;
    
0;
    
width 160;
    
height 20;
    
progress 0;
    
visible false;
  }
  new 
GuiButtonCtrl("Cancel_Button") {
    
profile GuiBlueButtonProfile;
    
170;
    
0;
    
width 50;
    
height 20;
    
text "Abort";
    
visible false;
  }
}
if (
robbing false) {
  function 
onTimeout() {
    
Rob_Progress.visible true;
    
Cancel_Button.visible true;
    
setTimer(0.05);
    
disabledefmovement;
    
robbing true;
    
Rob_Progress.progress += 0.01;
    
timeout=0.05;
    
//player.chat = Rob_Progress.progress;
    
setTimer(0.05);
      if (
Rob_Progress.progress 1) {
        
setTimer(0);
        
enabledefmovement;
        
Rob_Progress.visible false;
        
Cancel_Button.visible false;
        
player.chat "Sucessfully robbed the safe!";
        
//triggeraction(0,0,"serverside",onTimeout);
    
}
  }
}
function 
Cancel_Button.onAction() {
  if (
robbing true) {
    
robbing false;
    
enabledefmovement;
    
setTimer(0);
    
player.chat "Aborted robbery!";
    
sleep(1);
    
Rob_Progress.visible false;
    
Cancel_Button.visible false;
  }


Last edited by pig132; 01-13-2009 at 08:00 AM..
Reply With Quote
  #2  
Old 01-13-2009, 07:33 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
PHP Code:
triggeraction(00this.name"serverside"); 
or

PHP Code:
triggerserver("gui"this.name); 
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 01-13-2009, 08:10 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Doesn't seem to be working. It is in a class, can you use triggeractions in classes? Maybe thats why it effects everyone in the level aswell?
Reply With Quote
  #4  
Old 01-13-2009, 03:10 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
If it's in a class, you need to have a serverside shape set, so it can be triggered, and you cannot use "serverside" or "clientside" as action names.
Example:

PHP Code:
function onCreated()
  
setShape(13232);

function 
onActionExample()
  
this.chat "Oh my god, I was triggered!";

//#CLIENTSIDE
function onCreated()
  
triggerAction(this.xthis.y"Example"nil); 
Reply With Quote
  #5  
Old 01-14-2009, 05:31 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Thanks! Got it
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 10:33 AM.


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