Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: interactive actions
New feature: interactive actions[message #346447] Tue, 02 August 2016 21:21 Go to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
The maps in our most beloved game are quite detailed. Modders put in quite an effort to make the place feel realistic. Houses have all kinds of furniture, with bathrooms and kitchens, there are bookshelves, computers and so on. Sadly, we can't really do anything with the stuff. All we can do is sometimes open structures to get hidden items, and open doors. That is okay, but... well... not that much.

This feature attempts to change that. The idea is simple: You rightclick with your mouse. As usual, your cursor will transform to 'force' an action. If you then hover over structures, they show you whether a special action is possible. Click on the structure, and the merc will do whatever is possible here.



The special trick is that which actions are possible where, and what they do, can be fully defined in xml and lua. I basically provide a base structure for this - what can happen where with what is up to the modders.

So far, the following actions exist:
  • Hacking - hack a computer
  • Read file - read the contents of bookshelves and file cabinets
  • Drink from a water tap - drinking from a water tap or sink restores breath and stills your thirst
  • Buy soda - buy a can of soda from a soda machine
  • play at arcade machines (added in r8346 & GameDir r2350)
I will go into more detail on these actions in the following posts.

The actions themselves are defined in the new xml TableData\Map\InteractiveActions.xml. You can find more details on what tags exist and how they work in there.
If you want something specific to happen on an interaction with a specific structure (for example, hacking a specific computer should give you a specific text), you can set a LUA Id. A lua script - HandleInteractiveActionResult() in Overhead.lua - will be called. You can then set whatever you want to happen in there as a result of the interaction. The stock script also contains quite a few detailed examples, so look for inspiration there.

The interesting thing is that you can define actions both very broadly and very precise. So you can set all structures of a tileset to yield result A, but not in sector X, where the result should be B. Apart from that one specific one, which should give you C. And so on and so on.
I've recently added a way for modders to store their own data. This is extremely useful for this feature - you can 'remember' what actions were already taken, and alter your results accordingly. For example, hacking a computer might yield you a few dollars - but of course only the first time. The stock script also uses this extensively, so look there for inspiration.

Keep in mind that the code only provides a base structure. What you do in LUA is up to you. If you want to be able to hack a tree to spawn tanks that recite Macbeth, you are free to do so.

This feature is fully savegame compatible.

This feature has been added to the trunk in r8278 & GameDir r2333. Using the new exe without the new GameDir will cause you to forever live in the twilight. You will walk the earth, neither dead or alive. Sorrow shall be your nourishment, regret being your only companion.

[Updated on: Sun, 11 December 2016 14:31]




You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346448 is a reply to message #346447] Tue, 02 August 2016 21:21 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Hacking

The first action I've added is hacking. When the cursor looks like this, you can hack something:
http://i.imgur.com/QiPrfk3.png
Note that this is a multi-turn-action. You will need several truns to finish this - in realtime this will happen instantly. Hacking requires skill, and for that there is a new background property:
Toggle Spoiler

Our hacking skill can be improved by a percentage multiplier that we can gain from items:
Toggle Spoiler

We only get bonus from one item per inventory, and the bonus is influenced linearly by item status. So if Ears has a hacking skill of 30 and a laptop with status 80 in his inventory, his skill will be 30 * (1 + 0.5 * 0.8) = 42.
As a result, only people with the hacking skill can hack computers. Per default, the following mercs have gained this ability:




  • Barry (10)
  • Gumpy (60)
  • Fredo (50)
  • Speck (80)
  • Sparky (20)
  • Ears (30)



I am open to give this ability to more people, but I am not inclined to give it to any top-mercs. I see none that would fit, honestly. besides, hacking isn't strictly required for the game - though I added a few rather nice boni if you do so.
Speaking if adding stuff - I've identified 42 computers in the stock maps, and have added unique events for all of them in HandleInteractiveActionResult() in Overhead.lua. Yes, that took me quite a while. So hacking will always provide some result - on some computers, just a bit of 'lore'-building (for example, hacking a computer in Orta might give you more info on the rocket rifles). Other computers allow you to get info on enemy personnel, or even allow you to earn money.
As each action can have an unique diffulty level, some hackers might only be able to hack some computers. Speck can hack into things Barry has no chance of breaching.

Keep in mind that you can define in the xml what can be hacked an what can't. It's reasonable to apply this to computers, but it you want to hack a tree - that's only a xml change away.

Read file

http://i.imgur.com/nuz3OaN.png

Similar to hacking, the idea is to 'read' books from a book shelf, or or files from a file cabinet. I've added a few examples, but haven't provided an unique event for each of them. Given the number of book shelves in Arulco, I wanted to rather finish the feature this month :-)

Our reading skill is our wisdom stat.

