Re: Mystery Dungeon Script ;p [help wanted]
Oh, well in that case.
import "std.zh"
Code:
//============================================================================
// 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
Re: Mystery Dungeon Script ;p [help wanted]
Quote:
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?
Re: Mystery Dungeon Script ;p [help wanted]
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, ;)
Quote:
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.
Re: Mystery Dungeon Script ;p [help wanted]
Quote:
Quote:
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.
Re: Mystery Dungeon Script ;p [help wanted]
Quote:
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.
Code:
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 )
Quote:
! //!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
Quote:
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
Code:
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% 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 :)
Re: Mystery Dungeon Script ;p [help wanted]
BigJoe wanted me to write a script which randomly places 8 enemies on the screen. Here it is:
Code:
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();
}
}
Re: Mystery Dungeon Script ;p [help wanted]
Thanks, DarkDragon! Here is the latest version. All that really needs to be done is a random enemy limit. Handle up on it, anyone?
Code:
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();
}
}
Re: Mystery Dungeon Script ;p [help wanted]
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.
just change 8 to 100! ....or something else, it's up to you. :D
Code:
//====================================================
// 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/...2e02dfe94g.jpg
http://www.mediafire.com/imgbnc.php/...62105c564g.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?
Re: Mystery Dungeon Script ;p [help wanted]
Use e8 for the enemy counter, and let e1 through e7 do the work, and it works much better XD
Re: Mystery Dungeon Script ;p [help wanted]
Quote:
Originally Posted by
bigjoe
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.