Jump to content

Photo

Scripted armor


  • Please log in to reply
47 replies to this topic

#31 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 30 April 2015 - 05:07 PM

It's definitely not read-only.



#32 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 30 April 2015 - 05:35 PM

But if itemdata is not read-only, does it reset when you reload the game (game-over, continue, quit, etc)? Or can you actually permanently edit your item data?



#33 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 30 April 2015 - 06:17 PM

It resets at reload.



#34 Binx

Binx

    Formerly Lineas

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

Posted 30 April 2015 - 06:34 PM

It resets at reload.


Well, that means you can't make it permanent, so it wouldn't work, after you reload anyways, right? Like say you were trying to use itemdata->Power to set random damage to a whimsical ring, it would reset the ring's power to the editor-assigned 0 after reset.

#35 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 30 April 2015 - 06:44 PM

If you're randomizing the ring's power, why would you need to save it? You can use global variables and the D register if you really need to keep that value for later for some reason.



#36 Binx

Binx

    Formerly Lineas

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

Posted 30 April 2015 - 06:48 PM

because the variables being passed for min and max power are being assigned when the scripted dual sword item is used to switch between 2 swords.
edit: switch as in make the right and left swords have different min/max values.

Edited by Binx, 30 April 2015 - 06:50 PM.


#37 Binx

Binx

    Formerly Lineas

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

Posted 30 April 2015 - 10:49 PM

To make matters more clear, this is the pseudocode I wrote last night (since I can finally copy and paste, thanks to finally being home):
 

Of course, arrays. I think I might need to learn how to use those, I think it'll help with setting up a system for setting the slots, too. I think this will work as a generic for other weapons, though (can't be sure, though, don't have access to my pc or ZScript docs, commenting from my 3DS, so the syntax may need work):

item script Random_Damage;
 {
  void run(Min_Dam,Max_Dam)
   {
    itemdata->Power = (rand(Min_Dam,Max_Dam)/2); //ZQuest translates power to half of damage, yes?
   }
 }

//And if I can ever figure out the sword slots, the whimsical ring add-on and
//lines of pseudocode to be added to dual sword script

Sword_Damage = rand (Sw_Min_Dam, Sw_Max_Dam); //Variables would be set in the equipment slot,
//Still not sure how I'd fare at passing it into the script, though, I still don't know how 
//to replace the argument without the script in front of me but it should activate every time 
//either sword swings

item script Sw_Rand_Dam; //attach as pickup to whimsical ring with 100% chance
 {
  void run()
   {
    itemdata->Power = Sword_Damage;
   }
 }


The idea is that I'd load scripted dummy swords into equipment slots for the left and right hands, which would contain the minimum and maximum damage that particular sword is capable of (for example, a dagger might be 1-4, a short sword 1-6 and a long sword 2- 8 ), which would (some way I haven't figured out yet) pass that information into the ACTUAL (a) button item, the dual sword; then every time the dual sword script is activated (when either the right or left sword swings) it SHOULD set the "Sword_Damage" variable to a new number (using the rand function I'd add into the code), and by setting itemdata->Power to the value of "Sword_Damage", it should give random damage rolls for any dual weapons you want.

Edited by Binx, 30 April 2015 - 10:51 PM.


#38 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 May 2015 - 09:27 PM

well, yeah, I get that, but if I want to have different armor classes, i.e. heavy armor for some light for others, etc. as well as multiple armor levels, wouldn't I have to assign ArmorPower during every character change? I mean, yeah, if they all just had one armor powerup that they share, I could just assign the varying armor classes in the switching script (and that's where I was planning to place the ArmorType variable, anyways) and be done with it, but I was planning on having three armor sets per character. And besides, wouldn't I have to generate the ring item (the stand-in for the character item) on top of Link every time, so that the game will re-check the ring's "power"? 

 

You might want to consider forcing special damage only from eWeapons, and disabling some other things, to get some of your desired effects. You can modify eWeapons on the fly with global functions based on what armour type is in play, so you can protect better against piercing, slashing, bludgeoning, spell, energy, and so forth in that regard.

 

Collision damage is something that you can script by making a 256 element table, adding collision damage to it, for each enemy, and making a modifier to multiply that damage when an enemy collides based on what type of protection is in play. You could even add a HitChance modifier, so that there is a % chance of the player being damaged.

 

Once you have that in place, set 'Damage' in the enemy editor to 0, so the internal damage (power) is disabled. That table, and any modifiers will take care of damage on collision.

 

 

Well, that means you can't make it permanent, so it wouldn't work, after you reload anyways, right? Like say you were trying to use itemdata->Power to set random damage to a whimsical ring, it would reset the ring's power to the editor-assigned 0 after reset.

 


If it's constantly random, you can store it in a variable each frame, and the last held value should be available to read back in onContinue.

 

 

To make matters more clear, this is the pseudocode I wrote last night (since I can finally copy and paste, thanks to finally being home):
 

The idea is that I'd load scripted dummy swords into equipment slots for the left and right hands, which would contain the minimum and maximum damage that particular sword is capable of (for example, a dagger might be 1-4, a short sword 1-6 and a long sword 2- 8 ), which would (some way I haven't figured out yet) pass that information into the ACTUAL (a) button item, the dual sword; then every time the dual sword script is activated (when either the right or left sword swings) it SHOULD set the "Sword_Damage" variable to a new number (using the rand function I'd add into the code), and by setting itemdata->Power to the value of "Sword_Damage", it should give random damage rolls for any dual weapons you want.

 

 

Passing damage to the sword LW isn't really viable. You need to fully script those weapons to be able to give them variable damage... At least, that is what I had to do for LoE. The swords code relies on die type, number of dice, muscle statistic, and in some cases, level to determine how much damage it does; while still obeying sword NPCDTs, and shields. (Alucard worked out much of it, for his stdWeapons header, that I strongly advise you to examine.)


Edited by ZoriaRPG, 10 May 2015 - 09:33 PM.


#39 Binx

Binx

    Formerly Lineas

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

Posted 10 May 2015 - 10:13 PM

 

Passing damage to the sword LW isn't really viable. You need to fully script those weapons to be able to give them variable damage... At least, that is what I had to do for LoE. The swords code relies on die type, number of dice, muscle statistic, and in some cases, level to determine how much damage it does; while still obeying sword NPCDTs, and shields. (Alucard worked out much of it, for his stdWeapons header, that I strongly advise you to examine.)

You don't need to pass damage to the sword LWeapon, the whimsical ring adds damage to the swords power based on the ring's power, if it's set to 100% chance,it will always activate. That's the point of making the whimsical ring have variable power that's set by the sword currently in use (through use of an action script,to set the variable), so, basically, what it would do (in theory, still haven't tested it), is that swinging the sword would activate a script that would set the variable "SwordDamage" to whatever the outcome of its random calculation is (for example, a longsword might have a range of 1-6 damage, so "SwordDamage" would be set to a number between 1 and 6) and since another script would somehow set the whimsical ring's power to "SwordDamage", it SHOULD pass that power boost on to the sword. That's how MoscowModder's "attack ring" script he made for me was able to affect swords (it didn't have random damage, though)



#40 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 May 2015 - 05:18 AM

You don't need to pass damage to the sword LWeapon, the whimsical ring adds damage to the swords power based on the ring's power, if it's set to 100% chance,it will always activate. That's the point of making the whimsical ring have variable power that's set by the sword currently in use (through use of an action script,to set the variable), so, basically, what it would do (in theory, still haven't tested it), is that swinging the sword would activate a script that would set the variable "SwordDamage" to whatever the outcome of its random calculation is (for example, a longsword might have a range of 1-6 damage, so "SwordDamage" would be set to a number between 1 and 6) and since another script would somehow set the whimsical ring's power to "SwordDamage", it SHOULD pass that power boost on to the sword. That's how MoscowModder's "attack ring" script he made for me was able to affect swords (it didn't have random damage, though)

 

