Jump to content

Photo

Interrupt & Change LW Damage On The Fly?

LWeapons Damage Power Global

  • Please log in to reply
6 replies to this topic

#1 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 April 2014 - 12:24 AM

There are a handful of LW Types that can;t be scripted, due to how they work internally. Of these, the notable are LW_SWORD, LW_WAND, and LW_HAMMER.

 

I was wondering if there is a way to interrupt dealing damage to NPCs using any of these types, to read the damage being dealt, and to change that amount before the game engine applies it; or supplement it with other effects.

 

What would be required is a way to read the type of LW dealing the damage, the actual item doing it (for which I already have code), and a way to change the value of the damage, while keeping the same LW_Type.

 

That would allow for more effects, based on swords, or other un-scriptable LWeapon types, overriding the power setting (which can be set to 0), and replace that 0-Power with a specific amount of damage, from the main global active loop.

 

Does anyone have ideas on this; or if it's possible?



#2 Moosh

Moosh

    The Mush

  • Moderators

Posted 12 April 2014 - 01:34 AM

Why don't you just set Itemdata->Power? I recall doing this a while back to give the sword a chance to do critical hits because at the time I wasn't aware the Whimsical Ring was a thing.



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 April 2014 - 02:51 AM

Because I am replacing all in-built damage with an entirely new system, based on Rands; replicating rolling dice on a real RPG. I can easily do this for everything other than LW_SWORD, LW_WAND, LW_BEAM (Swordbeams, I think), LW_HAMMER, and possibly something else that I may have missed.

 

Yes, I could use script weapons to handle this, but the enemy editor only had a global script defence, not a defence per scripted weapon type.

 

Reading, and changing all damage, on the fly, based on the item that generates it, would solve this problem. It would also directly equate damage of a weapon to enemy HP (and defences against things); rather than using power * 2 for damage.

 

I can always add scripted damage to anything, but I can't use the LW defences for swords, and the wand, unless I script every bloody enemy in the game. I don;t recall if the LW type for wand magic is part of the list of LW_Types that you can;t generate, but I think it is not.

 

In any event, the Power settings don;t offer a random value option, which is what I would like to have working. I can further tie this into statistics, and level-based abilities, if I'm clever.


Edited by ZoriaRPG, 12 April 2014 - 02:55 AM.


#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 April 2014 - 09:34 AM

In my experience, swords have their damage reset every frame (or every animation frame?). Just something to watch out for.

Otherwise, you can just set lweapon->Damage. Easy!

#5 Moosh

Moosh

    The Mush

  • Moderators

Posted 12 April 2014 - 02:50 PM

In any event, the Power settings don;t offer a random value option, which is what I would like to have working. I can further tie this into statistics, and level-based abilities, if I'm clever.

So you have an item script on all your weapons that sets this->Power based on whatever calculations you want it to do. The way you're suggesting should work too, but I imagine you'd have to do a bunch of stupid stuff to determine which sword eweapon belongs to which sword.



#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 13 April 2014 - 02:29 AM

In my experience, swords have their damage reset every frame (or every animation frame?). Just something to watch out for.

Otherwise, you can just set lweapon->Damage. Easy!


Eh? You can't create a LW_SWORD in ZScript... How is this easy, and what am I missing?

Would I just be reading an LWeapon and writing back the damage value? I'm concerned that it wouldn't work, because of the LW_Type limitations. It's not something that I need to resolve urgently, but I wouldn't mind knowing how to do it.

I should probably play around with some ideas, and see if they work.

#7 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 April 2014 - 10:26 AM

You can't create LW_SWORD weapons in scripts, but you can alter the properties on existing ones. If it weren't for the annoying trait I mentioned, you could just find each sword and set its Damage.



Also tagged with one or more of these keywords: LWeapons, Damage, Power, Global

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users