Killing the Beamos
Started by
Rex-Leviathan
, May 29 2012 12:42 PM
8 replies to this topic
#1
Posted 29 May 2012 - 12:42 PM
Beamos Script. Amazing, fun, useful, etc. But is it possible to destroy the beamos ingame?
#2
Posted 29 May 2012 - 12:53 PM
It would be helpful if you'd link the topic with the script in question. Anyways, it should be possible and not even that hard. All you need to do is attach the script to an enemy and disable it when the enemy dies.
#3
Posted 29 May 2012 - 01:05 PM
Already did it. Here. Use secrets (like a bomb trigger) to change its combo and kill it.
If you need something more sophisticated, I could do that too.
If you need something more sophisticated, I could do that too.
CODE
//import "std.zh"
const int DRAW_OPAQUE = 128;
const int DRAW_TRANSPARENT = 64;
//^^these constants ought to be added to std.zh^^
const int Beamos_DeadCombo = 12846; //Combo of dead beamos
//Beamos Script
//fires a laser at Link when he comes within a certain range.
//Only the burning tip will hurt link.
//D0: the radius, in pixels, of the beamos's range
//D1: the time, in frames, it takes for the beamos to activate its laser before it fires
//D2: how far, in pixels, the beam tip can travel in a frame
//D3: the color of the beam
//D4: the weapon used for the beam's tip
//D5: the amount of damage the tip does
//D6: sound to be played when it detects Link
//D7: beam sound effect. looped every 4 frames.
ffc script Beamos{
void run(int range, int delay, float beamspeed, int beamcolor, int beamwpn, int damage, int alert_sfx, int beam_sfx) {
float sx; float sy;
int counter;
eweapon wpn;
while(this->Data != Beamos_DeadCombo) {
if(Distance(this->X, this->Y, Link->X, Link->Y) <= range) {
sx = Link->X;
sy = Link->Y;
if(alert_sfx)
Game->PlaySound(alert_sfx);
Waitframes(delay);
wpn = Screen->CreateEWeapon(EW_SCRIPT1);
wpn->X = sx;
wpn->Y = sy;
wpn->UseSprite(beamwpn);
wpn->Damage = damage;
while(Distance(this->X, this->Y, Link->X, Link->Y) <= range && wpn->isValid() && this->Data != Beamos_DeadCombo) {
float angle = ArcTan(Link->X - wpn->X, Link->Y - wpn->Y);
wpn->Dir = AngleToDir(ArcTan(wpn->X - this->X, this->Y - wpn->Y));
sx += beamspeed * RadianCos(angle);
sy += beamspeed * RadianSin(angle);
wpn->X = sx;
wpn->Y = sy;
Screen->Line(3, wpn->X+7, wpn->Y+7, this->X+7, this->Y+7,
beamcolor, 1, 0, 0, 0, 128);
if(beam_sfx && counter == 0)
Game->PlaySound(beam_sfx);
counter = (counter + 1) % 4;
Waitframe();
}
wpn->DeadState = WDS_DEAD;
}
Waitframe();
}
}
}
int AngleToDir(float angle) {
float deg = angle * 180 / PI;
if(deg >= 0) {
if(deg < 90) {
if(deg < 45)
return DIR_RIGHT;
else
return DIR_RIGHTUP;
}
else {
if(deg < 135)
return DIR_UP;
else
return DIR_LEFTUP;
}
}
else {
if(deg >= -90) {
if(deg >= -45)
return DIR_RIGHTDOWN;
else
return DIR_DOWN;
}
else {
if(deg >= -135)
return DIR_LEFTDOWN;
else if(deg < -180)
return DIR_LEFT;
else
return DIR_LEFTUP;
}
}
}
const int DRAW_OPAQUE = 128;
const int DRAW_TRANSPARENT = 64;
//^^these constants ought to be added to std.zh^^
const int Beamos_DeadCombo = 12846; //Combo of dead beamos
//Beamos Script
//fires a laser at Link when he comes within a certain range.
//Only the burning tip will hurt link.
//D0: the radius, in pixels, of the beamos's range
//D1: the time, in frames, it takes for the beamos to activate its laser before it fires
//D2: how far, in pixels, the beam tip can travel in a frame
//D3: the color of the beam
//D4: the weapon used for the beam's tip
//D5: the amount of damage the tip does
//D6: sound to be played when it detects Link
//D7: beam sound effect. looped every 4 frames.
ffc script Beamos{
void run(int range, int delay, float beamspeed, int beamcolor, int beamwpn, int damage, int alert_sfx, int beam_sfx) {
float sx; float sy;
int counter;
eweapon wpn;
while(this->Data != Beamos_DeadCombo) {
if(Distance(this->X, this->Y, Link->X, Link->Y) <= range) {
sx = Link->X;
sy = Link->Y;
if(alert_sfx)
Game->PlaySound(alert_sfx);
Waitframes(delay);
wpn = Screen->CreateEWeapon(EW_SCRIPT1);
wpn->X = sx;
wpn->Y = sy;
wpn->UseSprite(beamwpn);
wpn->Damage = damage;
while(Distance(this->X, this->Y, Link->X, Link->Y) <= range && wpn->isValid() && this->Data != Beamos_DeadCombo) {
float angle = ArcTan(Link->X - wpn->X, Link->Y - wpn->Y);
wpn->Dir = AngleToDir(ArcTan(wpn->X - this->X, this->Y - wpn->Y));
sx += beamspeed * RadianCos(angle);
sy += beamspeed * RadianSin(angle);
wpn->X = sx;
wpn->Y = sy;
Screen->Line(3, wpn->X+7, wpn->Y+7, this->X+7, this->Y+7,
beamcolor, 1, 0, 0, 0, 128);
if(beam_sfx && counter == 0)
Game->PlaySound(beam_sfx);
counter = (counter + 1) % 4;
Waitframe();
}
wpn->DeadState = WDS_DEAD;
}
Waitframe();
}
}
}
int AngleToDir(float angle) {
float deg = angle * 180 / PI;
if(deg >= 0) {
if(deg < 90) {
if(deg < 45)
return DIR_RIGHT;
else
return DIR_RIGHTUP;
}
else {
if(deg < 135)
return DIR_UP;
else
return DIR_LEFTUP;
}
}
else {
if(deg >= -90) {
if(deg >= -45)
return DIR_RIGHTDOWN;
else
return DIR_DOWN;
}
else {
if(deg >= -135)
return DIR_LEFTDOWN;
else if(deg < -180)
return DIR_LEFT;
else
return DIR_LEFTUP;
}
}
}
#4
Posted 29 May 2012 - 02:12 PM
I'd also like to use this script, Moscow, but I have a question about D3: How can you choose a colour, using numbers? For example, if you want red, what numbers to type in D3?
#5
Posted 29 May 2012 - 02:22 PM
Pick a color from your color palette and enter (CSet# * 16 ) + color# in the box. Note that color# starts at 0 not 1.
I didn't write that script BTW - just made it destructible.
I didn't write that script BTW - just made it destructible.
#6
Posted 24 January 2013 - 05:07 PM
Can anyone tell me if this script works with the ZC 2.50? And if it works, can help me to configure it?
#7
Posted 24 January 2013 - 05:57 PM
I don't see any reason it wouldn't work. I've made a better Beamos script since then, though. Search for "Laser Sentry" in the script DB.
#8
Posted 27 January 2013 - 08:54 AM
I've tested the script once and it didn't work with the version of ZC that I was using, but now it worked
However, I have some questions:
1. Is possible to modify the starting point of the laser to the edge of the combo?
2. The Beamos has the feature to keep spinning the head and stop and shoot the laser immediately when the Link is in his field of vision. The script already performs this action or is necessary to change something?
However, I have some questions:
1. Is possible to modify the starting point of the laser to the edge of the combo?
2. The Beamos has the feature to keep spinning the head and stop and shoot the laser immediately when the Link is in his field of vision. The script already performs this action or is necessary to change something?
#9
Posted 27 January 2013 - 05:13 PM
1. Change the "this" part of the following line:
2. That needs a modification or my afore-mentioned Laser Sentry script.
CODE
Screen->Line(3, wpn->X+7, wpn->Y+7, this->X+7, this->Y+7,
beamcolor, 1, 0, 0, 0, 128);
beamcolor, 1, 0, 0, 0, 128);
2. That needs a modification or my afore-mentioned Laser Sentry script.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users