Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-19-2017, 04:19 AM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
Help me convert an old script

This script made by Loriel used to make "lava balls" bounce around the level. I'm not certain why it doesn't work anymore and my attempts to convert it failed.

NPC Code:
// Lava balls by Loriel
//#CLIENTSIDE
if (playerenters) {
seteffect .1,.05,0,0.03;
this.balls = 50;
setarray this.angle,10;
setarray this.x,10;
setarray this.y,10;
setarray this.radx,10;
setarray this.rady,10;
setarray this.speed,10;
setarray this.dir,10;
for (i=0; i<this.balls; i++)
init(); // First initalizing of all the arrays
while (true) {
for (i=0; i<this.balls; i++) {
if (this.angle[i] in |1.55,4.70|) init(); // Check if under lava (re init),
else loop(); // or above (loop)
}
looplights();
sleep 0.05;
}
}

function init() {
this.x[i] = random(0,60);
this.y[i] = random(0,62);
this.radx[i] = random(0,2);
this.rady[i] = random(2,8);
this.angle[i] = 4.75;
this.speed[i] = random(0.1,0.4);
this.dir[i] = int(random(0,2))*2-1;
}

function loop() {
this.angle[i] += this.speed[i]; // Move ball
this.angle[i] = this.angle[i]%6.3; // Make sure angle stays between 0 and 6.3
showimg i,light2.png,
this.x[i]-this.radx[i]*sin(this.angle[i])*this.dir[i],
this.y[i]-this.rady[i]*cos(this.angle[i]);
changeimgcolors i,0,random(0.1,0.1),.1,0.99;
changeimgzoom i,random(0.15,0.35);
}

function looplights() {
for (i = 0; i < arraylen(this.lpos)/2; i++)
changeimgzoom this.balls+i,random(0.4,0.6);
}



I'm assuming some of the syntax here is just no longer supported but I don't know what it is. Maybe setarray is the problem? A lot of the old gs1 scripts like this on g2k1 perplex me but perhaps they are not hard to fix.
__________________
3DS friendcode: 1118-0226-7975
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:43 PM.


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