Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: new drug system
New feature: new drug system[message #303950] Thu, 26 April 2012 23:23 Go to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
<font size="">New drug system</font>

I made an overhaul to the drug system. You can now select several drug components and build your own drugs from them.

First, a look at the new Drugs.xml. A drug component has the following tags:

...
<DRUG>
    <ubType>1</ubType>
    <ubDrugTravelRate>4</ubDrugTravelRate>
    <ubDrugWearoffRate>2</ubDrugWearoffRate>
    <ubDrugEffect>15</ubDrugEffect>
    <ubDrugSideEffect>20</ubDrugSideEffect>
    <ubDrugSideEffectRate>2</ubDrugSideEffectRate>
    <ubMoralBacklash>1</ubMoralBacklash>
</DRUG>
...


Now, what do these tags mean?

<ubType> is the number of the component, the specific effects are hardcoded (couldn't externalise those, or I'd need A LOT more tags).
<ubDrugTravelRate> determines how fast the drug comes to its full effect.
<ubDrugWearoffRate> determines how fast the drug effect will wear out.
<ubDrugEffect> measures the effect a drug has. As long as this value is > 0 the drug will have its main effect.
<ubDrugSideEffect> measures the drugs sideeffect. This starts once <ubDrugEffect> hits 0. This starts the second effect, which is mostly negative.
<ubDrugSideEffectRate> determines how fast the sideeffect will wear out.
<ubMoralBacklash> determines if there will be a morale drop once the <ubDrugEffect> hits 0.

So, in the above example, we have a drug that will have its ubDrugEffect raised by 4 every turn, until it hits 15. Then, every turn that value is lowered by 2. Once the ubDrugEffect is below 0, we lose a bit of morale, and the side effect starts at 20. This is again lowered by 2 every turn.

Due to coding restrictions, do not enter values above 126, or weird stuff will happen.

How do you make an item a drug? Simple, just look at these tags:

<usItemClass>268435456</usItemClass>     // always set this
<Medical>1</Medical>                     // always set this
<DrugType>30824</DrugType>


The only new tag is <DrugType>. This is a flag mask that determines the different components used. For a clearer example, just look at the new drugs I made in Items.xml (entries 1535 - 1538).

What drug components exist, and what do they do? Here is the answer:

#define DRUG_ADRENALINE		//0x00000001	//1        vanilla adrenaline
#define DRUG_ALCOHOL		//0x00000002	//2        vanilla alcohol
#define DRUG_REGENERATION	//0x00000004	//4        vanilla health regeneration
#define DRUG_DAMAGERESISTANCE	//0x00000008	//8        damage resistance of up to 25%/-20%
#define DRUG_STRENGTH		//0x00000010	//16       increases strength up to 25 points, lowers it by up to 10 as a side effect
#define DRUG_AGILITY		//0x00000020	//32       increases agility up to 25 points, lowers it by up to 10 as a side effect
#define DRUG_DEXTERITY   	//0x00000040	//64       increases dexterity up to 25 points, lowers it by up to 10 as a side effect
#define DRUG_WISDOM   		//0x00000080	//128      increases wisdom up to 25 points, lowers it by up to 10 as a side effect
#define DRUG_PERCEPTION		//0x00000100	//256      +/- 1 level during interrupts
#define DRUG_PSYCHO		//0x00000200	//512      merc gets the 'psycho' disability while drug/side effect lasts
#define DRUG_NERVOUS		//0x00000400	//1024     merc gets the 'nervous' disability while drug/side effect lasts
#define DRUG_CLAUSTROPHOBIC	//0x00000800	//2048     merc gets the 'claustrophobic' disability while drug/side effect lasts
#define DRUG_HEATINTOLERANT	//0x00001000	//4096     merc gets the 'heat intolerant' disability while drug/side effect lasts
#define DRUG_FEAROFINSECTS	//0x00002000	//8192     merc gets the 'fear of insects' disability while drug/side effect lasts
#define DRUG_FORGETFUL		//0x00004000	//16384    merc gets the 'forgetful' disability while drug/side effect lasts
#define DRUG_BLIND 		//0x00008000	//32768    merc goes blind for 2 turns once side effect hits 1
#define DRUG_KNOCKOUT 		//0x00010000	//65536    heart attack once side effect hits 1 (lose all breath and fall down)
#define DRUG_VISION 	        //0x00020000	//131072   increases sight range 10% on drug effect, decreases it 10% as a side effect
#define DRUG_TUNNELVISION 	//0x00040000	//262144   increases tunnelvison, side effect only


I made 4 new drugs to test this out. For example, the new drug 'Occulin' has a <DrugType>425984</DrugType>. This gives it the effects of DRUG_BLIND, DRUG_VISION and DRUG_TUNNELVISION. I've set the effects so that

  • once you take the drug, your sight range increases 10%
  • once the side effect starts, your sight range is lowered 10% nad you get up to 25% tunnelvison
  • Once that is over, you are blinded for 2 turns


Purely for demonstration reasons, I equipped the most dutch merc I could find with a wide array of, ehm, medical supplies:

http://i50.tinypic.com/2m6ph6w.jpg
This is her normal vision...
http://i50.tinypic.com/2nqy1qx.jpg
... she just took the drug, her vision is enhanced.
http://i50.tinypic.com/148qbm9.jpg
The side effect kicked in.
http://i47.tinypic.com/2605orc.jpg
Now she doesn't see anything (note the icon on her portrait).
http://i48.tinypic.com/6zlbhw.jpg
Drugged dutch girls go berserker. APs on drugs are now shown in pink, the old blue-on black wasn't very readable.

Buns has all drugs in her Kit 5 for demonstration purposes. They are not available on BRs, but perhaps Arulco's drug dealers might have some?

Other drugs I made have the effect of raising strength, but having the risk of a heart attack, as well as your merc becoming a psychopath. But you can think of drugs of your own, become an alchemist with the <DrugType>-tag.

I'll send this to RoWa.

Happy Alchemy!

[Updated on: Wed, 17 June 2015 21:37]



Re: New feature: new drug system[message #303970] Fri, 27 April 2012 11:45 Go to previous messageGo to next message
Parkan

 
Messages:451
Registered:April 2010
Location: Russia,Sevastopol

ehm..the stat rised more than 100 points?Is that possible in ja2?(is the limit of that?)
Re: New feature: new drug system[message #303971] Fri, 27 April 2012 12:17 Go to previous messageGo to next message
DepressivesBrot

 
Messages:3804
Registered:July 2009
128, with even higher values depending on wether he changed additional stuff or not.


Re: New feature: new drug system[message #303989] Sat, 28 April 2012 01:35 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
@Parkan: Depressives Brot is correct. stats can only rise to 128, above that you'd get bogus values. To allow bigger values I would have to change the type of variable used in SOLDIERTYPE, which would require a lot of code changes. I might do that someday, but not here.


Re: New feature: new drug system[message #303993] Sat, 28 April 2012 02:56 Go to previous messageGo to next message
Anonymous
Tao ethusisastically rubs his hands together..."excellent..."

Time to juice my mercenaries up with:

1) Steroids
2) Methamphetamine
3) PCP
Re: New feature: new drug system[message #303999] Sat, 28 April 2012 12:48 Go to previous messageGo to next message
tais

 
Messages:809
Registered:February 2008
Location: NL
I was gonna conquer arulco.. BUT THEN I GOT HIGH!

http://www.youtube.com/watch?v=WeYsTmIzjkw&ob=av3e


Re: New feature: new drug system[message #305174] Fri, 25 May 2012 22:46 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Madd Muggsy discovered a bug, stat-altering drugs do not get along with doctoring... I temporarily commented their effects out, until a better solution can be found.


Re: New feature: new drug system[message #305969] Fri, 15 June 2012 17:31 Go to previous messageGo to next message
Maalstroom

 
Messages:344
Registered:December 2008
Location: en route to San Hermanos
can this be applied to the dart gun too? for example if one doesn't play with "drop all" option enabled, it is easier to paralyze soldiers and then steal from them.
Re: New feature: new drug system[message #305980] Fri, 15 June 2012 22:00 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
that would be possible (as in: it would be possible to code that). However, not by me in forseeable time. You're welcome to do it.


Re: New feature: new drug system[message #305998] Sat, 16 June 2012 13:49 Go to previous messageGo to next message
Maalstroom

 
Messages:344
Registered:December 2008
Location: en route to San Hermanos
i would gladly do it, unfortunately i'm more interested in coding wounds tracking system. For example - soldier was shot in the leg as a result has a penalty for walking u.s.w. ...
Re: New feature: new drug system[message #306005] Sat, 16 June 2012 15:31 Go to previous messageGo to next message
Sam Hotte

 
Messages:2011
Registered:March 2009
Location: Middle of Germany
Maalstroom
i would gladly do it, unfortunately i'm more interested in coding wounds tracking system. For example - soldier was shot in the leg as a result has a penalty for walking u.s.w. ...

Isn't that already simulated by 'critical hit' (= received wound) that makes you lose e.g. agility points when hit in leg?
Re: New feature: new drug system[message #306008] Sat, 16 June 2012 16:11 Go to previous messageGo to next message
Soto Banaris

 
Messages:129
Registered:May 2012
Location: Germany
Sam_Hotte
Maalstroom
i would gladly do it, unfortunately i'm more interested in coding wounds tracking system. For example - soldier was shot in the leg as a result has a penalty for walking u.s.w. ...

Isn't that already simulated by 'critical hit' (= received wound) that makes you lose e.g. agility points when hit in leg?

I think what Maalstrom means is that if you are hit in the leg, you are slower, if hit in the arm, you have problems holding a rifle properly while aiming or can't use a rifle at all because of the untreated wound causing too much pain. Imagine you fire a rifle and the recoil goes through a fleshwound or broken rips. That means "happy, happy, joy, joy" to you? Getting shot is a b*tch, everybody knows that.
Re: New feature: new drug system[message #306010] Sat, 16 June 2012 16:33 Go to previous messageGo to next message
Sam Hotte

 
Messages:2011
Registered:March 2009
Location: Middle of Germany
Speed is represented in game by APs that are in return influenced by AGI, stamina etc.
So "a wounded leg makes you slower" is already in game to some extent. That's what i meant by 'simulated'.
(Same applies e.g. to losing DEX by a critical hit resulting in worse CTH)

Yes, i am aware that (in theory) everything can always be simulated in more detail and more complicated and so on ... Wink

Just wanted to throw in that "wounds" basically are already in. Smile
Re: New feature: new drug system[message #315242] Thu, 07 February 2013 02:43 Go to previous messageGo to next message
CapnJack

 
Messages:58
Registered:June 2012
There seems to be a problem with the way the new drug system is handling regeneration currently. In SVN 5721 (and I'm presuming later builds since no changes were mentioned in the changelogs or datafile changes) when someone takes a regen booster nothing happens. So I check the Items.xml and the DrugType is correct so the character should regenerate health. Then I check Drugs.xml and there under the regeneration drug ubDrugEffect is set to 0. According to the notes in Drugs.xml this would cause regen booster to have no effect! So I set ubDrugEffect to 1 and now a merc will regenerate health upon taking the drug but it happens instantly instead of over time and I'm not sure if it is the correct amount of regeneration. What values need to be changed to restore the vanilla behavior of regen boost or is this some oversight that happened in some code changes?

[Updated on: Thu, 07 February 2013 02:44] by Moderator

Re: New feature: new drug system[message #315259] Thu, 07 February 2013 21:53 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
There was a code error that caused the regeneration effect to end prematurely. I corrected it in the trunk (r5853).

That the drug effect for regeneration has no entries is fully intended, as th regeneration drug effect has always been treated very different from other effects. You do not need to change values there. However I realise that this can cause all kinds of confusion, and its likely that I will soon change the internal handling.


Re: New feature: new drug system[message #315392] Wed, 13 February 2013 21:39 Go to previous messageGo to next message
Slax

 
Messages:1448
Registered:July 2006
Location: People riding polar bears...
Currently running the AFS preview but I've had this happen in other mods as well.
AP boosting drugs (drinks) tend to screw up AP costs for readying and firing weapons. Something like doubling every cost. Completely game breaking.

Re: New feature: new drug system[message #315393] Wed, 13 February 2013 21:41 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
That is vanilla AP drug behaviour. Always been so.


Re: New feature: new drug system[message #315394] Wed, 13 February 2013 22:05 Go to previous messageGo to next message
JAsmine

 
Messages:315
Registered:May 2011
Those AP-increasing drinks are just meant to allow you to move around more. Weapon manipulation costs more AP so that you cannot operate your gun more often than usual.

Re: New feature: new drug system[message #315395] Wed, 13 February 2013 22:19 Go to previous messageGo to next message
Slax

 
Messages:1448
Registered:July 2006
Location: People riding polar bears...
Hm. Well that kinda sucks.

Re: New feature: new drug system[message #316094] Sat, 09 March 2013 04:20 Go to previous messageGo to next message
Zombiehunter

 
Messages:185
Registered:March 2011
Location: Franconia, Germany
For this feature I will quote Randy Marsh at the Medicinal Marijuana Store:
"Woohoo, all right! I love the future! Let's see uh, I'll take half a pound of that uhhh Jamaican Passion and give me some of that purplish stuff too!"

But I also got a request:
"What do we want?
"Bigger doors!"
"Where do we want them?"
"Weed stores!"

:placard:
Re: New feature: new drug system[message #316138] Sun, 10 March 2013 18:38 Go to previous messageGo to next message
Nixou

 
Messages:51
Registered:January 2008
Location: France
Slax
Hm. Well that kinda sucks.


Actually it's rather realistic IMO.

As described in the original JA2 manual, some actions will take the same time, nomatter who does it.


For example pressing the trigger, fire mechanism and bullet travel won't go faster even if it was performed by God himself.





(So if the merc is given more AP as consequence of drugs/health, then those invariable time mechanics should take accordingly more points to perform, in the same proportion, to reflect that they take as much time to perform as they did before)

[Updated on: Sun, 10 March 2013 18:41] by Moderator

Re: New feature: new drug system[message #316382] Tue, 19 March 2013 23:08 Go to previous messageGo to next message
grim

 
Messages:336
Registered:July 2006
Location: France
About energy drugs, i am having great difficulties using them with any efficiency.
My mercs get action points up to 100, but no more, even when they have more whithout the drug: APs are capped to 100
However, (as someone said), any action exept movement cost a lot more. So in the end, i can do less things with the drug than without!
Finally, the stamina bar degrades immidiately after taking the drug, and a lot! I end up either unconscious (very fast, without doing anything), or using all my APs drinking one or two full canteens, just to stay awake.

I don't see the point of using them, and they seem "kind of" broken. In the original game, i remember using them with efficiency, they seemed to give a boost to a merc, what i don't feel now. I don't know if something can be done about it (removing the 100AP cap, delaying the stamina drop...?).
Re: New feature: new drug system[message #316419] Wed, 20 March 2013 22:10 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Indeed - due to a mistake, APs were capped at 100 if one didn't take 2 specific drugs at once. Fixed in r5942.

Concerning the stamina effect: Did you take the barrage drug by chance? It has the DRUG_KNOCKOUT-effect, which causes a heart-attack after a while - which is simulated by a huge drop of energy.


Re: New feature: new drug system[message #316421] Wed, 20 March 2013 22:43 Go to previous messageGo to next message
grim

 
Messages:336
Registered:July 2006
Location: France
I was not very accurate, my apologies. I used the item "Energy Booster", the original syringue type drug. It doesn't concern specifically your addition Flugente, but i was answering to previous posts about this problem.
I have not tested your new drugs yet.
Re: New feature: new drug system[message #316544] Mon, 25 March 2013 17:00 Go to previous messageGo to next message
PasHancock

 
Messages:737
Registered:February 2011
Location: Estonia,Tallinn
Hey, maybe you can try making a new feature, where Merc can Inject a Drug on another Merc? so for example if my Merc is dying and i dont have a Health kit but i have Regen booster, i could inject it on my Dying buddy?

Or even possibly make new Drug that is Poison? you know like in Hitman, you inject it and Enemy Dies, or Drug that makes you lose consciousness ( fall aslee, like Dart )


EDIT: I can TRY making or at least finding a Syringe Icon for injection, if you will make this Feature :O`

Also, Success or Fail of injection depends on Med skill

[Updated on: Mon, 25 March 2013 17:02] by Moderator

Re: New feature: new drug system[message #316551] Mon, 25 March 2013 19:48 Go to previous messageGo to next message
Thor

 
Messages:432
Registered:February 2007
Location: Belgium
Splendid idea!
Re: New feature: new drug system[message #316552] Mon, 25 March 2013 20:30 Go to previous messageGo to next message
grim

 
Messages:336
Registered:July 2006
Location: France
Drug Injection would be nice, indeed.
I'd love to use it on fallen mercs (due to stamina or health drop), and it would be a great way to use poisons on ennemies.
The field medic could have a full role using syrings.
Re: New feature: new drug system[message #316562] Tue, 26 March 2013 00:30 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
I don't do things half-assed. What we really want is the ability to apply drugs, canteens and gasmasks to other soldiers (not ammo, as that would be an exploit). For that, I need from you
  • a proper animation, as I don't do those.
  • a cursor animations, as I dislike doing those.


Re: New feature: new drug system[message #316575] Tue, 26 March 2013 03:32 Go to previous messageGo to next message
Thor

 
Messages:432
Registered:February 2007
Location: Belgium
Now we're getting somewhere! Do we need one universal cursor to apply all these items or one for a canteen, one for a syringe, one for a gasmask... Maybe there are others?
The idea is to keep it restricted to stuff you need urgently in emergency situations, right?

Guess it won't be such a disaster when other mods use bottles or cans to drink and there's a canteen cursor, but I believe other mods have drugs in other forms... Smile
Re: New feature: new drug system[message #316577] Tue, 26 March 2013 03:42 Go to previous messageGo to next message
Sam Hotte

 
Messages:2011
Registered:March 2009
Location: Middle of Germany
For applying syringe and canteen IMHO the bandaging cursor would do (it's also some kind of first aid we're doing here); putting a gas mask should look different, tho.
Re: New feature: new drug system[message #316593] Tue, 26 March 2013 16:50 Go to previous messageGo to next message
PasHancock

 
Messages:737
Registered:February 2011
Location: Estonia,Tallinn
Flugente
I don't do things half-assed. What we really want is the ability to apply drugs, canteens and gasmasks to other soldiers (not ammo, as that would be an exploit). For that, I need from you
  • a proper animation, as I don't do those.
  • a cursor animations, as I dislike doing those.


The problem is, i dont do animations anymore + it takes alot of time, each Bodytype and Crouch + Standing position and i still dont have much time as i had before...You can use "Picking up" animation for injections

I can get a cursor tho
Re: New feature: new drug system[message #316594] Tue, 26 March 2013 16:56 Go to previous messageGo to next message
PasHancock

 
Messages:737
Registered:February 2011
Location: Estonia,Tallinn
found this

http://img854.imageshack.us/img854/2894/spritzered.gif
Re: New feature: new drug system[message #316602] Tue, 26 March 2013 20:00 Go to previous messageGo to next message
Thor

 
Messages:432
Registered:February 2007
Location: Belgium
Quote:
For applying syringe and canteen IMHO the bandaging cursor would do (it's also some kind of first aid we're doing here); putting a gas mask should look different, tho.


Partially agree with you, Sam_Hotte. We could use a blue cross for a canteen (water) and a green or purple cross for applying all sorts of drugs, right?



Re: New feature: new drug system[message #316605] Tue, 26 March 2013 21:19 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Adding new cursors is relatively messy codewise. And unnecessary - I need only one cursor, because I made one system that allows to apply items to other people. This works with canteens (I disallow other food), drugs, clothes, gasmasks, bombs :devilaugh: . More is possible, but I forbid it balancing-wise.


Re: New feature: new drug system[message #316606] Tue, 26 March 2013 21:43 Go to previous messageGo to next message
Thor

 
Messages:432
Registered:February 2007
Location: Belgium
Any suggestions, Flugente? Just extracted the cursors, so I can make one based on those... For instance, I can make a variant to the hand or cross cursor? Like in a different color? Or something entirely different...

Any inspiration?

[Updated on: Tue, 26 March 2013 21:47] by Moderator

Re: New feature: new drug system[message #316607] Tue, 26 March 2013 21:48 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
As we apply stuff on other people, a hand that 'puts' something would be good.

This will also be possible against enemies, so make it ambigious Smile

This also needs a red variant of course.


Re: New feature: new drug system[message #316608] Tue, 26 March 2013 21:52 Go to previous messageGo to next message
Thor

 
Messages:432
Registered:February 2007
Location: Belgium
Alright, I was thinking in that direction... Wink
Re: New feature: new drug system[message #316610] Wed, 27 March 2013 01:55 Go to previous messageGo to next message
Thor

 
Messages:432
Registered:February 2007
Location: Belgium
Here you have an animation. It's based on the hand cursor, the one used to pick up items and to open doors. (That's how I have tested it in-game.)
However, the images are in a different order and in a different direction, and there is also a different movement. Apart from that I added a small green cross to explicitly refer to an addition "+", as the animation is not used to take objects, but to add/apply objects to somebody. The green is in contrast to the red healing cross as this animation can be used for all kinds of drugs, supplements, poison, etc.

http://www.filefactory.com/file/8z9irprj4e5/n/APPLY_zip

EDIT: As it is the case for several animations, I suggest to use the red colorful variant for the action and the colorless for non-action (cf. the other hand cursor, the fist, etc.).

[Updated on: Wed, 27 March 2013 02:06] by Moderator

Re: New feature: new drug system[message #316612] Wed, 27 March 2013 03:06 Go to previous messageGo to next message
Slax

 
Messages:1448
Registered:July 2006
Location: People riding polar bears...
Why not just use the first-aid cursor?

Re: New feature: new drug system[message #316625] Wed, 27 March 2013 20:54 Go to previous messageGo to previous message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Hmm. I cannot download any file there - it says the file has never been uploaded (?).


Previous Topic: New feature: Administration assignment
Next Topic: New Feature: militia volunteer pool
Goto Forum:
  


Current Time: Tue Jul 23 08:17:48 EEST 2019

Total time taken to generate the page: 0.01446 seconds