-
I wrote a script!!! but it ain't dun wurk good...
I'm writing a friggin script!!!! Yep, so anyone wan't to help me?
Here's what I got:
Code:
import "std.zh"
item script Enmity
{
void run()
{
if (Link->MaxHP <= 16);
{
Quit();
}
else if (Link->HP += 360);
PlaySound(25);
Link->HP -= 16;
Link->MaxHP -= 16;
}
}
So what i'm trying to do is make a VERY simple item script that:
1) plays sfx
2) Refills your life
3) Removes a heart container
*Note that I am trying to put the sacrifice heart container last to get rid of those damned else if's*;)
---------Got this one---------------------------
-Okay round 2: (I think i'm getting better....)- still need help with this though....
Code:
item script Wand_of_Wonder
{
void run()
{
if(Game->Counter[CR_RUPEES] == 0 // Link has no rupees?...
playsound(2);
playsound(2);
playsound(2);
playsound(2);
playsound(2);
Game->Counter[CR_RUPEES] = 5; // give him some!
waitframes(6);
CreateNPC(105) * NPC_PATRA3 // and create a Patra 3... fuck yeah
{
else if(Game->Counter[CR_PUPEES] >= 1; // But don't get greedy or...
waitframe();
playsound(15);
Game->Counter[CR_LIFE] = 0; // Link dies...oopsie!
}
}
}
Heh, the second one is just for learning purposes...well they're all for learning purposes, but any feedback of what i'm doing wrong would help out ALOT.
EDIT: I'm learning :rolleyes:
----------------Got this one as well. thanks pknklfk....hmm-----------------
Code:
item script Rod_of_Ouchy
{
void run()
{
if (int HP <= 16)
{
Quit()
}
else if (ScrnNPC == 0)
{
Quit()
}
else if (int HP ->16)
{
ScrnNPC == 1 (ScrnNPC HP -= 6)
}
Link max HP -= 16
}
}
}
Keep in mind that these are my first scripts ever. :D
-
Re: I wrote a script!!! but it ain't dun wurk good...
Couple questions >_>
Code:
item script Rod_of_Ouchy
{
void run()
{
if (int HP <= 16)
{
Quit()
}
else if (ScrnNPC == 0)
{
Quit()
}
else if (int HP ->16)
{
ScrnNPC == 1 (ScrnNPC HP -= 6)
}
Link max HP -= 16
}
}
}
where is ScrnNPC declared? You seem to play around with it a lot, but it doesn't actually exist anywhere.
"Link" does, but then the compiler would get confused by "max" and "HP" following it.
Also, == means "equals", = means "set".
The arrow operator (->) is used only to dereference pointers, not to fill in for the greater than operator (>)
Every statement (sentence) needs a semicolon (period) at the end.
Here is a fixed version:
Code:
item script Rod_of_Ouchy
{
void run()
{
if (Link->HP <= 16) { //Link has to have a minimum amount of health
Quit();
} else if (Screen-NumNPCs() == 0) { //And, there has to be an enemy
Quit();
} else { //by this point, we know that link has more than 16 HP and there are enemies on screen
npc enemy = Screen->LoadNPC(1); //Find the first enemy
enemy->HP -= 6; //hurt it (maybe even kill it)
Link->HP -= 16; //subtract one heart, and...
Link->MaxHP -= 16;//... one heart container.
}
} //the Quit() here is implied by the end of the script
}
-
Re: I wrote a script!!! but it ain't dun wurk good...
Quote:
where is ScrnNPC declared? You seem to play around with it a lot, but it doesn't actually exist anywhere.
I don't know :shrugs: You know how long it took me to come up with that? I have basically the std.zh and the documentation thread written by DarkDragon to go by.
Quote:
"Link" does, but then the compiler would get confused by "max" and "HP" following it.
Doh! I knew I fucked that up...
Quote:
Also, == means "equals", = means "set".
You've just saved me hours right there.
Quote:
The arrow operator (->) is used only to dereference pointers, not to fill in for the greater than operator (>)
Again, thank you much!
Alright, i'm gonna rewrite it myself and not just copy it.
Code:
item script Rod_of_Ouchy
{
void run()
if(link->HP <=16); // >= means less than or equal!!! yay!
}
Quit();
}
else if (ScrnNPC == 0); //this line does work...right?
{
Quit()
}
else;
{
npc enemy = Screen->LoadNPC(1); //i'm a little confused...
enemy->HP -= 6; // I didn't think it was that simple
Link->HP -= 16; //only hurt...not maim.
}
}
} // Why three }}}?
Thanks alot. I just learned a bunch of stuff. I think I can give the first one onother go now. :D
EDIT: Damnit, what's wrong with this. it looks good enough...it compiled but it didn't do anything...crap.
Code:
import "std.zh"
item script Enmity
{
void run()
{
if (Link->MaxHP <= 16){
Quit();
} else if (Link->MaxHP > 16) {
Link->HP += 360;
Link->HP -= 16;
Link->MaxHP -= 16;
playsound(25)
}
}
}
-
Re: I wrote a script!!! but it ain't dun wurk good...
In your rewrite, remember that Link must be capitalized. (So "Link->HP", not "link->HP")
I've commented what your code is doing:
Code:
import "std.zh"
item script Enmity
{
void run()
{
if (Link->MaxHP <= 16){ // Checks whether Link's MAXIMUM, not CURRENT
// Hit Points are equal to or less than 16.
Quit(); // So, it will quit if Link doesn't have MORE THAN 16
// heart containers. Fair enough.
} else if (Link->MaxHP > 16) { // You don't need another if statement.
// if Link does not have 16 or less heart
// containers, he's must have more than 16
// right? Just use "else."
Link->HP += 360; // This will add 360 to Link's current health
// irrespective of Link's total hearts. You
// will end up having more health than
// heart containers. Won't display, but it
// will count against enemy hits. In other
// words, maximum HP is not a hard cap
// unless you specifically code it that way.
Link->HP -= 16; // This reduces the 360 you just awarded
// by 16. Link ends up gaining 344 HP.
Link->MaxHP -= 16; // Goodbye, one heart.
playsound(25) // You want: "Game->PlaySound(25);"
}
}
}
-
Re: I wrote a script!!! but it ain't dun wurk good...
Stupid, ...stupid.
Thanks C- , I knew I was off somewhere in there...
I feel like I understand a little more of this stuff every day.
***2CD REVISION*** Haha!
import "std.zh"
Code:
item script Nemesis
{
void run()
{
if (Link->MaxHP <= 16){
Game->PlaySound(19);
Game->PlaySound(9);
Quit();
} else {
Link->HP = Link->MaxHP;
Link->HP -= 16;
Link->MaxHP -= 16;
Game->PlaySound(15);
Game->PlaySound(23);
Game->PlaySound(14);
}
}
}
-
Re: I wrote a script!!! but it ain't dun wurk good...
Heh, pretty nice. So this script would recharge Link's health to full, then subtract an equal one hearts worth of health and maximum health. How dire. :p
Why not also put Game->Playsound(xx) right before the "Quit();" where it'd play an error message instead of just quitting? It's good to have some sort of output rather than nothing happening. At least you know the script is working that way.
And what the hell. When wouldn't we need the line: import "std.zh" ?
-
Re: I wrote a script!!! but it ain't dun wurk good...
Holy Shit! I Just wrote a MFing Script!!!!!!!!!!!!!!!!!!!!! :D:D:D:D:D:D:D:D:D:D
And It works!! It friggin works!!!!!! That's awesome...
Two day's age I was calling ffc "FCC" and now I finished a script and pigs didn't fly out of my ass. who knew.
Pshh, it was nothing. :cool:
Quote:
Heh, pretty nice. So this script would recharge Link's health to full, then subtract an equal one hearts worth of health and maximum health. How dire.
Why not also put Game->Playsound(xx) right before the "Quit();" where it'd play an error message instead of just quitting? It's good to have some sort of output rather than nothing happening. At least you know the script is working that way.
And what the hell. When wouldn't we need the line: import "std.zh" ?
Yeah, thanks ;) That's a good idea. Hopefully these will get easier to make without this much hassle. I must of read "std.zh" like 20 times.
Hey Petoe, monkeys can make scripts...see.
Hmm...now I gotta actually name it. That could take another day right there. :googly:
Thank's everybody!
-
Re: I wrote a script!!! but it ain't dun wurk good...
Heh. Nice stuff, man! Now, perhaps we could even "fancy it up" a little? For example, we could count out how many Heart Containers Link has, and how many of those are filled. We could take the difference, divide by, say, four, (16 Hits per container, so each quarter is four. Though technically the Gold Ring introduces two-segments at a time. x x. ) and we could play the healing sound for every quarter (Or eighth?) that it heals Link. Could be done with a for loop. Not sure if those are in ZScript though.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Anything you want to do, you can do in ZScript.
Anything.*
Ponder that for a minute, and realize why it's such a good idea to learn to script.
* = Anything involving arrays or large switch statements will be a mega pain in the ass to do. But it can be done with nested if/else statements.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Yep you can use for loops in ZScript. For loop, While loop, Do Loop (i think never tried it). It seems you guys are picking up scripting pretty quickly.. (now you probley get why everyone always says its not that hard to understand :p )
-
Re: I wrote a script!!! but it ain't dun wurk good...
It's always 10x easier to understand a script you wrote than one someone else wrote, commented or no. You just gotta plunge into it.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Quote:
Yep you can use for loops in ZScript. For loop, While loop, Do Loop (i think never tried it). It seems you guys are picking up scripting pretty quickly.. (now you probley get why everyone always says its not that hard to understand )
What're you crazy. It's very hard for me. Mainly the documentation. I really could use a dumbed down version. Example:
Code:
item script Wand_of_Wonder
{
void run()
{
if(Game->Counter[CR_RUPEES] == 0 // Or LinkRup == 0 ?
Game->PlaySound(2);
waitframe();
Game->PlaySound(2);
waitframe();
Game->PlaySound(2);
waitframe();
Game->PlaySound(2);
waitframe();
Game->PlaySound(2);
Game->Counter[CR_RUPEES] = 5;
waitframes(6);
CreateNPC(105) }
else if(Game->Counter[CR_PUPEES] >= 1 {
waitframe();
playsound(15);
Game->Counter[CR_LIFE] = 0; // Or LinkCurHP = 0 ?
}
}
}
I'm just stabbing in the dark with some of these...I'm not really sure the difference between something like Game->Counter[CR_LIFE] = 0, Or LinkCurHP =0 ? CR_LIFE is Current life...right.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Aaaaargg!! I can't figure out the rupee references or manipulating door functions!! Help!
Code:
item script Door_Buster
{
void run()
{
if (Link->HP <= 96){
Game->PlaySound(9);
Quit();
} else if (Link->MP <= 96) {
Game->PlaySound(9);
Quit();
} else if (itemclass->Counter[CR_RUPEES]<= 66 {
Game->PlaySound(9);
Quit();
} else {
Link->HP -= 96;
Link->MP -= 96;
itemclass->Counter[CR_RUPEES]-= 66;
Screen->Door[D_UNLOCKED];
Game->PlaySound(34);
}
}
}
Maybe for the doors...?
----------------------------------------------
Screen->Door[DIR_UP] = D_UNLOCKED;
Screen->Door[DIR_DOWN] = D_UNLOCKED;
Screen->Door[DIR_LEFT] = D_UNLOCKED;
Screen->Door[DIR_RIGHT] = D_UNLOCKED;
---------------------------------------------
I don't get it :confused:
-
Re: I wrote a script!!! but it ain't dun wurk good...
If you want to manipulate the number of ruppees a player has, you need to manipulate the global counters. Not whether Link has a ruppee in his inventory. (He wont because they arn't equipment items.) Check the documentation for the COUNTER keeping track of ruppees.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Alright, Door Buster Buster Buster. ver.3
item script Door_Buster
Code:
{
void run()
{
if (Link->HP <= 80){
Game->PlaySound(9);
Quit();
} else {
if (Screen->Door[DIR_UP] == D_LOCKED){
Screen->Door[DIR_UP] = D_SHUTTER;
} else {
if (Screen->Door[DIR_DOWN] == D_LOCKED){
Screen->Door[DIR_DOWN] = D_SHUTTER;
} else {
if (Screen->Door[DIR_LEFT] == D_LOCKED){
Screen->Door[DIR_LEFT] = D_SHUTTER;
} else {
if (Screen->Door[DIR_RIGHT] == D_LOCKED){
Screen->Door[DIR_RIGHT] = D_SHUTTER;
}
Link->HP -= 80;
Game->PlaySound(27);
}
}
}
}
}
}
Alright more problems...at least this one works!..sorta. LOL!!
The version before this went like this:
Code:
{
void run()
{
if (Link->HP <= 80){
Game->PlaySound(9);
Quit();
} else {
Link->HP = 16;
Screen->Door[DIR_UP] = D_UNLOCKED;
Screen->Door[DIR_DOWN] = D_UNLOCKED;
Screen->Door[DIR_LEFT] = D_UNLOCKED;
Screen->Door[DIR_RIGHT] = D_UNLOCKED;
Game->PlaySound(27);
}
}
}
It creates an unlocked door on all sides even if there was a wall there before!!! Oopsie.
So anyway their getting more complicated..:scared: , and i'm trying to get it to create shutters on all doors, but only if it's a locked door. plus play sfx and take away hearts as well. Now it just does these things when it wants to. ...I know I fucked that part up, but i'm not sure how to get the && in there, or take the if's and else if's out........hmm....
EDIT: Ahhh fluckin a...........Door Buster Buster Buster BUSTER!
Code:
import "std.zh"
item script Door_Buster
{
void run()
{
if (Link->HP <= 80){
Game->PlaySound(9);
Quit();
} else if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_UP] == D_LOCKED) &&
Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_UP] == D_LOCKED) &&
Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_DOWN] == D_LOCKED) &&
Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_UP] == D_LOCKED) &&
Screen->Door[DIR_DOWN] == D_LOCKED {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_UP] == D_LOCKED) &&
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_UP] == D_LOCKED) &&
Screen->Door[DIR_LEFT] == D_LOCKED {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_DOWN] == D_LOCKED) &&
Screen->Door[DIR_LEFT] == D_LOCKED {
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
if (Screen->Door[DIR_UP] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else if {
Screen->Door[DIR_DOWN] == D_LOCKED {
Screen->Door[DIR_DOWN] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else if {
Screen->Door[DIR_LEFT] == D_LOCKED {
Screen->Door[DIR_LEFT] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else if {
Screen->Door[DIR_RIGHT] == D_LOCKED {
Screen->Door[DIR_RIGHT] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
} else {
Game->PlaySound(9);
Quit();
}
}
}
It won't compile,( unexpected else on line 23) and I can't figure out why???:confused:
...Plus I think there's too many Braces in there....but I haven't even got there in the compiler....And now I am completely lost.
----------------------------------------------------------------------
And now the Door Buster Buster MAX!
Code:
item script Door_Buster
{
void run()
{
if (Link->HP <= 80){
Game->PlaySound(9);
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED && //55
Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_DOWN] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_LEFT] == D_LOCKED) {
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_DOWN] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_DOWN] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_LEFT] == D_LOCKED &&
Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_LEFT] = D_SHUTTER ;
Screen->Door[DIR_RIGHT] = D_SHUTTER ;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_UP] == D_LOCKED) {
Screen->Door[DIR_UP] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_DOWN] == D_LOCKED) {
Screen->Door[DIR_DOWN] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_LEFT] == D_LOCKED) {
Screen->Door[DIR_LEFT] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
if (Screen->Door[DIR_RIGHT] == D_LOCKED) {
Screen->Door[DIR_RIGHT] = D_SHUTTER;
Game->PlaySound(27);
Link->HP -= 80 ;
Quit();
}
else Game->PlaySound(9);
Quit();
}
}
Still, what I wan't to do is make it so non locked doors become locked also....and shutters become Walls!! ..sweet.
-Can anyone show me an easier way to do that so it doesn't take 2 years to write up?
-
Re: I wrote a script!!! but it ain't dun wurk good...
How about this for 'Door buster Max'
Code:
item script Door_Buster
{
void run()
{
//Declare vars
//setup bool vars one to check if each door has been effected yet
//this creates a switch of sorts that only lets you effect each door directon once
bool dr_up = false;
bool dr_dn = false;
bool dr_lt = false;
bool dr_rt = false;
bool any_door = false;
// any_door checks if any door is changed, so you can latter decide if you want to play sound 27 and subtract 80 HP from Link
if (Link->HP <= 80){
Game->PlaySound(9);
Quit();
}
//Unlocked become locked
//locked become shutter
//shutter become wall
if (Screen->Door[DIR_UP] == D_UNLOCKED && dr_up == false) {
Screen->Door[DIR_UP] = D_LOCKED;
dr_up = true;
any_door = true;
}
if (Screen->Door[DIR_UP] == D_LOCKED && dr_up == false) {
Screen->Door[DIR_UP] = D_SHUTTER;
dr_up = true;
any_door = true;
}
if (Screen->Door[DIR_UP] == D_SHUTTER && dr_up == false) {
Screen->Door[DIR_UP] = D_WALL;
dr_up = true;
any_door = true;
}
if (Screen->Door[DIR_DOWN] == D_UNLOCKED && dr_up == false) {
Screen->Door[DIR_DOWN] = D_LOCKED;
dr_dn = true;
any_door = true;
}
if (Screen->Door[DIR_DOWN] == D_LOCKED && dr_up == false) {
Screen->Door[DIR_DOWN] = D_SHUTTER;
dr_dn = true;
any_door = true;
}
if (Screen->Door[DIR_DOWN] == D_SHUTTER && dr_up == false) {
Screen->Door[DIR_DOWN] = D_WALL;
dr_dn = true;
any_door = true;
}
if (Screen->Door[DIR_LEFT] == D_UNLOCKED && dr_up == false) {
Screen->Door[DIR_LEFT] = D_LOCKED;
dr_lt = true;
any_door = true;
}
if (Screen->Door[DIR_LEFT] == D_LOCKED && dr_up == false) {
Screen->Door[DIR_LEFT] = D_SHUTTER;
dr_lt = true;
any_door = true;
}
if (Screen->Door[DIR_LEFT] == D_SHUTTER && dr_up == false) {
Screen->Door[DIR_LEFT] = D_WALL;
dr_lt = true;
any_door = true;
}
if (Screen->Door[DIR_RIGHT] == D_UNLOCKED && dr_up == false) {
Screen->Door[DIR_RIGHT] = D_LOCKED;
dr_rt = true;
any_door = true;
}
if (Screen->Door[DIR_RIGHT] == D_LOCKED && dr_up == false) {
Screen->Door[DIR_RIGHT] = D_SHUTTER;
dr_rt = true;
any_door = true;
}
if (Screen->Door[DIR_RIGHT] == D_SHUTTER && dr_up == false) {
Screen->Door[DIR_RIGHT] = D_WALL;
dr_rt = true;
any_door = true;
}
if (any_door == true) {
Game->PlaySound(27);
Link->HP -= 80 ;
}
else
{
Game->PlaySound(9);
}
Let me know if you don't understand anything
-
Re: I wrote a script!!! but it ain't dun wurk good...
<_< This is where we teach about loops:
Code:
item script Door_Buster_Omega {
void run() {
int i; //we'll use this to loop
bool any; //if we actually do anything, this will become true
//for loops are used to loop over a range of numbers, like 1, 2, 3.
//DIR_UP and the like are just numbers, so we can loop over them too.
//DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT
//for loops have three sections:
// for( start ; condition ; loop) { ... }
// 'start' is what to do first. We start by setting i to DIR_UP
// as long as 'condition' is true, the loop will continue. DIR_RIGHT is the last value, so we want to loop as long as i <= DIR_RIGHT
// each time the block gets to the bottom, it will run 'loop'.
// in this case, we add one to i
for(i = DIR_UP; i <= DIR_RIGHT; i ++) {
//is this door locked? (note that we don't care what specific direction it is)
if(Screen->Door[i] == D_LOCKED) {
//unlock it
Screen->Door[i] = D_SHUTTER;
any = true;
//is the door already unlocked?
} else if(Screen->Door[i] == D_UNLOCKED) {
//lock it back up :D
Screen->Door[i] = D_LOCKED;
any = true;
//or, is it a shutter?
} else if(Screen->Door[i] == D_SHUTTER) {
//Wall 'em in.
Screen->Door[i] = D_WALL;
any = true;
}
// 'loop' will be run here, to move to the next wall
}
//now that we are finished the loop, we can check to see if we did anything.
if(any) {
//do stuff if we succeeded
Game->PlaySound(27); //there are also SFX_* constants
Link->HP -= 80; //5 hearts? ouch.
} else {
//do other stuff if we did nothing.
Game->PlaySound(9);
}
}
}
-
Re: I wrote a script!!! but it ain't dun wurk good...
Wow! You guys are awesome. It's gonna take me awhile to go through those but in the meantime a couple of questions:
-Howabout some script showcase/tutorials? What I mean is kind of like here, where you have a really simple script and variations on it, where each one can be broken down a bit and explained "why it works". While not really a tutorial exactally, it would certainly help out alot of the script-challenged masses that are smashing their faces against the keyboard. (myself included)
:computer: ....... :confuse2: ........... :angry: .......... :mad2: ........... :banghead:
-Also I can't figure out how to check rupees. I got as far as amount and max, and the documentation say's it uses the drain counter....which is too much for me at my scripting level of......noob. So something reletively simple like (-1 rupee , or -3 rupee if rupee > 0) on item use is over my head. -DCounter[]??
..and Item lv. I'm not sure about this either
Quote:
bool Keep
* If true, Link will keep the item, and it will show up as an item or
* equipment in the subscreen. If false, it may modify the current value
* or maximum value of its counter (see Counter below), then disappear.
* The White Sword and Raft, for instance, have Keep true, and keys and
* rupees have Keep false.
int Counter
* The game counter whose current and modified values might be modified
* when the item is picked up (see Amount, Max, and MaxIncrement above.)
* Use the CT_ constants in std.zh to set or compare this value.
Can there be a temporary lv+ ? Like wand lv1: -1 rupee +1 lv of wand.
+20,000 more questions but bool and loop will keep me busy for a while..hah!
EDIT: well I can't figure out anything that I actually need for scripts that I would like for my quest so.....HERE'S SOMETHING COMPLETELY RANDOM!
Code:
item script Cursed_Sword
{
void run()
{
if (Screen-NumNPCs() == 0) { // create a wizzrobe if there are no enemies
screen->CreateNPC(56); // Or screen->CreateNPC(NPC_WIZZROBE1)?????
//i should test it.
} else { //otherwise...
npc enemy = Screen->LoadNPC(1); // locate npc 1 (i'm getting it!)
enemy->HP += 1; // and make him stronger! (don't miss!)
}
}
EDIT 2: i now give you the *MOST BESTEST SCRIPT EVER!!*
Code:
Global script No_Cheating!!!
{
void run() {
int cheat;
if (cheat > 0) {
//[INSERT SCRIPT THAT CRASHES ZC HERE!!!]
// ..Lets see Someone make a cheat Program for ZC 2.5 now...Bastards!
Link->HP -=666;
Link->MaxHP -= 666;
}
}
}
Mwahahahhaahaha!!!!!!
.....seriously though, anyone know a quick way to crash zc on purpose.?:sb::giggle::p
-
Re: I wrote a script!!! but it ain't dun wurk good...
Well, let's clean this up.
Code:
item script Cursed_Sword
{
void run()
{
if (Screen-NumNPCs() == 0) { // Checks to see that there are no enemies.
// Remember, the script only runs once
// at the start of the room. So this
// script will add wizzrobes only to empty
// rooms. If you want to keep checking,
// you need to stick this if inside a while
// loop.
Screen->CreateNPC(56); // Screen must be capitalized. Number is
// proper.
} else { //otherwise...
npc enemy = Screen->LoadNPC(1); // locate npc 1 (i'm getting it!)
enemy->HP += 1; // and make him stronger!
// One more hp isn't much. Wooden
// Sword has power of 2.
}
}
-
Re: I wrote a script!!! but it ain't dun wurk good...
Thaks again C-. It won't compile one of those two lines and now I know why. (Grr...a stupid lowercase s) F**** H***K** Donkey.....
But doesn't the item check for screen NPC == 0 every time it's used???
******************BUT CHECK THIS OUT!**************
Code:
Item script Consume_Rupees_Damnit
{
void run() {
if (Game->Counter[CR_RUPEES] >= 1 &&
Link->HP < Link->MaxHP)
{
Link->HP += 2;
Game->Counter[CR_RUPEES] -= 1;
}
}
}
That's at least three completed scripts i've created thus far that work how I want them to!!!!!! MFn Superfantastic!
-Also I WAS right for using *Game->Counter[CR_RUPEES]* to acess rupee counter. The problem was I kept fucking everything else up. Ha! ..well it's getting there. lol.
What I really DO need help on is temporary increase in damage(or lv[or whatever]) for the second half of my Item scripts to work properly.
} else if { :(
-
Re: I wrote a script!!! but it ain't dun wurk good...
Quote:
-Howabout some script showcase/tutorials? What I mean is kind of like here, where you have a really simple script and variations on it, where each one can be broken down a bit and explained "why it works". While not really a tutorial exactally, it would certainly help out alot of the script-challenged masses that are smashing their faces against the keyboard. (myself included)
:computer: ....... :confuse2: ........... :angry: .......... :mad2: ........... :banghead:
Yes, if every script were broken down and explained like they are here, it would be so much easier for people to learn how to script. To be honest, I think I have learned to script from this thread alone (and a book on beginning c++). Now we just need to get evry one to label their scripts like this.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Still can't figure this one out.
Code:
import "std.zh"
item script level_test
{
void run() {
int ItemClass = 1;
if (Link->HP <= 16 && // 25
Game->Counter[CR_RUPEES] >=1) {
ItemClass = 2;
Game->Counter[CR_RUPEES] -= 1;
}
else
{
ItemClass = 1;
}
}
}
ItemClass = 2; is the only statement that would compile. Everything else say's ->(not a valid pointer) or error (you suck at scripting). My computer is not nice. ;)
The game takes away one rupee though....
Hey C- did you use any thing like what i'm trying to do with that badass swordman type script. I didn't see it in Zodiac though. Did you remove it? Maybe I could just modify that?!
-
Re: I wrote a script!!! but it ain't dun wurk good...
I don't see anything particularly wrong with that, other than the fact that it drains Link's rupees without actually doing anything.
Unless it doesn't like the variable name "ItemClass", since that's also the name of a built in type.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Quote:
Originally Posted by
Gleeok
Hey C- did you use any thing like what i'm trying to do with that badass swordman type script. I didn't see it in Zodiac though. Did you remove it? Maybe I could just modify that?!
Swordsman? You mean the Aries Boss? (The big centaur that slashes at you with his big ol' saber) or the Aries Saber weapon (Three-tile-long sword slash in front of the player as a custom weapon)? Or something else...?
-
Re: I wrote a script!!! but it ain't dun wurk good...
Oh yeah! hehe. I found it. Just forgot what it was called, but once I started to look at the code I figured out which one was which.
if link dir ==1 then weapon y = link y - 16... that's genious! I couldn't figure that out...
All in all that's some heavy stuff to look at right now for me, especially since you have a whole community of of these buggers that are dependant on each other. But you did manage to change weapon damage in there, so if I can figure out what the hell you did, I could add some if statements and take out some other stuff. tweak this and that maybe...
Quick question; For these ffc that are "hard coded", do you need to set them to each screen? That could take awhile. If not, How'd you bypass having to do that altogether.
PS- thanks for writing notes on the stuff btw. ;)
-
Re: I wrote a script!!! but it ain't dun wurk good...
Hard coded FFCs? They're all "hard coded", and there's no way to "un-hard code" them.
If you need certain scripts to run on each screen, then you can check off the box named "Carry over", and that FFC will (surprise) carry over with Link. You then need to create the FFC on each screen that Link could possibly start on (any screen with a Green Square, pretty much).
-
Re: I wrote a script!!! but it ain't dun wurk good...
My commenting isn't great, but it gets the job done.
The way I'm doing custom weapons is this. Each custom weapon gets an item script that sets up FFCs 29, 30, and 31 (which are set aside and only ever used for custom weapons). Then there's an FFC script that runs on every screen, on FFCs 29, 30, and 31. I use carryover FFCs (which means you need to set up the FFCs only on every screen you can continue on). The FFC scripts activate once they are set by the item script. My trigger is the Combo of the FFC. Once FFC 29, 30, or 31 notice that their combo has changed to one of the custom weapon combos, they set their damage, move accordingly, watch for enemy collisions, and apply enemy damage if necessary.
This means that the FFC weapon script gets REALLY complicated with nested if-else statements. In the more recent, yet-unreleased version of Zodiac I've added the Virgo Tribeam (two in front, one out your bottom), and the Cancer Charge (which gets stronger when you hold down the A button). So the general weapon script is getting pretty bloated.
-
Re: I wrote a script!!! but it ain't dun wurk good...
Quote:
This means that the FFC weapon script gets REALLY complicated with nested if-else statements. In the more recent, yet-unreleased version of Zodiac I've added the Virgo Tribeam (two in front, one out your bottom), and the Cancer Charge (which gets stronger when you hold down the A button). So the general weapon script is getting pretty bloated
.
I can't wait for the next version. That sounds awesome..what do you got though, like 5 more to get done.heh.
It seems the type of weapon scripts that you've assembled is kind of like what i'm trying to make, exept that I only need very basic ones. I've got the rapid fire, the perpetual potion script, and the Door buster, Thanks again guys, And only need a few more to replace candle, whistle, N.Love, and some melee weapons. I'll be trying to analyze the mass of weapon scripts you've put together in Zodiac to try and get a better understanding of how to create some of that stuff. Who know's, I might end up with something completely sick that I can show off in S. Showcase. LOL! Well I can assure you that more questions will be forthcoming, it's only a matter of time.
PS-Yes i'm an FFC dumbass that never bothered to mess with all the 2.5 features untill now. Forgive me. ;)
-
Re: I wrote a script!!! but it ain't dun wurk good...
OK, I wroted up this one real good like...but it ain't dun work neither..
Code:
import "std.zh"
//========================================================
// FFC SCRIPT TRIGGER SECRETS (no pun intended) hah;)
// D0 - D2; Items neccesary. Check std.zh for values
//========================================================
ffc script trig_secret2{
void run(int have_item, int have_item2, int have_item3){
while(true) {
if ( (Link->Item[have_item] == true) && (Link->Item[have_item2] == true) &&
(Link->Item[have_item3] == true) && (Screen->NumNPCs() >= 1) ) {
npc enemy_trig = Screen->LoadNPC(1);
enemy_trig->HP = 0;
Waitframe();
}
}
}
}
Here is the original, which somehow doesn't work also....
Code:
ffc script trigger_secrets{
void run(int have_item){
if (Link->Item[have_item] == true && Screen->NumNPCs() >= 1){
npc enemy_trig = Screen->LoadNPC(1);
enemy_trig->HP = 0;
}
}
}
Can anyone tell me why it doesn't actually do anything????
-
Re: I wrote a script!!! but it ain't dun wurk good...
Thats odd it should work fine. I would try debugging the script by putting a very visible response inside the {} of the if statement. (something like creteing an enemy something you are sure not to miss) this will test to see if the if is bieng executed at all. Also you might want to add a while loop and waitframe to the simpler code and try running that again. Do all the simple checks, did I put the right item ID in, does Link actually have the item (I know it sounds dumb but you would not beleve how many times "a repair man is called becuse the computer is not plugged in" :D )
-
Re: I wrote a script!!! but it ain't dun wurk good...
Well, I took you advice and found that this;
Code:
//========================================================
// FFC SCRIPT TRIGGER SECRETS (no pun intended) hah;)
// D0 - D2; Items neccesary. Check std.zh for values
//========================================================
ffc script trig_secret2{
void run(int have_item, int have_item2, int have_item3){
while(true) {
if ( (Link->Item[have_item] == true) && (Link->Item[have_item2] == true) &&
(Link->Item[have_item3] == true) && (Screen->NumNPCs() >= 1) ) {
npc enemy_trig = Screen->LoadNPC(1);
enemy_trig->HP = 0;
Screen->CreateNPC(100);
Waitframe();
}
Waitframe();
}
}
}
Actually created a massive army of windrobes, Meaning the script works....
The problem was, I forgot to load the while loop revision into script slot 2..Hhahahaaha!!
So yeah, it works fine. Thanks. I was getting angered by this guy too..and here it is if anybody wants to use it;
Code:
import "std.zh"
//========================================================
// FFC SCRIPT TRIGGER SECRETS (no pun intended) hah;)
// D0 - D2; Items neccesary. Check std.zh for values
//========================================================
ffc script trig_secret2{
void run(int have_item, int have_item2, int have_item3){
while(true) {
if ( (Link->Item[have_item] == true) && (Link->Item[have_item2] == true) &&
(Link->Item[have_item3] == true) && (Screen->NumNPCs() >= 1) ) {
npc enemy_trig = Screen->LoadNPC(1);
enemy_trig->HP = 0;
}
Waitframe();
}
}
}