PDA

View Full Version : Mystery Dungeon Script ;p [help wanted]



Gleeok
09-07-2007, 06:36 AM
Wouldn't it be neat to have randomly generated dungeons, enemies, and screen layouts? Heck yeah! Well i'm currently trying my hand at the second one any ways...who knows, the rest may not be far off. Then youd have a ZC quest that's different every time through! Sweet.

...Anyways on to my script idea;



import "std.zh"

//================================================== ==========================
// Creates 8 random enemies in ADDITION to current screen enemies. ;p hehe..
// D0-D7 Enemies to be spawned
// D0 being the weakest and
// D7 the strongest
//================================================== ==========================
ffc script random_enemy_generator{

void run (int enemy1, int enemy2, int enemy3, int enemy4,
int enemy5, int enemy6, int enemy7, int enemy8){
int x;
int y;
int enemy_ticker = 8;
int RandNum = Rand(8);
npc spawnee;

while(true){

for (int enemy_ticker = 8; enemy_ticker > 0; enemy_ticker -= 1) {

if (RandNum == 7){
npc spawnee = Screen->CreateNPC(enemy8);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 6){
npc spawnee = Screen->CreateNPC(enemy7);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 5){
npc spawnee = Screen->CreateNPC(enemy6);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 4){
npc spawnee = Screen->CreateNPC(enemy5);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 3){
npc spawnee = Screen->CreateNPC(enemy4);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 2){
npc spawnee = Screen->CreateNPC(enemy3);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 1){
npc spawnee = Screen->CreateNPC(enemy2);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);
} if (RandNum == 0){
npc spawnee = Screen->CreateNPC(enemy1);
spawnee->X = is_walkable(x);
spawnee->Y = is_walkable(y);
RandNum = Rand(7);

} enemy_ticker = enemy_ticker - 1;

} if (enemy_ticker < 1){
Quit();
}
}
}
bool is_walkable (int x, int y){

if(x<0 || x>240 || y<0 || y>160){
return false;
}
return Screen->ComboS[y+(x>>4)]==0;
}
}

OK, here is the next revision. It still doesn't work though. :( Something about bool(float) 23 error can't compile...It's out of my hands now, I could use some help.

Comments, suggestions, help?

_L_
09-07-2007, 09:10 AM
Wouldn't it be neat to have randomly generated dungeons, enemies, and screen layouts? Heck yeah! Then youd have a ZC quest that's different every time through! Sweet.It's funny that you mention that...

Russ
09-07-2007, 02:33 PM
Randomly generated dungeons, huh? So you made a script for random enemies, and bigjoe made a script for random screens. Now all we need is multiplayer and we basiclly have Zelda Four Swords.:D It's a good idea (then random enemy, not the multiplayer). The only thing is you should be able to say the enemies have to be within this catagory, so they are not completly random.

Gleeok
09-07-2007, 09:22 PM
It's funny that you mention that...

You know, usually when you say "It's funny that you mention that", it's followed by a reference that would explain some connection to a related topic....



The only thing is you should be able to say the enemies have to be within this catagory, so they are not completly random.

Well, what I was trying to do is have the script choose random enemies from a pool of 8.(D0-D7)
Although note that it's currently not in working condition yet.

ShadowMancer
09-07-2007, 11:45 PM
Need to be able to spawn randomly on walkable tiles.

This simple function will do the job (I dunno who wrote it but it works good)


bool is_walkable(int x, int y)
{
if(x<0 || x>240 || y<0 || y>160)
{
return false;
}
return Screen->ComboS[y+(x>>4)]==0;
}

