Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "zcommon.acs"
- function int SquareRoot(int number)
- {
- if(number <= 3) { return number > 0; }
- int oldAns = number >> 1, // initial guess
- newAns = (oldAns + number / oldAns) >> 1; // first iteration
- // main iterative method
- while(newAns < oldAns)
- {
- oldAns = newAns;
- newAns = (oldAns + number / oldAns) >> 1;
- }
- return oldAns;
- }
- function int ActorLink(int start_tag, int end_tag, str actor)
- {
- //print(s:"start_tag = ", i:start_tag);
- if (ThingCount(0, start_tag) <= 0)
- return 0;
- // this is the helper script that handles fire spawning
- //print(s:"end_tag = ", i:end_tag);
- if (ThingCount(0, end_tag) <= 0)
- return 0;
- int X = GetActorX(start_tag);
- int Y = GetActorY(start_tag);
- int Z = GetActorZ(start_tag);
- int Xd = GetActorX(end_tag)-X;
- int Yd = GetActorY(end_tag)-Y;
- int Zd = GetActorZ(end_tag)-Z;
- int Xdi = Xd>>16;
- int Ydi = Yd>>16;
- int Zdi = Zd>>16;
- int steps = (SquareRoot(Xdi*Xdi+Ydi*Ydi+Zdi*Zdi)/3);
- Xd /= steps;
- Yd /= steps;
- Zd /= steps;
- for (int i = 0; i < steps; i++)
- {
- SpawnForced(actor, X, Y, Z, 0, 0);
- X += Xd;
- Y += Yd;
- Z += Zd;
- }
- return 1;
- }
- script 1 ENTER
- {
- ActorLink(0, 1, "BulletPuff");
- ActorLink(2, 0, "Blood");
- Delay(10);
- restart;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement