Jump to content

Photo

Not Destroying Custom LWeapons When at Edge of Screen


  • Please log in to reply
8 replies to this topic

#1 idontknow8

idontknow8

    Senior

  • Members

Posted 14 February 2018 - 09:27 AM

I know that the game engine automatically delete (technically change the WDS_DEADSTATE to WDS_DEAD;) all Weapons when at or near the edge of a screen.  It appears just how far from the edge depends on the dmap, with dungeons having destroy the lweapon further from the edge since it has a larger border.  My question is, this really messes up many of my custom, scripted weapons.  Is there a way to make it so that the Lweapon & its sprite do NOT disappear at the edge of a screen?



#2 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 14 February 2018 - 09:54 AM

The short answer: No.

The long answer: Yes, but you have to rescript lweapons, creating arrays for their X and Y positions, damage, tile, animation frame, animation speed, direction, and so on, and having your global script manually handle these every frame.

#3 idontknow8

idontknow8

    Senior

  • Members

Posted 14 February 2018 - 10:09 AM

Oh Lordy... ok, I;m gonna have to figure out to use arrays now apparently.  I've got to do this!

 

I thought a simple

"While lweapon->X is less than "A" (A being the distance from the right edge)...

Or greater than "B" (B being the distance from the left edge)...

Or lweapon->Y is less than "C" ("C" being the distance from the top edge)...

Or greater than "D" ("D" being the distance from the bottom edge)...

...then keep the dead state as WDS_ALIVE"...would work.

 

I also thought if any of these condition are true, return lweapon to Link (for a custom boomerang type item) would work but I guess neither do.


Edited by idontknow8, 14 February 2018 - 10:13 AM.

  • Deedee likes this

#4 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 14 February 2018 - 12:16 PM

Russ: you're overcomplicating things.

You can either just set Weapon->DeadState to -1; each frame, which usually forcibly keeps it alive even beyond the edge of the screen. If that fails, you can just edit the DrawXOffset/DrawYOffset and HitXOffset/HitYOffset to achieve the same effect as changing it's X/Y positions. Just keep the X/Y position within screen boundaries. For best results, keep the X/Y at 0,0 so you can just outright use the offsets as a replacement for the x/y values instead of having to calculate the difference.



#5 idontknow8

idontknow8

    Senior

  • Members

Posted 14 February 2018 - 09:20 PM

-1 doesn't do that...but -2 does...however, it just seems to draw the lweapon and then it gets rid of its other properties, including it no longer movies and no longer damages enemies.  Arrgh! This is aggravating...it breaks my game & needs to be fixed.  I also tried the other method of setting the lweapon at coordinates 0, 0 and then making it draw & hit offsets to that of the FFC and make the FFC move via Vx and Vy but this doesn't seem to work either.



#6 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 14 February 2018 - 09:34 PM

-1 doesn't do that...but -2 does...however, it just seems to draw the lweapon and then it gets rid of its other properties, including it no longer movies and no longer damages enemies.  Arrgh! This is aggravating...it breaks my game & needs to be fixed.  I also tried the other method of setting the lweapon at coordinates 0, 0 and then making it draw & hit offsets to that of the FFC and make the FFC move via Vx and Vy but this doesn't seem to work either.

Do you set the draw/hit offsets every frame? Can I see the code?



#7 idontknow8

idontknow8

    Senior

  • Members

Posted 14 February 2018 - 09:50 PM

Doesn't setting the lweapon at 0, 0 just defeat the purpose of this idea because you're putting the lweapon at a coordinate that is at the screen's edge, which will just instantly delete it anyway???



#8 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 14 February 2018 - 10:06 PM

Doesn't setting the lweapon at 0, 0 just defeat the purpose of this idea because you're putting the lweapon at a coordinate that is at the screen's edge, which will just instantly delete it anyway???

Are you using NES-Dungeon type?  If so, then yes. You can try setting it in the center of the screen and using difference to set the offsets to where they should be. 



#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 15 February 2018 - 03:27 AM

Oh Lordy... ok, I;m gonna have to figure out to use arrays now apparently.  I've got to do this!

 

I thought a simple

"While lweapon->X is less than "A" (A being the distance from the right edge)...

Or greater than "B" (B being the distance from the left edge)...

Or lweapon->Y is less than "C" ("C" being the distance from the top edge)...

Or greater than "D" ("D" being the distance from the bottom edge)...

...then keep the dead state as WDS_ALIVE"...would work.

 

I also thought if any of these condition are true, return lweapon to Link (for a custom boomerang type item) would work but I guess neither do.

 

You want x/y at 1,1. Some DMap types will eat weapons at 0,0, IIRC.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users