Call the function like so:
if (is_walkable(ene->X,ene->Y)) {//its okay to spawn here;}



if (enemy_ticker >=1){
might I suggest

for (int enemy_ticker = 8; enemy_ticker > 0;enemy_ticker -= 1) {
They way you are doing it is not wrong, i just find it neater, and easier to keep track of a for loop.

enemy_ticker = enemy_ticker -= 1
You'll want to change to:

enemy_ticker -= 1
you can also do:

enemy_ticker = enemy_ticker -1 (not -=)
They both do the same thing.

Besides those minor things your script looks good to me

oh and btw, _L_ do you enjoy driveing ppl nutz with your cryptic remarks? :p

Gleeok
09-07-2007, 11:52 PM
Sweet, i'll use that and try to get a revision that works.
} else { :mad:

I got another update to add also. :D

import "std.zh"




//------------------------------------------------------
// Creates a closed shutter in a random direction as
// long as there is a wall.-
// Once the enemies have been killed the shutter will open.
// This will not overwrite essential doors added for specific
// dungeon map layouts :)
// Not used yet/ -random locked doors, boss doors, open doors-
//------------------------------------------------------

ffc script random_door_generator{ //ver1.0

void run(){

int RandNum = Rand(4);

if (RandNum == 0 && Screen->Door[DIR_DOWN] == D_WALL){
Screen->Door[DIR_DOWN] = D_SHUTTER;
} if (RandNum == 1 && Screen->Door[DIR_UP] == D_WALL){
Screen->Door[DIR_UP] = D_SHUTTER;
} if (RandNum == 2 && Screen->Door[DIR_LEFT] == D_WALL){
Screen->Door[DIR_LEFT] = D_SHUTTER;
} if (RandNum == 3 && Screen->Door[DIR_RIGHT] == D_WALL){
Screen->Door[DIR_RIGHT] = D_SHUTTER;
}
}
}

One small problem though....IT WONT CARRY-OVER!! Aaargh...

I guess the reason it's not carrying over is because it runs once then stops, i'm not really sure how to stick in inside a loop that is always running without it messing up the original simple design. ..(Other than that, it works super good though :) )

ShadowMancer
09-08-2007, 12:12 AM
Carryovers are glitchy, well mabye just touchy there are rules to how they work (I think C-Dawg is the 'daddy' of figureing those out) :D
Stuff like your door script, are the kind of things that I personally would use a Global script for instead of an FFC script (but that is just me) You could also just put the FFC on every screen you want the script on (we have paste special-->FFC y'know) ;)
But if you are intent on the carryover thing look around the ZScript forum the laws of carryovers are in there somewhere

Gleeok
09-08-2007, 12:34 AM
OK, i'm working now on various changes to those, but the ffc paste special isn't pasting the script along with everything else, very annoying. Is it supposed too? Is there a bug in 579? I also couldn't find anything on carryover....hmm.


Stuff like your door script, are the kind of things that I personally would use a Global script for instead of an FFC script

Yeah but I was only intending it to be used for bonus/mini dungeons. ;) Not for the whole game....although after I finish this quest I do intend to make a completely (half anyway) random dungeon spanning at least 15 maps/Dmaps.
I've put my zc wizardry4 project on hold untill I can get all the item, and mystery dungeon scripts together.




EDIT: I updated and made some changes to the initial script in post 1 but it not yet in working order...if you see what's wrong with it don't be shy.


It's like C- said, "it's always easier to understand a script you wrote rather than a script someone else wrote."...

bigjoe
09-08-2007, 06:59 PM
and bigjoe made a script for random screens. .

My script hardly deserves recognition, as it primitive and lacks certain functions I'd like it to have. This is primarily because I don't know how to do certain things, like read from the FFC arguments and whatnot. I'll post the latest version of it anyway though.


ffc script randwarp_level1
{
void run ()
{
if(Game->Counter[CR_SBOMBS] == 32){
Link->PitWarp(1,32);
}
else{
Game->Counter[CR_SBOMBS]++;
Link->PitWarp(1,Rand(31));
}
}
}

What this does is warps you to a random screen from 0 to 1E if you have less than 32 super bombs.(In the quest Im working on, I use the super bomb counter as a screen counter.)

It is very important to note that the PitWarp function ignores dmap parameters, so if you use this script how it is, you will have to draw OFF of the dmap.

If you have amassed 32 "screens", it warps you to the second boss room. From there, you are warped to the next "floor",using a screen that has a checker script:



ffc script check_level1
{
void run ()
{
if (Game->Counter[CR_SBOMBS] <= 15){
Link->PitWarp(1,0);
}
else{
Link->PitWarp(2,0);
}
}
}


IF anyone would like to improve upon these horrendously primitive scripts, then, by all means. :D By the way, Gleeok, I've already started on a random dungeon quest.

Here are some shots.

http://bigjoesquests.googlepages.com/01.PNG
http://bigjoesquests.googlepages.com/02.PNG
http://bigjoesquests.googlepages.com/03.PNG
http://bigjoesquests.googlepages.com/04.PNG
http://bigjoesquests.googlepages.com/05.PNG

This is also a plug for 4matsy(a.k.a. Hypercrash) Those are his tiles. ;)

ShadowMancer
09-08-2007, 11:17 PM
This is primarily because I don't know how to do certain things, like read from the FFC arguments and whatnot
Useing the FFC args is simple, just define vars in run, like so:

void run (int arg1, int arg2, int arg3)

then you can use them in the FFC script just like any other var.

If you ever have any script questions please feel free to ask in this forum (I know I asked some really newbish questions when I was learning ZScript, but DD and C-Dawg were very helpful) :)

