Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-09-2006, 07:49 PM
Shaun Shaun is offline
Registered User
Shaun's Avatar
Join Date: Jul 2003
Location: Canada
Posts: 1,070
Shaun will become famous soon enough
Question Trigger not receiving

Does anybody have any idea as to why this trigger is not receiving? This is a class npc and there is another class npc that uses the same format to send/receive triggers and it does work, yet I find this one does not.

Any help would be greatly appreciated and for convenience, I have instead of just typing it out made it a colour-coded image:

Quote:
Originally Posted by Chair Script
// Chair 1 made by Shaun

function onCreated() {
this.image = "dolphonia_chair.png";
setshape(1,2,2);
drawunderplayer();
canbepushed();
canbepulled();
}
function onActionactserverside(chairfunc) {
serverr.test = "the trigger has been received!";
if (chairfunc == 1) {
setshape2(2,2,{3,3,3,3});
}
else if (chairfunc == 2) {
setshape2(2,2,{21,21,21,21});
}
else if (chairfunc == 3) {
destroy();
}
}

//#CLIENTSIDE

function onPlayerChats() {
if (player.chat == "destroy") {
chairfunc = 3;
triggeraction(x+(1/16),y+(1/16),"actserverside",chairfunc);
}
if (player.chat == "move") {
chairfunc = 2;
triggeraction(x+(1/16),y+(1/16),"actserverside",chairfunc);
}
if (player.chat == "sit") {
chairfunc = 1;
triggeraction(x+(1/16),y+(1/16),"actserverside",chairfunc);
}
}
Thanks.
Attached Thumbnails
Click image for larger version

Name:	shaun_chairscript.gif
Views:	148
Size:	8.2 KB
ID:	36353  
Reply With Quote
  #2  
Old 05-09-2006, 08:20 PM
Shaun Shaun is offline
Registered User
Shaun's Avatar
Join Date: Jul 2003
Location: Canada
Posts: 1,070
Shaun will become famous soon enough
Ok. Suddenly when there was another player with me, the trigger started being received properly and now it works.

I don't understand how or why, but now you have a possible solution if you run into the same problem.
Reply With Quote
  #3  
Old 05-09-2006, 09:50 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
[php] tags are probably the best for posting code with, just for future reference. Glad you sorted it, although that is slightly odd.
__________________
Skyld
Reply With Quote
  #4  
Old 05-09-2006, 10:28 PM
Shaun Shaun is offline
Registered User
Shaun's Avatar
Join Date: Jul 2003
Location: Canada
Posts: 1,070
Shaun will become famous soon enough
I'm not really sure how to use php tags. The image is for looking at, and I copied and pasted the actual text in case somebody wanted to test it out on their server. For formatting large script pieces, I just run stuff through the offline script editor and press format.

Unfortunately, another piece of code isn't working. The setshape2 doesn't work (well, it works under the //#CLIENTSIDE, but I want it to work above that) if you guys have any other insight. The destroy command works, so the variable IS being sent. Just the setshape commands aren't working. Thanks again.
Reply With Quote
  #5  
Old 05-09-2006, 10:31 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
setshape2 is clientside only, I believe
__________________
Deep into the Darkness peering...
Reply With Quote
  #6  
Old 05-09-2006, 10:35 PM
Shaun Shaun is offline
Registered User
Shaun's Avatar
Join Date: Jul 2003
Location: Canada
Posts: 1,070
Shaun will become famous soon enough
So in order to make it so if the chair is set to sitting, everybody would sit in it, I would have to make a serversided boolean for the chair that would be triggered when a player gives a command and would be called whenever a player touches it? Seems like a bit of lag just for a single chair ;/
Reply With Quote
  #7  
Old 05-09-2006, 11:02 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
lol well you could set a index with the chair so if any player touchs it it becomes "sittable"
__________________
Deep into the Darkness peering...
Reply With Quote
  #8  
Old 05-09-2006, 11:10 PM
Shaun Shaun is offline
Registered User
Shaun's Avatar
Join Date: Jul 2003
Location: Canada
Posts: 1,070
Shaun will become famous soon enough
If I wanted that, I would make it sittable on creation. I want to make it kinda like Animal Crossing. The furniture can either be in movement mode or action mode. In action mode, you'd be able to sit in it. For a bed, you'd lie down in it. Etc.

Right now, the chair is a class npc that's spit out by another class npc (a lumber to chair machine). Businesses are going to buy these machines that produce various things (in exchange for raw materials of course) and produce the goods to sell to players. Smart players will be able to organize and operate the businesses while not-as-intuitive players will just be labourers working for the business, harvesting resources (lumber, minerals, etc). Couple this with a finite set of money, and this will be Graal's first economy, as far as I know.
Reply With Quote
  #9  
Old 05-09-2006, 11:26 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Sounds cool, the server I work for has a idea similiar. you could use variables

if (this.foo == 1) {
blah blah blah;
}
if (this.foo == 2) {
blah blah blah;
}
__________________
Deep into the Darkness peering...
Reply With Quote
  #10  
Old 05-09-2006, 11:29 PM
Shaun Shaun is offline
Registered User
Shaun's Avatar
Join Date: Jul 2003
Location: Canada
Posts: 1,070
Shaun will become famous soon enough
I thought I already was using variables.
Reply With Quote
  #11  
Old 05-09-2006, 11:32 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
*more variables, i should of said XP
__________________
Deep into the Darkness peering...
Reply With Quote
  #12  
Old 05-10-2006, 01:38 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
You could always make two classes for 'action mode' and 'movement mode' and do something like this to switch between the two:

PHP Code:
function SwitchModes(newmode) {
  
temp.newmode newmode;

  
temp.modes = { "move""action" };

  
putnpc2(xy"join chair_" temp.modes[temp.newmode] @ ";");

  
with(npcs[npcs.size()-1]) {
    for(
temp.vnamethiso.getvarnames()) {
      
this.(@temp.vname) = thiso.(@temp.vname);
    }

     
this.currentmode temp.newmode;
  }

  
destroy();

Or something like that X_x;
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 05:01 PM.


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