Oh, sorry. I thought you wanted to pass a specified random value range/spread (as in 1 to 6, or 1 to 10) in place of the damage, as I've done, to the physical LWeapon. LoE replicated traditional 'roll the dice' RPG damage mechanics, for just about everything; although I haven't enabled all of it. (Testing it a bit at a time is wise.)

 

If using the whim ring, yes, you an get away with that, and that's also clever. It may even be better than what I have now, if it works out, although I'd need to think on that.. Hmm..possibly not, because of the other calculations that I'm using, and all the related variables. I suppose I'd need to see it in action, and evaluate how it functions, to know if I could use whim rings to do those calculations too. 

 

The problem with scripted swords, is some of the weird artefacts that you can generate, but the plus side, is the ability to control every aspect of them. I always thought that whim rings had to increase power, not replace it; so I think they may cause a conflict if you set the 'Power' of a sword to '0'. ZC might treat it as a 0-power item, no-matter what damage it's supposed to inflict based on the boost.

 

Otherwise, if you do get that working, I'd like to add it to the RPG.zh header, if you;d be kind enough to permit that. it's certainly an easier mechanic that would satisfy most people.

 

I was also unaware that you could write to ItemData->Power, until I read this topic, if you're curious.

 

Added these to the library, for general use:

 


Edited by ZoriaRPG, 11 May 2015 - 07:16 AM.


#41 Binx

Binx

    Formerly Lineas

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

Posted 11 May 2015 - 08:31 AM

Yeah, I actually got the idea from LoE (and basically, I'm trying to do the same thing, replicate die rolls). In fact, the whole of the script file I'm working on is intended to be kind  of an extremely simplified version of your RPG header, for beginners to use, removing some of the more complicated aspects, like saving throws, armor class ratings and the like, a simplified stat table, and with a couple other tweaks (like prestige classes) because, screw it, if I'm building my own system, I might as well do things a little differently. Basically, I'm trying to see if I can make something that's in between a traditional action RPG and a tabletop-type system (one of the reasons rangers and mages get no shields, because both classes use both of their hands for their weapons, though I'm debating just adding a proficiency for each weapon type that all classes can spend points on, with a "preferred" weapon that they get advanced usage abilities with, like the ranger could get lower off-hand penalties when dual-wielding). So, yeah, as far as I'm concerned, anything I write for this (which, mind you, might not be much, I'm not the best at this stuff, lol), you're more than welcome to use, since this whole thing is just building off of and dumbing down ideas you had, in the first place.


Edited by Binx, 11 May 2015 - 08:41 AM.


#42 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 May 2015 - 09:38 AM

Yeah, I actually got the idea from LoE (and basically, I'm trying to do the same thing, replicate die rolls). In fact, the whole of the script file I'm working on is intended to be kind  of an extremely simplified version of your RPG header, for beginners to use, removing some of the more complicated aspects, like saving throws, armor class ratings and the like, a simplified stat table, and with a couple other tweaks (like prestige classes) because, screw it, if I'm building my own system, I might as well do things a little differently. Basically, I'm trying to see if I can make something that's in between a traditional action RPG and a tabletop-type system (one of the reasons rangers and mages get no shields, because both classes use both of their hands for their weapons, though I'm debating just adding a proficiency for each weapon type that all classes can spend points on, with a "preferred" weapon that they get advanced usage abilities with, like the ranger could get lower off-hand penalties when dual-wielding). So, yeah, as far as I'm concerned, anything I write for this (which, mind you, might not be much, I'm not the best at this stuff, lol), you're more than welcome to use, since this whole thing is just building off of and dumbing down ideas you had, in the first place.

 

Heh. One of the nice things that I did, was to split the header into separate files, with a .zlib extension. I don't know when you last looked at it, but you may want to look at those, and see what you can use, as it's now organised.

 

