View unanswered posts | View active topics It is currently Fri Dec 27, 2024 7:45 am



Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
 Upgrade, Enhancement Items 
Author Message
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Upgrade, Enhancement Items
Hey, After 2 years I have decided to try modding . . . again.

Info: I want to make something that enhances the weapons you have or will buy, atm I am using a grenade template to be my object that will alter the other weapons

Questions:
1) Would a weapon be a better class rather then a grenade? The only reason for the item is to exist and bombs are usually small.
2) I have read in the wiki that you can check read-only properties but not change then. Sharpness is not a read-only property does that mean I will be able to change the sharpness of a object (using Lua) ? Are there other properties I can change that are not listed in the wiki, Gold value or even change the kind of particle/ammo a weapon shoots?
3) Will I be able to check if my enhancement item is in the inventory of one of the players actors? and then "upgrade" sharpness, reduce gold cost or change the ammo of weapons?
4) If this is possible will it be applied to all the weapons of the same kind or can I limit it to the weapons in his inventory?

Can someone maybe help me with the Lua for this, if any of this is even remotely possible?
I can program school level Delphi (I know not a lot) but Lua isn't even close to Delphi.

My take on how it would work:


EDIT: I have been sneaking around the forum and found that Azukki made something similar, buying different ammo for his weapons enhances the sharpness of the ammo.


Sat Jun 23, 2012 10:12 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
Yeah, you can change most of what you listed, and in fact, you can make most of the changes easily thanks to being able to change the used magazines.

You see, now you can define different magazines and make the weapon change them using Lua. So, you can define a magazine with weak rounds and low round count, upgrade the weapon, and change it's magazine to one which has stronger rounds with a mid round count, and so on.

Now, there are also some other properties that can be changed directly on the weapon, like the rate of fire, sharplength, and maybe some other things I haven't tested yet.


Sat Jun 23, 2012 10:38 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
Does such a change apply to all the weapons? Or can I keep it inventory specific?
When I write the Lua for this would I start with a on create event (it has to be created in somethings inventory) and just use a when destroyed event to undo the change?

EDIT: If I use a on create event will it remove my ability to enhance something if he has like a combination of enhancement items? Wouldn't a while existing event work better?


Sat Jun 23, 2012 10:42 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
The changes you make are to the existing weapon, not to all the weapons you buy from that moment on.

EDIT:

Answered half the questions.

It depends how you want to upgrade the weapon, since there are different ways to "upgrade" them. Buying a grenade, dropping it nearby, and upon explosion it upgrades the weapon?


Sat Jun 23, 2012 10:54 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
If you have the item in you inventory (any actor) then it upgrades the weapon. But if for instance he has 2 upgrade items then they give a better bonus then they would give if they they were alone so if you kill the actor that has these items they should undo the changes

I don't know any Lua so would dropping it be more effective? or does having it in the inventory work just as well?

Can you edit the inventory of actors? remove items and add items?
Would using a while existing event allow me to change all the weapons of that kind (change then as they are bought)?


Sat Jun 23, 2012 11:04 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
Wow, too many questions in a single post!

Well, it depends on how would you like it to work. You can check what items the actor has in it's inventory, you can remove or add them too. Now, having the weapon and having additional items to upgrade it in the inventory isn't a bad idea, but if I'm not wrong, you must have the item held for any scripts to activate. So, let's say you buy a rifle and buy an upgrade that turns in into rifle Mk II. You would have the rifle and the upgrading item in the inventory. When you switch to the item that upgrades the weapon, it checks if the actor has said item in it's inventory; if it does, it upgrades the rifle to rifle Mk II and then the item gets deleted, if not, the item stays in your inventory until you have a proper weapon that can be upgraded.


Sun Jun 24, 2012 1:19 am
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
Asklar wrote:
...but if I'm not wrong, you must have the item held for any scripts to activate...When you switch to the item that upgrades the weapon, it checks if the actor has said item in it's inventory; if it does, it upgrades the rifle to rifle Mk II and then the item gets deleted.


Is there a way that the item can be kept? I want you to be able to kind of upgrade the upgrade, for instance you buy a sharpness upgrade (x amount sharpness increase) while it's in your inventory the whole team gets the benefits, you buy another sharpness upgrade, Lua removes both upgrades from the inventory (this will only happen when they are in the same inventory) and replaces it with a non-buyable upgrade that increases the sharpness (4x increase) making it more valuable then just 2 normal upgrades that give 2x sharpness.


Sun Jun 24, 2012 8:30 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
Of course you can do that, it should be too hard.


Sun Jun 24, 2012 10:49 am
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
Okay thanks, so how would I go about doing this? half of the things that you can change are not listed, and I have no idea how Lua works (yet).

Code:
-- Script will run when the item is held?
Create(self) when bought

 For Actors in MovableMan.Actors do -- Goes through all the actors, how do I keep it team specific?
  if actor.HasObject("PresetName") then -- Checks if he has the weapon
   --Changes the things I want to change
  end -- If
 end -- For
end -- Create(self)

--When item is destroyed
Destroy(self)
 For Actors in MovableMan.Actors do -- Goes through all the actors, how do I keep it team specific?
  if actor.HasObject("PresetName") then -- Checks if he has the weapon
   --Undoes changes
  end -- If
 end -- For
end -- Create(self)


Something like that? Help with the actual code would be appreciated


Sun Jun 24, 2012 12:38 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
To check if you want it to be team specific you'd had to add an extra condition in the "if actor.HasObject" that would be actor.Team == X, where x is the number of the team, being 0 the red team, 1 the green team and so on.

Alright, if you want to continue with the script, how did you want to change the things? Using different magazines? Changing the rounds attributes just when they are fired?


Sun Jun 24, 2012 10:18 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
Well, is it easier to change the round the magazine uses or change the magazine? or just change the particle the round uses maybe?
If I can I would like to change all of the above, one example is Aluminum weaponry that reduces the mass of the magazine/weapon/round/particle making it lightweight but because the particle is also lighter it does less damage, I also have Titanium weaponry that totally changes the round the grenade launcher fires but also adds more rounds to the magazine.


Mon Jun 25, 2012 8:39 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
It would be easier to change the entire magazine instead of keeping the same magazine and changing the rounds it fires.
The advantages of changing the entire mag would be that there is very little lua involved on it and would be much more reliable.
A disadvantage I can think of is that stacking different kind of upgrades would force you to create a lot of magazines. Let's say that if you create 3 upgrade items for sharpness and 3 upgrade items for mass, you would have to code at least 10 magazines (one default magazine and the other nine combinations of 3 different sharpness levels and 3 different mass levels), and if you decided to increase the max amount of upgrades or attributes you could modify the magazines needed to be defined would be even more.

Though, I'm pretty sure I might be overcomplicating this thing.


Mon Jun 25, 2012 9:32 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
Well 10 magazines are at least better then 10 devices, copy and paste is my friend ;D

But I can also change the devices attributes? So that should limit the amount of magazines I would have to make, and the less Lua the better (until I actually know what I'm doing)

EDIT: Changing the particle would be usefull if thats possible (sprayers).
Also maybe have priorities? e.g You have 2 upgrades in your inventory, a gives less mass and more rounds, b just gives more round, you then just receive the bonusses from a and b is kinda useless (accept if it enhances something else).


Mon Jun 25, 2012 9:41 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Upgrade, Enhancement Items
Things like sharplength, rate of fire, mass and some other variables, of course. Also there are some variables that you can change from the magazine using lua, like the round count.

But changing the round's attribute could result in some bits of complex lua, that's why I think using more magazines would be less complicated.


EDIT:

Well, you could mess around with global variables to change things like that.
Like, for example, having a variable that stores the amount of sharpness upgrades existing, and when the round is fired, the round itself checks if the global variable exist, and the round would be modified without needing to use extra mags or stuff.


Mon Jun 25, 2012 9:51 pm
Profile
User avatar

Joined: Sun May 23, 2010 7:11 pm
Posts: 193
Reply with quote
Post Re: Upgrade, Enhancement Items
Seeing as I would probably break my game trying to change inflight particles, I'll skip that for now.

So how do I go about actually changing the magazines?


Mon Jun 25, 2012 10:05 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 23 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.084s | 13 Queries | GZIP : Off ]