FFC that detects if you have a particular item
#16
Posted 07 February 2013 - 08:09 PM
#17
Posted 07 February 2013 - 11:33 PM
#18
Posted 07 February 2013 - 11:52 PM
In this case, you can just go ahead and take it.
#19
Posted 08 February 2013 - 12:11 AM
Any script I write for request can be considered free for the taking unless it's very specific to the design of the requester's project, in which case you'd want to ask them.
In this case, you can just go ahead and take it.
Ok, that makes sense
Thanks a lot, this is pretty cool. I'll post if I need any help setting it up, but I think I got it.
#20
Posted 08 February 2013 - 10:20 AM
Different errors are caught at different stages in the compiling process. Catching an error makes the compiler stop after the current stage finishes.
Thanks, it compiles now. I had actually removed the faulty bit myself in the first script, but had forgotten about it.
Edited by Jamian, 08 February 2013 - 10:22 AM.
#21
Posted 15 February 2013 - 02:20 AM
The context is, I want to have a "gate" that checks if you have three items before entering to get the super awesome plot sword.
This would be greatly appreciated.
#22
Posted 15 February 2013 - 02:28 AM
void run(int triggerItem, int triggerItem2, int triggerItem3 ){
while(!Screen->State[ST_SECRET]){
if ( Link->Item[triggerItem] && Link->Item[triggerItem2] && Link->Item[triggerItem3] && DistanceLink(this->X+8, this->Y+8) <= 8 ){
Screen->TriggerSecrets();
Screen->State[ST_SECRET] = true;
Game->PlaySound(SFX_SECRET);
}
Waitframe();
}
}
}
//Returns distance to Link's center
int DistanceLink ( int x, int y ){
return Distance ( Link->X+8, Link->Y+8, x, y );
}
D0, D1, and D2 are the IDs for the three items you want the script to check for. And credit goes to MoscowModder for writing it, since the change I made is pretty much insignificant.
#23
Posted 15 February 2013 - 03:29 AM
Easy enough, just a quick little change to the original script...
void run(int triggerItem, int triggerItem2, int triggerItem3 ){
while(!Screen->State[ST_SECRET]){
if ( Link->Item[triggerItem] && Link->Item[triggerItem2] && Link->Item[triggerItem3] && DistanceLink(this->X+8, this->Y+8) <= 8 ){
Screen->TriggerSecrets();
Screen->State[ST_SECRET] = true;
Game->PlaySound(SFX_SECRET);
}
Waitframe();
}
}
}
//Returns distance to Link's center
int DistanceLink ( int x, int y ){
return Distance ( Link->X+8, Link->Y+8, x, y );
}
D0, D1, and D2 are the IDs for the three items you want the script to check for. And credit goes to MoscowModder for writing it, since the change I made is pretty much insignificant.
Thanks a lot I will credit both of you. I have a pretty comprehensive list of all scripts I've used so far. This is awesome.
EDIT: Oops, I ran into an error while compiling. It says: "scripts\stepwithitem.z, Error S10: Function Distance Is Undeclared."
Edited by Anthus, 15 February 2013 - 02:34 PM.
#24
Posted 16 February 2013 - 01:34 PM
EDIT: Wait a sec, I saved it wrong >.> Okay, I got it saved as a .z file now, my bad.
But, it still won't compile. My thought was, since there is another very similar script, it might not work right. (Since the three one worked).
Edited by Anthus, 16 February 2013 - 01:42 PM.
#25
Posted 16 February 2013 - 02:11 PM
void run(int triggerItem, int triggerItem2, int triggerItem3 ){
while(!Screen->State[ST_SECRET]){
if ( Link->Item[triggerItem] && Link->Item[triggerItem2] && Link->Item[triggerItem3] && SWI_DistanceLink(this->X+8, this->Y+8) <= 8 ){
Screen->TriggerSecrets();
Screen->State[ST_SECRET] = true;
Game->PlaySound(SFX_SECRET);
}
Waitframe();
}
}
//Returns distance to Link's center
int SWI_DistanceLink ( int x, int y ){
return Distance ( Link->X+8, Link->Y+8, x, y );
}
}
In this case, the function name had to be changed , or it would fail for the same reason, even though it's no longer global. The renaming is unnecessary if you also adjust whatever other script defines that function.
(The function could also just have been deleted, since it already exists, but then it would depend on that other script.)
#26
Posted 19 February 2013 - 05:32 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users