There really does need to be more good tuts on ZScript

bigjoe
09-09-2007, 12:38 AM
Oh, well in that case.


import "std.zh"





//================================================== ==========================
// Screen Counting System
// D0 = Dmap
// D1 = Number of Screens You've Drawn (Hexadecimal)
// D2 = Number of Screens Before Manditory Boss Encounter.
// This script assumes you are using the S_Bomb counter to count screens. Currently, there is no other way to display a variable on the subscreen.
//================================================== ==========================

ffc script random_warp
{
void run (int arg1,int arg2,int arg3)
{
if(Game->Counter[CR_SBOMBS] == arg3){
Game->Counter[CR_SBOMBS]++;
Link->PitWarp(arg1,arg2);
}
else{
Game->Counter[CR_SBOMBS]++;
Link->PitWarp(arg1,Rand(arg2-1));
}
}
}



Should work =)

EDIT: But it doesn't. Hmm, what could I be doing wrong? The regular form works, but uh... hmmm

EDIT2: Nevermind, does work. I just keep forgetting that in Hex you have to subtract one because Zero is included... or something

Russ
09-09-2007, 01:19 AM
There really does need to be more good tuts on ZScript


The we should have sscripting classes! Get it? Scrpting? Classes. Ok, there goes another bad pun. But seriously, we should just have a thread were everyone just adds a little info at a time and soon we have a scripting tutorial. We could call it Zcripting for dummies. Anyone agree with the idea?

Gleeok
09-09-2007, 07:34 AM
That's awesome bigjoe. I'm stil revising the random enemy script, may take some time but be sure to check it out when it's done.

Also just a thought about random_warp; you should be able to warp link within a 8x8 Dmap. Might take some more lines of code though. I'm not sure how many. I don't know...

The random_door script works good however, and i'm currently designing a level based on that. Check that out. Also working more on that, but first I need to know the following.


How to use these:

! //!explain
l l // L's right....explain also
bool(poop) //haha...seriously though
++ //that's add 1 right. what about -1... // +-??
true; //is this like.... if (Link->Gay = true){
npc Zelda->realboobies = false :p }
} else { Link->O_Ozelda = ++; hahhahha, scripting boner jokes!!!!!

Seriously though, I really need help with some of these to make any progress with my scripts.

And Russdawn, I do agree. As soon as I get some fairly decent scripts together that's exactally what I plan on doing when I put a thread in showcase. Explain every single line of every script, ;)



The we should have sscripting classes! Get it? Scrpting? Classes
I don't get it......


Oh, one more; ShodowMancer, how's that weapon thingy coming along? I started messing with Link->Dir, Input, but how do you make charge weapons?..sorry, that's alot of stuff.

Russ
09-09-2007, 12:00 PM
Quote:

Then we should have scripting classes! Get it? Scripting? Classes
I don't get it......


In C and C++, which Zscript was derived from, you had classes with a bunch of items in them. And credits for that pun go to Shadow Tiger, who made the pun without even realizing it at first.

But we should make a thread in Zscript help forum, and just post some simple scripts and break them down line by line. That's how I learned how to script, well, if you can call knowing how to write really simple scipts scripting.

ShadowMancer
09-09-2007, 07:46 PM
But we should make a thread in Zscript help forum, and just post some simple scripts and break them down line by line. That's how I learned how to script, well, if you can call knowing how to write really simple scipts scripting.
I highly agree, I think Pure tried to do something like that, got it stickied in the scripting forum. There are a few basic tuts there.


class Scripting
{
public:
void writetut (string tutorial)
}

now there is a scripting class :p (btw I think classes are only in C++ not C its an OOP thing) [you down with OOP? yeah you know me] okay now I'm just getting silly

But seiously, I would like to see a stickied tutorial thread I would contribute when ever I can.

UPDATE: (darn I got so silly I missed a real question :D )


! //!explain
l l // L's right....explain also
bool(poop) //haha...seriously though
++ //that's add 1 right. what about -1... // +-??
true; //is this like.... if (Link->Gay = true){
npc Zelda->realboobies = false }
} else { Link->O_Ozelda = ++; hahhahha, scripting boner jokes!!!!!

! - this means NOT, as in
if (!Link->Gay) { Zelda = Happy; }
it reverses the meaning of any statement/eqasion
!= (Not equal)
|| means OR, example
if (Gleeok->State == Crazy || Gleeok->State == Confused) {ShadowMancer->WillHelp = true;}
bool, a varible type, only 2 possible values (true || false)
bool meSoCrazy = true;
++ adds one yes, you can also use +=1 and -=1 to add or subtract one, heck use any number you want
ShadowMancer->Coolness += 5; :cool:
yes you are useing true and false correctly.
side note on bool, you can pass an integer to bool, 0 will = false any other number will be true. (I think ZScript still allows this)

Hope that helps


Oh, one more; ShodowMancer, how's that weapon thingy coming along? I started messing with Link->Dir, Input, but how do you make charge weapons?..sorry, that's alot of stuff.

Ah, well just got home from work got the next 2 days off, going to be scripting like a fiend. As of right now I got *Zilch* written at least not physically written, but its all here in my head just waiting to get out

well the simple secret of charge type weapons is to check if the player is holding the button and increment a varible, once the player releases the button the power of the weapon will be determined by the varible. here is a quick exampl of a '3 stage' charge weapon


int powLev = 0
while(Link->InputB)
{
powLev += 1
Waitframe();
}
if (!Link->InputB && powLev > 0)
{
//script to fire weapon
if (powLev < 10)
{
//do level 1 charge stuff
//damage = 5;
//this->Data = whatever;
}
if (powLev >= 10 && powLev < 20)
{
//do level 2 charge stuff here
}
if (powLev > 20)
{
//do lev 3 charge stuff here
}
}

This is a quick mockup code, don't expect that it is 100&#37; accurate syntax, that should give you basic idea
oh and Never be sorry for asking too many questions and wanting to learn. Learning is the greatest thing we can do in life :)

DarkDragon
09-09-2007, 09:08 PM
BigJoe wanted me to write a script which randomly places 8 enemies on the screen. Here it is:


bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

ffc script test {
void run(int e1, int e2, int e3, int e4, int e5, int e6, int e7, int e8) {
putenemy(e1);
putenemy(e2);
putenemy(e3);
putenemy(e4);
putenemy(e5);
putenemy(e6);
putenemy(e7);
putenemy(e8);
}

void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)

int x = Rand(16);
int y = Rand(11);
while(!is_walkable(x,y))
{
x = Rand(16);
y = Rand(11);
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
}

bigjoe
09-10-2007, 12:27 AM
Thanks, DarkDragon! Here is the latest version. All that really needs to be done is a random enemy limit. Handle up on it, anyone?


bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

