View Single Post
  #1  
Old 09-08-2002, 10:40 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
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!
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote