Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   creating array variables like the built-in ones (https://forums.graalonline.com/forums/showthread.php?t=37605)

Dach 09-08-2002 10:40 PM

creating array variables like the built-in ones
 
What if we could make variables that are set up like players[].x/y/dir/hearts/soon? This would make so many things so much easier. Instead of looping through all of the npcs or players looking for something that must be in common for player-made bombs or such. We could just loop through the correct array variable. It could used with the putnpc command, and work the same as in java. You would put the variables of an npc in the .txt file and you could access them through filename[index].variable. For instance, a new bomb;

newbomb.txt-
NPC Code:

if (created) {
fuse = 5;
power = 2;
radius = 2;
timeout = .1;
}
and_the_bomb_script;



the x and y would be automatic, since they are set when you put the npc.

then lets say that you want to do something with the bomb, no problem! Just access the bomb's variables;
newbombscount
newbombs[index].x
newbombs[index].y
newbombs[index].fuse
newbombs[index].radius
and go to town!

Kaimetsu 09-09-2002 01:35 AM

Basically custom classes, right? I wish we could have them too (coding a 3D engine without them gets complicated >_<).


All times are GMT +2. The time now is 08:25 AM.

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