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 07-12-2011, 08:35 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
open and closable level

hey, i know most of you got annoyed because i was asking for scripts that were wayyy above my scripting level, so iv decided to stick to easier things for now, basicly what iv tried to make is a door that if u write /open and your account is allowed to it will alloe you to enter the level when you touch it but if the account writes /close it closes it and you cant enter the level..
here is what i have so far..
the account and /open and /close work
but i cant get the if playertouchsme bit to work..
as for the player.chat once i get it working il change that to setlevel2("level.nw",30,30);

PHP Code:
function onPlayerChats(){
  if (
player.account == "Graal780374"){
    if (
player.chat == "/open"){
      
this.chat "Secret Room Is Open!";
      if (
playertouchsme){
        
player.chat "open";
      }
    }
    if (
player.chat == "/close"){
      
this.chat "Secret Room Is Closed!";
    }
    if (
playertouchsme){
      
player.chat "closed";
    }
  }

Any Help Your Willing TO Give Is Much Appreciated
Thanks
-Gunderak
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 07-12-2011, 09:04 AM
PowerProNL PowerProNL is offline
Retired Zone Manager
PowerProNL's Avatar
Join Date: Feb 2008
Location: Holland
Posts: 266
PowerProNL can only hope to improve
Send a message via AIM to PowerProNL
Quote:
if (player.chat == "/open"){
this.chat = "Secret Room Is Open!";
}
if (playertouchsme){
player.chat = "open";
}
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #3  
Old 07-12-2011, 09:25 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
im new to scripting, please dont mock me
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 07-12-2011, 03:10 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
if (playertouchsme) { } is GS1. Don't mix the two up. You have to use:

function onPlayerTouchsMe() { }

You've also made it impossible to occur by placing playertouchsme in your onPlayerChats function/event.

PPNL: You have no idea what you're doing either.
__________________
Quote:
Reply With Quote
  #5  
Old 07-12-2011, 03:33 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by Gunderak View Post
PHP Code:
function onPlayerChats(){
  if (
player.account == "Graal780374"){
    if (
player.chat == "/open"){
      
this.chat "Secret Room Is Open!";
      if (
playertouchsme){
        
player.chat "open";
      }
    }
    if (
player.chat == "/close"){
      
this.chat "Secret Room Is Closed!";
    }
    if (
playertouchsme){
      
player.chat "closed";
    }
  }

Iīd prefer to make it clientside. and if you want the player to say that its open as far as you open it Iīd do something like:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.opencheck false;
}
function 
onPlayerTouchsMe() {
  if (
this.opencheck false) {
    
this.opencheck true;
  }
  else 
this.opencheck false;
  
player.chat this.opencheck;

Thatīs just an example and yes ik there is something like this.opencheck = !this.opencheck but I just wanted to tell him this way since I donīt know if he understands now how to do the if conditions and with else
__________________
MEEP!
Reply With Quote
  #6  
Old 07-12-2011, 04:01 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
You'll want to do it serverside, not clientside. Otherwise, the door would only be open for you, and you'd have to trigger serverside to warp the player into the level (and serverside would have no way to verify that the door was legitimately opened).
__________________
Reply With Quote
  #7  
Old 07-12-2011, 07:02 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
I think this should be good enough for him since he wanted to start slowly and probably heīd have placed a normal warp behind the door...
__________________
MEEP!
Reply With Quote
  #8  
Old 07-13-2011, 01:19 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Instead of attempting to shove scripts together then posting on the forums asking why they don't work, why not take the time to learn the basics of the language?

Learning simple structure and syntax is the first thing to learning a new language...

You wouldn't try to learn German by shoving random sentences together and hope they produce what you want...

There are a lot of resources available, if you would actually look.
GS2 Wiki
Old Wiki (But has some things the new one doesn't)

Look through the code gallery at other people's scripts to get a good idea of what GS2 is, then try writing some basic code. (Note: I did not say copy/paste the codes, that would be pointless. Read through them and try to understand what they are doing)
__________________

Reply With Quote
  #9  
Old 07-13-2011, 10:23 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
YAY finally got it working..
thanks all who helped =D
one quick question, how would i make the room dark?
like as if u were in a cave...
Thanks
-Gunderak
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #10  
Old 07-13-2011, 04:08 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by Gunderak View Post
one quick question, how would i make the room dark?
I donīt think you really take a look at the guides. (personally) I think you are just out for commands/codes but you donīt really try to take a look at them at your own and if you donīt get it to ask than.
In case you are just out for commands:
GS2 commands

In case you need complete codes:
Code Gallery
__________________
MEEP!
Reply With Quote
  #11  
Old 07-13-2011, 06:21 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Gunderak View Post
how would i make the room dark?
setEffect is the command you're looking for. You'll find more information on it if you search for it on the wiki.
__________________
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 06:42 PM.


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