ffc script enemonger {

void run(int e1, int e2, int e3, int e4, int e5, int e6, int e7, int e8) {

int chosenid;
int randval = Rand(8);

if(randval == 0) {chosenid=e1;
int randval = Rand(8);
}else if(randval == 1) {chosenid=e2;
int randval = Rand(8);
}else if(randval == 2) {chosenid=e3;
int randval = Rand(8);
}else if(randval == 3) {chosenid=e4;
int randval = Rand(8);
}else if(randval == 4) {chosenid=e5;
int randval = Rand(8);
}else if(randval == 5) {chosenid=e6;
int randval = Rand(8);
}else if(randval == 6) {chosenid=e7;
int randval = Rand(8);
}else if(randval == 7) {chosenid=e8;
int randval = Rand(8);
}




putenemy(chosenid);
putenemy(chosenid);
putenemy(chosenid);
putenemy(chosenid);
putenemy(chosenid);
putenemy(chosenid);
putenemy(chosenid);
putenemy(chosenid);
}

void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)

int x = Rand(16);
int y = Rand(11);
while(!is_walkable(x,y))
{
x = Rand(16);
y = Rand(11);
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
}

Gleeok
09-10-2007, 01:57 AM
Ahhh, I see Bigjoe beat me to it. But here is the Random version!! :D
EDIT: Ah, it's pretty much the same thing....I used en_count as the cap though, feel free to change it to whatever you want.

int en_count = 8;
just change 8 to 100! ....or something else, it's up to you. :D


//================================================== ==
// D0-D7; Enemies that might spawn,
// <in Addition to boss or any other enemies set to screen enemies> ;)
// Thanks to DarkDragon! :=D
//================================================== ==
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}

ffc script random_enemy_maker {
void run(int e1, int e2, int e3, int e4, int e5, int e6, int e7, int e8) {
int RandNum = Rand(8);
int en_count = 8;
while(en_count > 0){

if (RandNum == 0){
putenemy(e1);
} if (RandNum == 1){
putenemy(e2);
} if (RandNum == 2){
putenemy(e3);
} if (RandNum == 3){
putenemy(e4);
} if (RandNum == 4){
putenemy(e5);
} if (RandNum == 5){
putenemy(e6);
} if (RandNum == 6){
putenemy(e7);
} if (RandNum == 7){
putenemy(e8);
}
en_count = en_count - 1;
RandNum = Rand(8);

}

}

void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)

int x = Rand(16);
int y = Rand(11);
while(!is_walkable(x,y))
{
x = Rand(16);
y = Rand(11);
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
//simulate staggered spawning
Waitframe();
}
}

I just tested it too, it's freakin awesome BigJoe. There's no way you can not use this. ;)

And DarkDragon that is freaking amazing. Do you realize what you've just done??? ,You've inadvertantly created freeform bosses!!! Check out a couple pics.

http://www.mediafire.com/imgbnc.php/9606e7738fe4c577630be8c82e02dfe94g.jpg
http://www.mediafire.com/imgbnc.php/60be4d63772a5f6cd2e1dd1362105c564g.jpg


I have almost finished a demo dungeon with random doors(and now random enemies)...Sweet. Also this awesome script deserves to be in showcase, whatdya think?

bigjoe
09-10-2007, 04:36 AM
Use e8 for the enemy counter, and let e1 through e7 do the work, and it works much better XD

Gleeok
09-10-2007, 04:45 AM
Use e8 for the enemy counter, and let e1 through e7 do the work, and it works much better XD


I'm not following. Can you post the script? It was working great for me, completely random.

bigjoe
09-10-2007, 05:27 AM
int en_count = e8;

Then you can tell the SCREEN how many enemies you want. I already accidentally did 80, and it was trippy. You had to kill them in droves just to stay alive. :D

Then shave out the if (RandNum == 7) part and change the Rands to 7

Gleeok
09-10-2007, 06:01 AM
Oh right...I didn't do that because it would require more setup, plus I figured 18 enemies on a screen would be enough..lol!...But knowing me I would of made a variant for that eventually. hehe.

Anyways check this one out. ver2.0
Now with more doors. Again with this one if you F6 doors, they will be unaffected. ;)

Enjoy!