Some of what you're things you're doing seem optimised in ways that I did not anticipate as possible in ZC; and you seem to be focused more on character traits at present, than on engine dynamics, which means that what you're making could save me time, and vice versa.


  • Binx likes this

#43 Binx

Binx

    Formerly Lineas

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

Posted 11 May 2015 - 09:40 AM

So, I finally got around to testing and... it totally worked! So, here's the code (uses the ModItemPower function from ZoriaRPG's previous post):

const int SwordPower = 122; //The item id number of the whimsical ring. Chance should be set to
//1 in 1 and power to 0
int SwordDamage; 


//Set the actual power of the "Sword" item (Wooden sword, white sword, etc.) to 0.
//D0 is the minimum damage the sword can do, D1 is the maximum damage the sword can do.
item script SwordRandomDamage 
    {
        void run(int SwMinDam, int SwMaxDam) 
        {
        SwordDamage = Rand(SwMinDam, SwMaxDam);
        ModItemPower(SwordPower,SwordDamage);
        //Trace(SwordDamage); 
        //Uncomment above for testing purposes
        }
    }

Edited to include the function as part of the item script, just for funsies. no idea if it'll work (haven't tested it), but it should, in theory:
 

const int SwordPower = 122; //The item id number of the whimsical ring. Chance should be set to
//1 in 1 and power to 0
int SwordDamage; 


//Set the actual power of the "Sword" item (Wooden sword, white sword, etc.) to 0.
//D0 is the minimum damage the sword can do, D1 is the maximum damage the sword can do.
item script SwordRandomDamage 
    {
        void run(int SwMinDam, int SwMaxDam) 
        {
        SwordDamage = Rand(SwMinDam, SwMaxDam);
        itemdata id = Game->LoadItemData(SwordPower);
        id->Power = SwordDamage;
        //Trace(SwordDamage); 
        //Uncomment above for testing purposes
        }
    }

Edited by Binx, 11 May 2015 - 10:35 AM.


#44 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 11 May 2015 - 10:19 AM

Hmm... Are you planning to use SwordPower as a unique, global variable? Unless you have multiple things changing it, it's sort of wasteful, but otherwise you could easily tuck it away in the array with the class information at some point.

I stored that function in RPH_Experimental_Ext.zlib for the present, but it may end up in either RPG_Items.zlib, or RPG_Proto.zlib, as I'm not certain if much will depend on it regularly.

One other note, Trace(SwordDamage) won't tell you if the item is working. Be certain to test the item on enemies with HP varying between Rand(min,max) to ensure that the changing damage is actually happening.

Although, if it isn't stunning, then it doesn't have 0 power. Is the sword itself set to 0-power in the editor? if so, then that means that this system would indeed have worked for much of what I went through hell, and back, to accomplish.

Too bad the whim ring only affects swords; or, at least to my knowledge, it only affects swords. Otherwise, that could be used for a very simple, and elegant weapon framework.

Edited by ZoriaRPG, 11 May 2015 - 10:23 AM.


#45 Binx

Binx

    Formerly Lineas

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

Posted 11 May 2015 - 10:27 AM

Yeah, I checked it against a group of enemies, the trace function was just to make sure the random damage was being rolled, sword definitely had 0 power, and no stunning occurred, gibdos (14 HP) took on average 3-5 hits to kill with a damage range of 1-6. The one big drawback is that you can swing the sword so fast, it really reduces the chances you'll get a low roll on contact, but I'll probably be able to work around that once I add in the stat bonuses.

 

EDIT: Oh, as for the variable: yeah, it's pretty wasteful, it's mostly for my own keeping track of things. I could probably just type 122 into the code, actually; or just use the predefined whimsical ring variable. I kinda also figured some people might want to use a custom whimsical ring for this, and keep the regular whimsical ring as a separate item. Should make it a constant, though.


Edited by Binx, 11 May 2015 - 10:32 AM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users