Jump to content

Photo

Reflect Orb


  • Please log in to reply
7 replies to this topic

#1 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 26 May 2012 - 11:55 AM

Wow I've been gone awhile. What better way to say "I'm back!" than with "Hey, I need..." icon_razz.gif . Anyway, the idea is the little light orbs Ganondorf shoots at you in Ocarina. What I want is something that shoots the orb at you (targeted), and reacts if you reflect the orb with a sword swing and it hits whatever shot it. Easy? 'Cause I can't program for crap!

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 May 2012 - 12:51 PM

Shouldn't be too hard. If it collides with an LWeapon of a specified type (LW_SWORD), then its direction reverses (angle += 180 degrees). What should be shooting these at you? An enemy? An FFC?

#3 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 27 May 2012 - 08:35 PM

Ideally it can be any enemy (preferrably stationary), and you'd attach an ffc that fires the orb. But specifically for me i want it to be a 2x1 human figure that floats at the north end of the screen. So I'd assume that'd be an ffc. The way I'm using it, it only takes damage from the reflected orb, dies after 5 hits (so no becoming weak after being hit like you'd think after ocarina's final boss), and screen secrets trigger afterward.

#4 SUCCESSOR

SUCCESSOR

    Apprentice

  • Banned
  • Real Name:TJ

Posted 28 May 2012 - 05:39 AM

So the enemy moves vertically at the top of the screen, shoots an "orb" at Link in a straight line and if the orb collides with Link's sword it would reflect back and home in on the enemy.

Or would you want the orb to home in on Link as well? Or neither? I think there would be a small problem with just reversing the projectile. Link hits the orb and it's direction heads back to where the enemy was but, this is a moving enemy. Is it going to be in the same place it was when the projectile returns? I doubt it.

And I'm sure you'd like at least one other projectile. A projectile cannot be knocked back maybe optional. I know you mentioned OoT but it sounds like Phantom Hourglass' "Dead Man's Volley" with those 4 creepy girls on the ghost ship. And taking inspiration from that have it spit 3 projectiles(one reflectable and two not) after so many hits.

This sort of thing is beyond my knowledge of scripting(been doing it a month) but if someone could do it I'd love to use it(and dissect the code to figure out how it works).

Edited by SUCCESSOR, 28 May 2012 - 05:45 AM.


#5 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 28 May 2012 - 06:46 AM

Well... this should work.

CODE

lweapon DuplicateEW(eweapon a) {
  lweapon b = Screen->CreateLWeapon(LW_SCRIPT1);
  b->X = a->X;
  b->Y = a->Y;
  b->Z = a->Z;
  b->Jump = a->Jump;
  b->Extend = a->Extend;
  b->TileWidth = a->TileWidth;
  b->TileHeight = a->TileHeight;
  b->HitWidth = a->HitWidth;
  b->HitHeight = a->HitHeight;
  b->HitZHeight = a->HitZHeight;
  b->HitXOffset = a->HitXOffset;
  b->HitYOffset = a->HitYOffset;
  b->DrawXOffset = a->DrawXOffset;
  b->DrawYOffset = a->DrawYOffset;
  b->DrawZOffset = a->DrawZOffset;
  b->Tile = a->Tile;
  b->CSet = a->CSet;
  b->DrawStyle = a->DrawStyle;
  b->Dir = a->Dir;
  b->OriginalTile = a->OriginalTile;
  b->OriginalCSet = a->OriginalCSet;
  b->FlashCSet = a->FlashCSet;
  b->NumFrames = a->NumFrames;
  b->Frame = a->Frame;
  b->ASpeed = a->ASpeed;
  b->Damage = a->Damage;
  b->Step = a->Step;
  b->CollDetection = a->CollDetection;
  b->Flash = a->Flash;
  b->Flip = a->Flip;
  return b;
}

void DoOrbRevresal(eweapon ew) //call with the enemy weapon you want to "bounce back" as the argument
{
  lweapon lw;
  for(int i = 1; i < Screen->NumLWeapons(); i++){
    lw = Screen->LoadLWeapon(i);
    if(lw->Type == LW_SWORD){
      if( Collision(lw,ew) ){
         lweapon orb = DuplicateEW(ew);
         orb->Agular = true;
         orb->Angle = ArcTan(ew->X-lw->X, ew->Y-lw->Y);
         orb->Angle = Lerp(orb->Angle, ew->Angle, Randf(0,0.2)); //probably needs tweaking
         ew->X = -256;ew->DeadState = 0; //kill the eweapon;
      }
    }
  }
}


Someone needs to write the /actual/ script, but if you call this function from that it should work. (note: I am not writing the Ganon yogurt or whatever script, just the reflect part.) icon_razz.gif

#6 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 29 May 2012 - 11:19 AM

So that's not the actual script? I'll let you know I can't script to save my life, otherwise I'd have done it myself! Sadly I don't know what a lot of that code means. I just need this script.

Reminder:
-Script attaches to enemy, which then fires this orb as an eweapon.
-If player (Link) hits orb with sword, orb reflects back at enemy.

Again, I'd do this myself if I knew how. But sadly I don't. Yet.

#7 Zim

Zim

    Freelance Nobody

  • Members
  • Real Name:Zim
  • Location:Washington

Posted 14 July 2012 - 09:42 PM

I would just make the ball itself move by velocity instead of coordinates so it'd be a simple *-1 to flip it's direction guys.
In fact.. if you use an ffc attached to link/link's weapon that's hitting the ball back you could even factor in the direction of the force/swing back into which direction the ball goes.
I already made a pong game with zscript a few years ago doing something like that.

Edited by Zim, 14 July 2012 - 09:45 PM.


#8 Rex-Leviathan

Rex-Leviathan

    Lost, Loneliness, Liberation!

  • Members
  • Location:Assorted Locations

Posted 02 August 2012 - 10:23 AM

I don't know what any of you are talking about please can someone just hand me a script? I'll even take the pong one and attempt modifying it with my limited knowledge!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users