//------------------------------------------------------
// Creates 1-3 closed shutters in a random direction as
// long as there is a wall.-along with a one-way wherever link enters from.
// Once the enemies have been killed the shutter will open.
// This will not overwrite essential doors added for specific
// dungeon map layouts :)
// Not used yet/ -random locked doors, boss doors, open doors-
//------------------------------------------------------

ffc script random_door_generator{ //ver2.0

void run(){

int RandNum = Rand(4);

if (Link->Dir == 0 && Screen->Door[DIR_DOWN] == D_WALL){
Screen->Door[DIR_DOWN] = D_1WAYSHUTTER;
} if (Link->Dir == 1 && Screen->Door[DIR_UP] == D_WALL){
Screen->Door[DIR_UP] = D_1WAYSHUTTER;
} if (Link->Dir == 2 && Screen->Door[DIR_RIGHT] == D_WALL){
Screen->Door[DIR_RIGHT] = D_1WAYSHUTTER;
} if (Link->Dir == 3 && Screen->Door[DIR_LEFT] == D_WALL){
Screen->Door[DIR_LEFT] = D_1WAYSHUTTER;

} if (RandNum == 0 && Screen->Door[DIR_DOWN] == D_WALL){
Screen->Door[DIR_DOWN] = D_SHUTTER;
} if (RandNum == 0 && Screen->Door[DIR_UP] == D_WALL){
Screen->Door[DIR_UP] = D_SHUTTER;
} if (RandNum == 1 && Screen->Door[DIR_RIGHT] == D_WALL){
Screen->Door[DIR_RIGHT] = D_SHUTTER;
} if (RandNum == 1 && Screen->Door[DIR_LEFT] == D_WALL){
Screen->Door[DIR_LEFT] = D_SHUTTER;
} if (RandNum == 2 && Screen->Door[DIR_DOWN] == D_WALL){
Screen->Door[DIR_DOWN] = D_SHUTTER;
} if (RandNum == 2 && Screen->Door[DIR_UP] == D_WALL){
Screen->Door[DIR_UP] = D_SHUTTER;
} if (RandNum == 2 && Screen->Door[DIR_RIGHT] == D_WALL){
Screen->Door[DIR_RIGHT] = D_SHUTTER;
} if (RandNum == 3 && Screen->Door[DIR_LEFT] == D_WALL){
Screen->Door[DIR_LEFT] = D_SHUTTER;
} if (RandNum == 3 && Screen->Door[DIR_RIGHT] == D_WALL){
Screen->Door[DIR_RIGHT] = D_SHUTTER;
} if (RandNum == 3 && Screen->Door[DIR_UP] == D_WALL){
Screen->Door[DIR_UP] = D_SHUTTER;

}
}
}


Also---Uh-oh. Bugs.. How do we keep the enemies within the walls on the enemy script? Apparently Doors were not accounted for.

http://www.mediafire.com/imgbnc.php/057627e4d6a4a13a3affb1708f2e3aa84g.jpg

Maybe some kind of x32, y32, perimeter?? Idea's?

bigjoe
09-10-2007, 06:09 AM
Just solidify the "beyond" combos on the Door Combo Sets. Like the combos that are BEHIND The shutter. thats how I fixed it ;)

Gleeok
09-10-2007, 06:28 AM
Right. I suppose you couldn't use this on a screen with open or unlocked doors then. Well that's not so bad.

I also have another question for someone to answer:

Or statement;
if (milk += funny == true){
nose x16milk l l nose y16milk l l Link->Die;


Which one of these runs? x16, y16, or dies? or am I using this wrong?.....
Howabout;
if (Link->MP >=16 l l Link->HP >= 16){
Link happy;

This makes more sense, but would the first one be random?....

bigjoe
09-10-2007, 07:06 AM
Well, I should have put it this way:

Copy the Beyond tiles to another location in the combo sheet and solidify them. Switch the ones for the SHUTTER DOORS only to those.

ShadowMancer
09-10-2007, 10:43 AM
Or statement;
if (milk += funny == true){
nose x16milk l l nose y16milk l l Link->Die;

oh yeah, sorry the || statement does not work that way. it is for comparisons only (if statements, while loops, etc)




void putenemy(int eid)
{
//to do this properly we really need priority queues in ZScript ;)
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}


Replace that code, it should keep the enemies from spawning inside the outter walls.

Gleeok
09-10-2007, 02:23 PM
Sweet, i'll do that. :) thanks.

Also got another one.


//================================================== ============================
// FFC SCRIPT DMAP PITWARP
// D0 -probability of warp minus 50%. To chance warp every 16 screens, set to 8.
// D1 Dmap destination
// D2 No need to set this
//================================================== ============================
ffc script Dmap_Pit{

void run (int shit, int dung, int me){

int damn = Rand(shit);
me = Rand(116);
if (damn == 0){
if ((me == 00 || me == 01 || me == 02 || me == 03 ||
me == 04 || me == 05 || me == 06 || me == 07) ||
(me == 10 || me == 11 || me == 12 || me == 13 ||
me == 14 || me == 15 || me == 16 || me == 17) ||
(me == 20 || me == 21 || me == 22 || me == 23 ||
me == 24 || me == 25 || me == 26 || me == 27) ||
(me == 30 || me == 31 || me == 32 || me == 33 ||
me == 34 || me == 35 || me == 36 || me == 37) ||
(me == 40 || me == 41 || me == 42 || me == 43 ||
me == 44 || me == 45 || me == 46 || me == 47) ||
(me == 50 || me == 51 || me == 52 || me == 53 ||
me == 54 || me == 55 || me == 56 || me == 57) ||
(me == 60 || me == 61 || me == 62 || me == 63 ||
me == 64 || me == 65 || me == 66 || me == 67) ||
(me == 70 || me == 71 || me == 72 || me == 73 ||
me == 74 || me == 75 || me == 76 || me == 77)
){ Link->PitWarp(dung,me);
}
}
}
}

As you can see I tried to get around the "can warp outside the 8x8 Dmap grid" to no avail. Someone please tell me all those aren't being transformed into hexidecimals.....for the love of god..why..:mad:(angry face.)

One question; Why the hell is Zscript warp so difficult to work with?

ShadowMancer
09-10-2007, 04:11 PM
ffc script Dmap_Pit{

void run (int shit, int dung, int me){

int damn = Rand(shit);
me = Rand(0x74);
if (damn == 0 && me >= 0x00 && me <= 0x4D) {Link->PitWarp(dung,me);}
}
}

Try that, I think it will work
if you are wondering what all the 0x stuff is about that is just telling C, ur i mean ZScript, that it is a hex number.

Nice varible names btw :p



One question; Why the hell is Zscript warp so difficult to work with?
its not if you understand hex, it is probley eaiser on the devs to have the screen numbers use hex

DarkDragon
09-10-2007, 05:54 PM
You're under no obligation to use hex, warping to screen 0x10 is the same as warping to screen 16.

Script warps work the same as ordinary, eg side or tile, warps. You give the dmap and a screen offset from the start of that dmap. You can't leave the 8x8 curtain because the dmap only encompasses 64 screens.

ShadowMancer
09-10-2007, 06:20 PM
okay I get what gleeok's problem is now (duh) yea its a Dmap thing so just place two DMaps next to each other and randomly switch between Dmaps then you have a 16x16 map, with good disign it will be transparent to the palyer.

Gleeok
09-10-2007, 10:38 PM
I don't understand. The way script warps were explained was (dmap,screen). If I do anything besides (10,32) for example it doesn't compile. I am horrible at hex but I thought hex is increments of 15 but there are 16x8 collections of screens on one map. :confused: In the tile or side warp menu if you want to warp to screen 20, you simply type in 20. What do you set it to in script, 1f???


You're under no obligation to use hex, warping to screen 0x10 is the same as warping to screen 16.
I'm completely lost here, unless the x, in 0x10 does something. (again :confused: ) in my script the or statements are 01-77. Hmm, so f ==15, and 10 ==16. So 1f ==31 and 20 == 32. so screen 20 == 14...WTF ever...i'm no programmer. ...I think that's right at least.

Warping outside the dungeon dmap 8x8 grid is not really an option because it does not map the rooms and the link minimarker is way off the screen. Of course I have the dmap offset slider thingy set at o also.


EDIT: Well...let me put it this way;

xxxxxxxxoooooooo
xxxxxxxxoooooooo
xxxxxxxxoooooooo
xxxxxxxxoooooooo
xxxxxxxxoooooooo
xxxxxxxxoooooooo
xxxxxxxxoooooooo
xxxxxxxxoooooooo

x == we wan't to warp there.
o == Bad! very bad!

I guess I am still understanding that o's are 8-f, which apperently is false.


EDIT: I have given up on any sort of warp script. I worked up some others and no longer need it. If anyone needs it just alter one of the scripts posted in this thread.

ShadowMancer
09-11-2007, 10:00 PM
I think I understand what is going on here, first of all do I understand correctly that you want to warp anywhere(randomly) within an 8x8 DMap. if so this code should work for you: (if I understand DMaps correctly, have not experminted with them in a loooong time)



ffc script Dmap_Pit{

void run (int shit, int dung, int me){

int damn = Rand(shit);
me = Rand(64);
if (damn == 0) {Link->PitWarp(dung,me);}
}
}


that modification should be all you need.

simple trick to get hex conversions, open your (i assume you use windows) calc.exe and switch view to scientific, type in the (decimal) number you want to covert and click the radio button 'HEX' instant conversion :)


Decimal Hex
0-9 0-9
10 A
11 B
12 C
13 D
14 E
15 F


http://en.wikipedia.org/wiki/Hexidecimal

Just some stuff to help you understand hex, it is useful to know if you program.

and, the 0x is just a prefix to tell the compiler to use a hex number not a decimal number it does not do anything except that.

Gleeok
09-17-2007, 07:42 AM
OK, some more idea's i'm working with.

1)


//================================================== ========
// FFC SCRIPT *TIMETWISTER*
// This will reset all Link data to zero
//================================================== ========
ffc script timetwister{

void run(){
int i;
for (i = 1; i < 255; i ++) {
if (Link->Item[i] == true){
Link->Item[i] = false;
}
}
Link->HP = 16;
Link->MaxHP = 16;
Link->MP = 0;
Link->MaxMP = 0;
Game->Counter[CR_RUPEES] = 0;
Game->Counter[CR_BOMBS] = 0;
Game->Counter[CR_SBOMBS] = 0;
Game->Counter[CR_ARROWS] = 0;
Game->Counter[CR_KEYS] = 0;
}
}
..Pretty mean of me eh?


And 2)
...It occured to me that no one has been using the npc->weapon! Therefore I am uncertain if i'm going about it right. But it's pretty nifty for a mystery dungeon to have enemies with mystery weapons!!
....anyway,



ffc script giveweapons{
void run(){
int ouchie;
for (ouchy = 1; ouchy <= 10; ouchy ++){
uh_oh[ouchy] = Screen->LoadNPC(ouchy);
uh_oh[ouchy] = npc->Weapon(32 + ouchy);
}
}
}
*NOTE* This is incomplete and will likely crash ZC. (just a warning)

Also, the use of npc->weapons could be used (if it works) for ffc enemies, and ffc bosses. It's got some potential, and another version would be to use D0-D7 as the weapon values.



*EDIT*

Wow, I just had another awesome idea:
You can change a bosses weapon every xxx seconds!


ffc script multiballs!!!{
void run(){
int shift = 33
while(true){
if(Screen->LoadNPC(1) HP >= 1){
//give hime more weapons!!!
shift = 41
Waitframes(300);
}
if(Screen->LoadNPC(1) HP >= 1){
npc->Weapon = shift;
shift = 34;
Waitframes(300);

I just need to recheck the implementation fo npc->Weapon....anyone know it already?

Also I put int shift in for future a script, likely used with a void run( int) or some other stuff.

-Oh, and what key on the keyboard is l l ?? *this is not a joke...l comes out as L's in notepad...