Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 04-30-2009, 11:56 PM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
These wiki pages should help you a bit with your understanding of clientside/serverside:
http://wiki.graal.net/index.php/Clientside
http://wiki.graal.net/index.php/Serverside
http://www.graal.net/index.php/Creat...Starting_Guide
http://wiki.graal.net/index.php/Crea.../Script/Client (explains how to communicate between serverside and clientside)


What?

Not sure exactly, but Stefan said at several times not to, so that suggests to me that perhaps he checks what the script is in and decides how to parse it or something like that could be added later.

And yeah, GS1 just uglifies a beautiful script. GS2 is also considerably more efficient than GS1.

Haha yes, correct.

It doesn't, the only time the parser reads anything that starts with "//" is when it is //#CLIENTSIDE. The ones I placed after the join were just labels.

You should always use putnpc2 now anyway; just put the code in a class rather than a text file.

Only if you used 'client.' vars. You should always use clientr (or serverside player. vars) for storing sensitive information.

If you want them to be dynamic (randomly placed), you should use a database NPC with something like the following

PHP Code:
function onCreated() {
  
// init vars
  
this.mapSize = {33}; // width, height in levels
  
this.classesToDrop = {"baddy"};
  
  
onTimeOut();
}
function 
onTimeOut() {
  
temp.tries 0;
  
  while (
tries ) {
    
temp.dpos = {random(0this.mapSize[0] * 64), random(0this.mapSize[1] * 64)};
    
    if (! 
onwall2(dpos[0] - 3dpos[1] - 366)) {
      
// should improve the above checks, it's just an example.
      
temp.classToJoin this.classesToDrop[int(random(0this.classesToDrop.size()))];
      
      
temp.drop putnpc2(dpos[0], dpos[1], "");
      
drop.join(classToJoin);
    }
    
tries ++;
  }
  
  
setTimer(360); // could also add a way to check how many baddies there are.

Otherwise, if you want them in static locations, just make a level NPC (with level editor) with this:

PHP Code:
join("baddy"); // or the other class 
Ok, I used clientr. not sure why, but that's what I saw everyone else using so I thought it appropriate to follow suit, what is the difference between clientr. and player. ?

I will have to lookup putnpc2 since I have never used it.

Also, if I wanted to do something like a toggle, say:

PHP Code:
if (keypressed){
   if (
strequals()){
      if (
showimgIsAlreadyShown){
         
hideimg;
      } else {
         
showimg;
      }
   }

How would I detect if said image is shown already?
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
 


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


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