Drink from a water tap

http://i.imgur.com/GDlS7lQ.png

Allows 'drinking' from a structure. You will regain breath. If food feature is turned on, you can gain drink points. If disease is on and the sector's water is poisoned, you have a chance to get a disease.
Of course you can define this action on toilets, too aww.

Robots and vehicles have a water drinking skill of 0. Anybody else has 100 - we are pros at drinking water.

Buy soda

http://i.imgur.com/iPPotCs.png

As demonstrated by Ivan in the video - you insert money, and get a soda can.
Note that the soda you get will be the first item with the new 'SODA'-flag, which is <ItemFlag>134217728</ItemFlag>.

We are also pros at buying soda, unless our war chest doesn't cover the measly $3 required for it. That would be quite embarassing.

Play a minigame

http://i.imgur.com/vF4mjfY.png

Another feature added in r8346 & GameDir r2350 allows you to play at arcade machines. So far only Tetris. Perhaps this might change in the future?

Of course, many many more actions are thinkable - depending on what you think of (and whether people are actually willing to draw the cursors and find sounds instead of making me do all the work and then whining about the bad art), I might add more.

[Updated on: Sun, 11 December 2016 14:30]




You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346449 is a reply to message #346448] Tue, 02 August 2016 21:53 Go to previous messageGo to next message
edmortimer

 
Messages:1213
Registered:January 2015
Location: Home Free
VERY, VERY COOL!




Arulco Vacations Blog

Arulco Vacations Bears Pit Forum


