Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-23-2011, 07:40 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Gani Generator (360 degrees)

Here's an example on how to make ganis via script, it's alot easier than you think (if you're interested in learning it)

This script generates the Era iPhone car ganis (Including other passengers)
PHP Code:
function onCreated() {
  
generateCarGani();
}

function 
generateCarGani() {
  
temp.framecount 64;

  echo(
"GANI0001");
  echo(
"SPRITE  100                HEAD  0    0   32   32 head up");
  echo(
"SPRITE  101                HEAD  0   32   32   32 head left");
  echo(
"SPRITE  102                HEAD  0   64   32   32 head down");
  echo(
"SPRITE  103                HEAD  0   96   32   32 head right");

  for (
temp.i=0temp.i<=temp.framecounttemp.i++)
    echo(
format("SPRITE  %3d               ATTR2  0    0   64  106 car"500+temp.i));
  for (
temp.i=0temp.i<=temp.framecounttemp.i++)
    echo(
format("SPRITE  %3d era_spotlight_1.png  0    0   64  128 spot light"600+temp.i));

  for (
temp.i=0temp.i<=temp.framecounttemp.i++) {
    
temp.angle = (pi/2*pi temp.i/temp.framecount) % (2*pi);
    echo(
format("ROTATEEFFECT %3d %f"500+temp.itemp.angle));
    echo(
format("ROTATEEFFECT %3d %f"600+temp.itemp.angle));
    echo(
format("EFFECTMODE %3d 0"600+temp.i));
    echo(
format("COLOREFFECT %3d 1 1 0.8 0.6"600+temp.i));
  }

  echo(
"CONTINUOUS");
  echo(
"SINGLEDIRECTION");
  echo(
"DEFAULTATTR1 era_car0_0.png");
  echo(
"DEFAULTHEAD head19.png");
  echo(
"DEFAULTBODY body.png");

  echo(
"ANI");
  for (
temp.i=0temp.i<=temp.framecounttemp.i++)
    
generateGaniFrame(temp.itemp.framecount);
  echo(
"ANIEND");
}

function 
generateGaniFrame(curframemaxframe) {
//   car  -8 -21, light  -32 -128, light   13 -128, playerhead 9 20
// Head: 100-103
// Car: 500+
// Light: 600+

  
temp.angle 2*pi curframe/maxframe;
  
temp.str "";
  
  
// Car sprite
  
temp.str @= format("%4d %4d %4d"500+curframe, -8, -21);
  
  
// Left light
  
temp.lightsvec = {-1.455.95};
  
temp.1.5 2;
  
temp.2   4;
  
temp.+= cos(temp.angle)*temp.lightsvec[1] + sin(temp.angle)*temp.lightsvec[0];
  
temp.+= cos(temp.angle)*temp.lightsvec[0] - sin(temp.angle)*temp.lightsvec[1];
  
temp.str @= format(", %4d %4d %4d"600+curframeint(temp.x*16), int(temp.y*16));

  
// Right light
  
temp.lightsvec = {1.355.95};
  
temp.1.5 2;
  
temp.2   4;
  
temp.+= cos(temp.angle)*temp.lightsvec[1] + sin(temp.angle)*temp.lightsvec[0];
  
temp.+= cos(temp.angle)*temp.lightsvec[0] - sin(temp.angle)*temp.lightsvec[1];
  
temp.str @= format(", %4d %4d %4d"600+curframeint(temp.x*16), int(temp.y*16));
  
  
// Player head and npc head
  
temp.dir getdir(cos(temp.angle), -sin(temp.angle));
  
temp.playerstr format(", %4d %4d %4d"100+temp.dir88);
  
temp.headx 0;
  
temp.heady = -2;
  
temp.temp.heady*cos(temp.angle) + temp.headx*sin(temp.angle);
  
temp.temp.headx*cos(temp.angle) - temp.heady*sin(temp.angle);
  
temp.npcstr format(", %4d %4d %4d"104+temp.dir8+int(temp.x*16), 8+int(temp.y*16));
  if (
temp.>= 0) {
    
temp.str @= temp.playerstr;
    
temp.str @= temp.npcstr;
  } else {
    
temp.str @= temp.npcstr;
    
temp.str @= temp.playerstr;
  }

  echo(
temp.str);  

__________________
Reply With Quote
  #2  
Old 01-23-2011, 07:57 PM
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
Nice ++
__________________
Graal Mail: [email protected]
McPowerProNL, I'm loving it
Reply With Quote
  #3  
Old 01-23-2011, 08:27 PM
Cosss Cosss is offline
Classic Developer
Cosss's Avatar
Join Date: Sep 2010
Location: New Jersey
Posts: 158
Cosss will become famous soon enough
real fancy stuff there, I'll rep you for sharing this with us
__________________
Reply With Quote
  #4  
Old 01-23-2011, 08:36 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
Looks like an NC Spammer, but reminded me to add strechx, stretchy, and mode effects into my gani class.
__________________
Quote:
Reply With Quote
  #5  
Old 01-23-2011, 08:51 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
Quote:
Originally Posted by fowlplay4 View Post
Looks like an NC Spammer
that's what i thought too.
why not put it into a file or something'
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #6  
Old 01-23-2011, 10:04 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I'm sure you guys can do that if you wanted lol
__________________
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:56 AM.


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