JoSchaap / GoT_Wasteland_V2.Stratis

WARNING! This repo is no longer updated, find the updated version on the A3Wasteland git! -
http://www.a3wasteland.com
11 stars 20 forks source link

Added Inventory System + Spawn Beacons #73

Closed MercyfulFate closed 11 years ago

MercyfulFate commented 11 years ago

Tonnes of stuff added. Ive added a "#define DEBUG true" in "\init.sqf" that should be set to false in production. When true all the functions compiled using mf_compile will be dynamically compiled each call (great for testing) When false, the functions will be compiled using compileFinal.

Note the mf_player_actions found at "client\actions\". I'll be making more changes soon.

Theres more coming, but it all seems to be working. If not, let me know and ill fix it up.

MercyfulFate commented 11 years ago

As its a big changeset ill add some information here.

mf_notify_player @ "\clientt\functions\notifyClient.sqf"
Have a look at this as its a critical part. it. it basically uses setTitleText to display the current action status. It calls setTitleText every 0.1 second so that it doesn't fade in, which would be bad when i do the " deploying xx% complete" stuff. if you know a faster/better way to do this, feel free to change it/let me know.
mf_util_playUntil @ "\client\functions\playUntil.sqf"
This is what i use when something requires a duration, such as refueling a vehicle or deploying a spawn beacon. it takes a animation, a duration, and some code that is run (every 0.25 secs, but configurable) that determines whether to continue or fail. "\clients\items\jerrycan\refill.sqf" is an example. I've used it quite a bit to reduce repeated code.
mf_inventory_create @ "client\functions\inventory\create.sqf"
Creates (aka Defines) a new item. requires quite a few options. in each item is defined in its init.sqf file ("\clients\items\jerrycan\init.sqf) for examples.
mf_inventory_add/remove @ "client\functions\inventory(add|remove).sqf"
Adds or removes x number of items. this is how you control the qty of items the player has.
mf_inventory_use @ "clients\functions\inventory\use.sqf"
This is usually the action the item does (refuel a vehicle, deploy a spawn beacon\eat food). This function needs to return a true|false value. if true 1x item will be removed automatically.
Thats most of the changes atm. Theres still a bug with the maximum number of jerrycans (as they are not independent) but i wanted your input before i fixed it. Should it stay a qty based system, or should i move to a weight based system?
JoSchaap commented 11 years ago

thanks for the info. i had a family weekend so i will respond to this later! :)

JoSchaap commented 11 years ago

I have to figure out a way to 'partially' merge this for testing, atm it breaks the streamfriendly groupmanagement i added last week :)

make sure you declare and initialize each variable you use or DEVbranch will spaz out about it making the game un enjoyable for players

JoSchaap commented 11 years ago

also quantity seems ok :)

max 1 fuelcan max 2 repairkits max 3 food max 3 water max 1 improv roof (previously camonet)

JoSchaap commented 11 years ago

ok i was about to merge this but im stuck on a few things.

1 - where did the repairkits go? 2 - is it posible to disable the medkits and spawnbeacons? 3 - Am i correct that you use Land_SuitCase_F for multiple things? (medkit, repairkit, spawnbeacon) 4 - I cant figure out where the items are defined so i can re-add the icons i had added to the action menu :)

aside above points it really looks good :)

MercyfulFate commented 11 years ago

Repair kits arn't implemented yet. I've got a branch with a few bugs then its good to go. (I just wanted to get this main pull release out of the way so i dont have to worry about it).

All items that I have migrated/created are in "clients\items" folder. to disable on, just comment out the "xxx" call mf_init; in "clients\items\init.sqf"

Yes i have used Land_SuitCase_F for multiple things, as I cant mind read what you wanted them to be (and there isn't a great selection). however there is a difference between dropping and deploying with things like the spawn beacon so i didn't think it would be that much of an issue.

You can change the "ground object" by modifing the call to "mf_inventory_create" in the items "init.sqf" file. eg. "clients\items\beacon\init.sqf". you can also change the icon there too (it changes the icon for the "take xxxx" action).

if you want to actually chat about it we can skype/TS

MercyfulFate commented 11 years ago

oh, and atm the spawnbeacon is "Land_FirePlace_F" or something like that. I created a value in the spawn beacon's init.sqf called MF_ITEMS_SPAWN_BEACON_DEPLOYED_TYPE which you can modify to change that to what ever you want. you can also change the steal and pack duration.

To deploy a spawn beacon, you need to: 1) buy one (not implemented). 2) deploy (open inventory and click "use") 3) repawn as much as you want! 4.a) pack up a friendly spawn beacon (action provided) 4.b) steal a enemy spawn beacon (action provided)

JoSchaap commented 11 years ago

thanks for the explaination :) I might have a go at it later tonight :+1:

MercyfulFate commented 11 years ago

okay, cool. let me know if you want to skype or TS, I find that the fastest way of resolving issues.

I know the code is quite foreign, but its all consistent and i set it up that way to reduce the copy-paste code. The inventory system is really quite easy to add/change items once you know what its doing.

MercyfulFate commented 11 years ago

I've got the repair kit ready to go. Did you want the camo net as an item, or as a R3F_Log object?

JoSchaap commented 11 years ago

camonet (Improvised roof in arma3) is an inventory item, you can 'pack/study' them when you are near them making them despawn and an item is added to your inventory (max 1) http://www.antihelios.de/EK/Arma/images/Land_cargo_addon02_V2_F.jpg

MercyfulFate commented 11 years ago

Alright, Thats easy to add. Any other inventory items you want while im at it?

JoSchaap commented 11 years ago

I need to have a look into the editor to find a suitable item for the vehicle re-supply box. so for now its all good :) could you re-fork the test branch? because this one undoes some of my work, if not ill have to create a 'after-merge' patch

did you test this on DEV branch yet? as DEV branch reveals alot of minor (non critical) coding errors nowadays

MercyfulFate commented 11 years ago

ah, ok. No I haven't tested on dev. Will do. Hating sqf these days.... just such a fking error prone language (and add syntax confusion from the 4 other languages i use every day doesn't help).

I'll re-fork, but off what branch?

MercyfulFate commented 11 years ago

While im re-forking are there any other changes needed?

JoSchaap commented 11 years ago

TEMP_TESTING_V23

the dev one just has the camo heli, tracked APC's and new weapons etc in it, i can easily re-build that

MercyfulFate commented 11 years ago

alright, camo net is almost complete. You happy with the inventory system in its current form?

JoSchaap commented 11 years ago

i havent merged it yet due to the missing repairkit and undoing latest changes :)

but code wise it seems logical, just need to get used to the changes on where to find stuff

MercyfulFate commented 11 years ago

seems like it was a straight forward rebase, no conflicts. Just testing in dev mode (not on dev branch though) and see if I can fix any issues. After that I'll merge in the new repair-kit and camonet. Atm a few things use the briefcase, but this is not the "deployed/unpacked" version of the object. its simply a token object people can drop and give to their friends (as well as what gets dropped when people die).