Re: New feature: interactive actions[message #346451 is a reply to message #346449] Tue, 02 August 2016 22:07 Go to previous messageGo to next message
ratpaz

 
Messages:137
Registered:April 2015
Location: Italy
Love it, this will bring the game to a new level
Re: New feature: interactive actions[message #346452 is a reply to message #346451] Wed, 03 August 2016 00:55 Go to previous messageGo to next message
Kerghnox
Messages:3
Registered:August 2016
Can hacking be used to find generals?
Re: New feature: interactive actions[message #346453 is a reply to message #346452] Wed, 03 August 2016 02:15 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
You can use the LUA script to give info on enemy troops or indeed generals as a result of hacking.
Toggle Spoiler



You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346454 is a reply to message #346453] Wed, 03 August 2016 07:37 Go to previous messageGo to next message
SchmittLenin

 
Messages:30
Registered:August 2015
Excellent job as always. Can't wait to add an "Unleash army of Termina... I mean, uh, totally generic and free of copyright doombots" option on the royal palace computers.

Question : Would it be possible to make SAM sites hackable? Would be nice to be able to enter the place with the covert ops trait to activate some auto-destruction sequence (Deidranna's basically a Bond villain by now so why not?) or just shot down the thing for a while



Lurking is nice
Re: New feature: interactive actions[message #346455 is a reply to message #346454] Wed, 03 August 2016 13:33 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
The SAM control computers can be hacked too. At the moment your merc will basically tell you that they have no idea how the controls work, so they'd rather not touch anything. I do, however, plan to alter that a bit... the idea would be that hacking would lower the effectivity of a SAM until it is 'rebooted' (either by the army, via ASD, or by your mercs). That woudl require a few new variables and a svegame change though, not sure when I'll have time for that.

As to blowing it up - you can already do that. If you destroy the SAM control computer, the SAM will stop working (that is actually a vanilla mechanism).

@all: modders, like edmortimer, might want to take a closer look at the lua function in Overhead.lua. Some of the hack results are possible threads of possible quests one can think of. For example, one computer in Alma prison would give you 'video evidence' of prison torture. The idea is that if we give that evidence to, say, the UN, and we've retrieved it in secret, the UN would sanction the regime, giving us some boni (this basically ties into the 'outside organisations' idea I had).
Another quest would be intercepting an army intelligence server - one of the computers inn Alma HQ gives you a list of 'notable rebels', and what the army knows of them. This can be used for lore, and a possible new quest (by hinting that one of the 'other' rebels referred to in those files was a traitor - hack a computer in Meduna to find out more).
Or we could simply retrieve a possible list of people secretly working with the queen to extort them. Same for Kingpin.

Just food for thought.



You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346461 is a reply to message #346455] Wed, 03 August 2016 21:21 Go to previous messageGo to next message
Elvis_A

 
Messages:275
Registered:December 2012
Location: exUSSR
wow. nice!

Please add hacking bonus to Spies. Elroy will be glad. Also is it possible to add opening doors (that require key cards) via hacking?
Re: New feature: interactive actions[message #346463 is a reply to message #346461] Thu, 04 August 2016 00:53 Go to previous messageGo to next message
Slax

 
Messages:1448
Registered:July 2006
Location: People riding polar bears...
Was fully expecting some urinal drinking from the video. cheeky



1.13: Install JA2, unpack latest, play.
AIMNAS: Complete 1.13 installation, Download ZIP and unpack, play.

Re: New feature: interactive actions[message #346466 is a reply to message #346455] Thu, 04 August 2016 06:17 Go to previous messageGo to next message
SchmittLenin

 
Messages:30
Registered:August 2015
I know but I like the idea of hacking the thing into blowing up the whole site (Maybe it could make it completely unusable forever as a twist, forcing you to use manpads to bring the army's helicopters down during the late game...)

Would make it easier than outright blowing it up with a spy though, unless hacking is considered a suspicious action...

By the way, does the Tech Whiz trait allow one to hack stuff? I feel like it should...



Lurking is nice
Re: New feature: interactive actions[message #346495 is a reply to message #346466] Fri, 05 August 2016 21:52 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Hacking is given to those people where some affinity to computer-related shenanigans can at least be justified. I don't see why someone good at impersonating people should be a hacker. You can always alter backgounds the way you like, anyway.

Opening doors is theoretically doable, but I don't know whether there is a lua function for that (afaik, there is no documentation of what lua functions exist, and what the existing functions do, anyway).

@Slax: well... I do have some ideas for some easter eggs, but nothing so simple. Have to see...

Well, yes, that background could use hacking. Then again, the backgrounds could all use some reworks. Some have way too many properties for more liking.

Need more time.



You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346505 is a reply to message #346495] Sat, 06 August 2016 14:04 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
Unfortunately the game (VS2010 debug exe) crashes with an assertion while reading InteractiveActions.xml.

http://picload.org/image/rrlcrloc/assertion.png

To me it looks like the same issue we had with the new drug system which I fixed in r8005. Care to take a look?

Here is the call stack just in case:
Toggle Spoiler



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: New feature: interactive actions[message #346563 is a reply to message #346505] Wed, 10 August 2016 01:42 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Urgs. I'll see to it tomorrow or so.



You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346570 is a reply to message #346563] Wed, 10 August 2016 20:57 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Should be fixed with r8282, could you test again?



You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346574 is a reply to message #346570] Wed, 10 August 2016 22:21 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
Unfortunately it still crashes with the same error message.

Stack trace:
Toggle Spoiler


Sorry, I'm no developer so I won't be of much help. The code crashes when trying to run tileindexvector.clear( ) inside pData->curArray[pData->curIndex].reset( ).
clear( ) runs function erase( ) which uses begin and end of a vector. The vector isn't initialized yet so begin and end are invalid pointers which causes function erase( ) to crash. At least that is how it looks to me.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: New feature: interactive actions[message #346578 is a reply to message #346574] Thu, 11 August 2016 01:13 Go to previous messageGo to next message
Flugente

 
Messages:3461
Registered:April 2009
Location: Germany
Hmpf. Try r8283 then. That behaviour of VS2010 crashing while VS2013 doesn't complain even if all possible exceptions are thrown irks me to no small amount.



You gotta wash your hands before picking up a baby. They can see the bacteria burning into their flesh.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: interactive actions[message #346582 is a reply to message #346578] Thu, 11 August 2016 08:44 Go to previous messageGo to next message
Julix

 
Messages:94
Registered:June 2010
Location: Germany

Just came here to say "Very very cool!" happy - as usual, Flugente, always building awesome stuff!
Re: New feature: interactive actions[message #346590 is a reply to message #346578] Thu, 11 August 2016 16:34 Go to previous messageGo to next message
silversurfer

 
Messages:2601
Registered:May 2009
Flugente wrote on Thu, 11 August 2016 00:13
Hmpf. Try r8283 then. That behaviour of VS2010 crashing while VS2013 doesn't complain even if all possible exceptions are thrown irks me to no small amount.

Unfortunately r8283 didn't fix it but I was able to fix it myself now. VS2010 debug builds don't like it if you try to assign empty vectors. So now we first check if the vector actually has content and only then we assign it. It's somewhat like the NULL pointers that can happily crash the code as well. big grin



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: New feature: interactive actions[message #357456 is a reply to message #346590] Wed, 29 May 2019 19:49 Go to previous message
netrunner

 
Messages:14
Registered:March 2019
I like this feature very much and was trying to expand a bit by doing interactive stoves but I was unable to find how to create and delete an item from the mercs inventory, my idea was to create a interactive stove where you can cook so the food could give you a bit more morale than the usual.
Previous Topic: New feature: sector fortifications
Next Topic: New feature: Take prisoners, interrogate them
Goto Forum:
  


Current Time: Thu Sep 19 18:08:46 EEST 2019

Total time taken to generate the page: 0.01188 seconds