Jump to content

Photo

Scripted armor


  • Please log in to reply
47 replies to this topic

#46 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 May 2015 - 11:47 AM

A constant, certainly, unless other classes will have a different value. That's why I favo4 arrays with variables, and constants pointing to them. The best of both worlds, for ZC.

You could add it to an array, set a constant SWORDPOWER to its index, and do this:
 
int SwordPower(){
return CharacterArray[SWORDPOWER];
}
...for the same effect...or...
 
const int WARRIOR = 0;
const int RANGER = 1;
const int BARD = 2;
const int THIEF = 3;
const int MAGE = 4;

int SwordPower(int charClass){
return CharacterArray[SWORDPOWER+CLASS];
}
...to modify the damage based on class. I suppose that breaks the scope of your header a bit though, but it's pretty much what I'd do in that situation.

ZC RNG can be broken in general, but speed of swing should have an equal chance to produce repeated values of '1'; and '6', which should balance around 3.5.

If your enemy had 14 HP, it should take 4 attacks on average to kill it. You may want to calculate the raw average when assigning HP, for this reason. If you want to expect five attacks, it should have 17 or 18 HP, but larger numbers produce better results with variance.

You could also restrict the RNG, by putting a timer on changing the value, and calling a function to roll the value that is smart; that only produces a new result when the timer expires. That could expand the variance a bit; but you could also go the Golden Axe method, and give smaller spreads when the timer is high, and larger spreads when low.

If you don't understand that reference, let me know, and I'll explain it; but I'm going to add functions for that to RPG.zh, now that I've thought of it.

I'd like to calculate damage based on how precise the collision was, in an ideal world, and slashing swords have too large a hitbox IMO. One of the things that I'd like to do with cripted sworfds, is more precisely define their hitbox; but I'm the bloke who wants to code AI enemies with swords of their own, as in Z3, for parrying blows.

Edited by ZoriaRPG, 11 May 2015 - 11:54 AM.

  • Binx likes this

#47 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 25 May 2015 - 06:53 PM

So, there is ONE minor problem: Itemdata->Power doesn't like floats,  so odd-numbered damage is impossible (by setting itemdata->Power to a random roll divided by two). The best I can think of is to double all enemy HP, then have the displayed damage show half of the damage actually done, thus faking the effect (and essentially making itemdata->Power the actual damage done, rather than half the damage). but does anyone know of an easier way to do it?

 

EDIT: I'm using this script that Jamian made to check the damage. So, I'd probably need to know howto alter this script,in particular.

// Set this to the font colour you want.
const int DMG_FONTCOL=0;
// Set this to three different unused slots for the npc->Misc[] values. If you don't have any other script using those, the default values are fine.
const int DMG_MISC1=1;
const int DMG_MISC2=2;
const int DMG_MISC3=3;

void EnemyDamage(){
int offset;
for(int i=1;i<=Screen->NumNPCs();i++){
  npc enem=Screen->LoadNPC(i);
  if(enem->Misc[DMG_MISC1]==0){
   enem->Misc[DMG_MISC1]=1;
   enem->Misc[DMG_MISC2]=enem->HP;
   enem->Misc[DMG_MISC3]=0;
  }
  if(enem->Misc[DMG_MISC1]!=0&&enem->HP<enem->Misc[DMG_MISC2]){
   enem->Misc[DMG_MISC1]=45;
   enem->Misc[DMG_MISC3]=enem->Misc[DMG_MISC2]-enem->HP;
   enem->Misc[DMG_MISC2]=enem->HP;
  }
  if(enem->Misc[DMG_MISC1]>1){
   if(enem->Misc[DMG_MISC3]>9){offset=0;}
   else{offset=4;}
   if(enem->Misc[DMG_MISC1]%3!=0)Screen->DrawInteger(6, enem->X+offset, enem->Y-18+(enem->Misc[DMG_MISC1]/5), FONT_Z1, DMG_FONTCOL, -1, -1, -1, enem->Misc[DMG_MISC3], 0, 128);
   enem->Misc[DMG_MISC1]--;
  }
}
}

Edited by Binx, 25 May 2015 - 06:56 PM.


#48 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 26 May 2015 - 10:41 PM

As an aside to this, I was wondering about ways to write random damage to NPC->Damage and NPC->WeaponDamage. I was thinking about using those two slots in the enemy editor to hold the min and max values, but I can't figure out how to reset it after each roll, so I'm thinking I need an array containing all the enemy ids and the random values associated, so that I can put something in the global to change all enemy damage to random damage based on their values in the array... Unfortunately, I'm not sure how to set up arrays. Could someone write up a template-type thing that I can populate with my enemies?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users