3 item script
#1
Posted 02 November 2009 - 06:08 PM
#2
Posted 02 November 2009 - 06:23 PM
As for a script which allows you to use three items - you'd have to have every item in your inventory re-scripted from scratch. I'm afraid this isn't really practical.
And could you please post future script requests in the Script Request sub-forum, rather than just in Scripting Discussion. As you can see, I have moved this one for you.
#3
Posted 02 November 2009 - 06:28 PM
#4
Posted 02 November 2009 - 06:38 PM
This one should suffice:
void run(int m, int sfx, int defdir, int faced, int talkd){
int origd = this->Data;
if(faced == 0) faced = 40;
if(talkd == 0) talkd = 24;
while(true){
int dx = this->X-Link->X; int ax = Abs(dx);
int dy = this->Y-Link->Y; int ay = Abs(dy);
if(defdir != 0){
if(ax < faced && ay < faced){
if(ax <= ay){
if(dy >= 0) this->Data = origd+DIR_UP;
else this->Data = origd+DIR_DOWN;
}else{
if(dx >= 0) this->Data = origd+DIR_LEFT;
else this->Data = origd+DIR_RIGHT;
}
}else this->Data = origd+(defdir-1);
}
if(Link->InputA && ax < talkd && ay < talkd && Link->Z == 0){
if(sfx != 0) Game->PlaySound(sfx);
Link->InputA = false;
Screen->Message(m);
do Waitframe();
while(Link->InputA);
}
Waitframe();
}
}
}
#5
Posted 02 November 2009 - 07:04 PM
though I'm having alot of troubles uploading this bloody thing. and the roll defend global script into it, I imported it after going to Scripts-Compile Zscript...
Then Clicked import, imported the script file with the .z on the end.
but when i try to compile it, no luck.
#6
Posted 02 November 2009 - 07:48 PM
#7
Posted 02 November 2009 - 09:35 PM
And the roll, and defend one says like
Line 98- SYNTAX error bla bla bla, unable to parse or inpute file
something along those lines
anything on it?
#8
Posted 02 November 2009 - 09:37 PM
Edited by Plissken, 02 November 2009 - 09:38 PM.
#9
Posted 02 November 2009 - 10:05 PM
LINE 98: SYNTAX ERROR, UNEXPECTED IF, EXPECTING SEMICOLON, ON TOKEN IF FATAL ERROR P00: CAN'T OPEN OR PARSE INPUT FILE
-- -- PRESS A KEY -- --
And the one for the talking to npc ffc, the only error it said, was dir. up left right and down were undeclared.
thank you.
#10
Posted 02 November 2009 - 10:37 PM
" to the .z file.
#11
Posted 02 November 2009 - 11:18 PM
Nvm, Have figured it out for the talking npc one anywway, though It is compiled and assigned tp FFC # 1, I do not know how to put it into play?
#12
Posted 03 November 2009 - 12:41 AM
import "std.zh"
ffc script RealNPC{
void run(int m, int sfx, int defdir, int faced, int talkd){
int origd = this->Data;
if(faced == 0) faced = 40;
if(talkd == 0) talkd = 24;
while(true){
int dx = this->X-Link->X; int ax = Abs(dx);
int dy = this->Y-Link->Y; int ay = Abs(dy);
if(defdir != 0){
if(ax < faced && ay < faced){
if(ax <= ay){
if(dy >= 0) this->Data = origd+DIR_UP;
else this->Data = origd+DIR_DOWN;
}else{
if(dx >= 0) this->Data = origd+DIR_LEFT;
else this->Data = origd+DIR_RIGHT;
}
}else this->Data = origd+(defdir-1);
}
if(Link->InputA && ax < talkd && ay < talkd && Link->Z == 0){
if(sfx != 0) Game->PlaySound(sfx);
Link->InputA = false;
Screen->Message(m);
do Waitframe();
while(Link->InputA);
}
Waitframe();
}
}
}
You put:
import "std.zh"
on top of your script file only if you're using certain functions that requieres std.zh.
#13
Posted 03 November 2009 - 02:30 PM
#14
Posted 03 November 2009 - 04:05 PM
A few common-place examples are:
- ComboAt
- Floor
- Waitframes
- Distance
- DIR_ constants
- LW_ & EW_ constants
- I_ constants
- NPC_ constants
It's basically a set of functions that we on the dev team decided would be a useful addition to the language without having to be hard-coded into ZScript itself. If you have any suggestions for additions to it that people may find useful, feel free to post them at AGN or make a thread here or something and they'll be considered.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users