Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dogtags #3962

Merged
merged 27 commits into from
Jun 29, 2016
Merged

Dogtags #3962

merged 27 commits into from
Jun 29, 2016

Conversation

nicolasbadano
Copy link
Contributor

@nicolasbadano nicolasbadano commented Jun 20, 2016

When merged this pull request will:

  • Merge PR Dogtags #3600 to a dogtag branch in our repo
  • Restyle the dogtags
  • Add unique service number and blood types to all dogtags

20160620145016_1

I think this is ready for 3.6.0. Improvements can be pushed for later, given they wouldn't interfere (there's no public API yet).

Proposed by @jonpas :

  • Change the dog tag items to magazines and use their unique ID as identifier

I'm been thinking about the proposal, and although it's easy to implement. However, I think it's not needed for first release.

@nicolasbadano nicolasbadano added the kind/feature Release Notes: **ADDED:** label Jun 20, 2016
str(floor random 9) + str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + "-" +
str(floor random 9) + str(floor random 9) + str(floor random 9),
selectRandom ["O POS", "O NEG", "A POS", "A NEG", "B POS", "B NEG",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tab :)

@commy2
Copy link
Contributor

commy2 commented Jun 20, 2016

Im bringing up a silly idea again I had back in AGM.
Why don't we dynamically create the blood types using the player name or steam ui or something like that.
It would mean that these blood types are consistent from mission to mission.

@nicolasbadano
Copy link
Contributor Author

Incoming

@kymckay
Copy link
Member

kymckay commented Jun 20, 2016

I don't think that's silly, I like it 👍

I'd probably do a parseNumber on the getPlayerUID (ID64) and then wrap around the array of types like so: _arr = [blablabla]; _arr select ((parseNumber (getPlayerUID _target)) % (count _arr))

@@ -19,13 +19,24 @@ private _dogTagData = _target getVariable QGVAR(dogtagData);
if (!isNil "_dogTagData") exitWith {_dogTagData};

// Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type
private ["_bloodTypeIndex", "_code"];
//hint getplayeruid _target;
if ((typename getplayeruid _target) == "SCALAR") then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will never be true, also not using isEqualType 😝

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't it work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point of this.

Copy link
Member

@kymckay kymckay Jun 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPlayerUID always returns a string

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPlayerUID is the correct case. As far as I can tell it will always report a string, so it will never be typeOf SCALAR

@commy2
Copy link
Contributor

commy2 commented Jun 20, 2016

Incoming

I think I was faster, haha

NVM I'm stupid

nicolasbadano and others added 2 commits June 20, 2016 17:04
Store object instead of bool to indicate when dogtags have been taken
When object respawns, the the old object reference won't apply (defacto
reset)
@nicolasbadano
Copy link
Contributor Author

getPlayerUID doen't work for this, because it returns "" for dead players. I'll switch to something inspired on @commy2 's code

_code = (str getplayeruid _target) select [0, 3] + "-" +
(str getplayeruid _target) select [3, 2] + "-" +
(str getplayeruid _target) select [5, 3];
if !(getplayeruid _target in ["", "_SP_AI_", "_SP_PLAYER_"]) then {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but it would probably make sense to store the value of getPlayerUID in a variable instead of using the command multiple times (also the lack of camel case triggers me 🐫)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise 👍

Fix issue with dogtag respawn/setVariable
…to dogtags

# Conflicts:
#	addons/dogtags/functions/fnc_getDogtagData.sqf
@nicolasbadano
Copy link
Contributor Author

Actually, I just merged @commy2 's PR. The service number is not persistent anymore, but that can be improved in the future.

@kymckay
Copy link
Member

kymckay commented Jun 20, 2016

Service number could be made persistent using:

_nums = ((toArray _name) select [0,8]) apply { _x % 10 };

while {count _nums < 8} do {
    _nums pushBack (floor random 10);
};

Then just split as necessary. I'm not familiar with the format of service numbers, so not sure if the floor random 9 in the existing code was an oversight or if they only use 0-8.

Only semi-persistent for names shorter than 8 characters long (suppose you could loop around or something if you wanted true persistence for those also).

@nicolasbadano
Copy link
Contributor Author

@SilentSpike, they totally go from 0 to 8

@nicolasbadano
Copy link
Contributor Author

Ok guys, do you think this should be in 3.6.0?

👍 👎

@kymckay
Copy link
Member

kymckay commented Jun 20, 2016

Functional (presumably) version of above snippet:

_nums = ((toArray _name) select [0,8]) apply { _x % 10 };

while {count _nums < 8} do {
    _nums pushBack (floor random 10);
};

_code = ([_nums select [0,3],_nums select [3,2], _nums select [5,3]] apply { _x joinString "" }) joinString "-";

@thojkooi
Copy link
Contributor

Blood type? I'm not so sure about that.

@nicolasbadano
Copy link
Contributor Author

Blood type? I'm not so sure about that.

I guess you may argue that we shouldn't give players different blood types if we don't simulate blood compatibility in medical. But you might as well say we do, only that blood bags contain O Negative blood, which is close to universally compatible.

Anyway, I just wanted dogtags to look as genuine as possible, and they usually do feature blood types on them. I could randomize religion instead, but that sounds even more controversial.

@jonpas
Copy link
Member

jonpas commented Jun 20, 2016

I like blood type, religion is kinda meh unless we put "Jedi" on all of them (I'd argue that's a good idea actually!).

@nicolasbadano
Copy link
Contributor Author

OC I was joking about religion, mostly because I don't want to have to deal with tickets complaining about Al'Qaedan Jews and Chinese Quakers. And oc Klingon Jedis would create complains too.

@654wak654
Copy link
Contributor

654wak654 commented Jun 21, 2016

About getPlayerUID returning an empty string on dead bodies, couldn't you go around that by generating the blood type before a player dies? It only has to be done once ever anyway. Could even put it in a profile var and let people play around with it.

And for anything else could always fallback to _name.

@kripto202
Copy link

is it possible where you can look up the dog tags when they are in body bags?

@jonpas
Copy link
Member

jonpas commented Jun 21, 2016

I support @kripto202 's idea, should be straightfoward implementation with ace_placedInBodyBag.

@kymckay
Copy link
Member

kymckay commented Jun 21, 2016

couldn't you go around that by generating the blood type before a player dies?

This is true, we could use an XEH PostInit or something, however the way it's done now means that code doesn't run unless it needs to. You could go a whole mission without anybody checking dogtags.

kymckay added 2 commits June 21, 2016 18:42
Similar to how we're handling blood types, uses the unit's name to generate a valid three/two/four format SSN.

For names less than 9 characters long this will currently generate a unique SSN only up to the length of the name and append valid digits as necessary.
Names shorter than the required 9 characters are now reused until we have 9 characters - making for fully unique generation.

To keep things distributed as pleasantly as possible they're itterated over with a step of two - alternating between odd and even indexes every full loop.

Similarly, the slice of string used for names longer than 9 characters is now offset based on the length of the name.
Generate SSN of unit from their name
Add dogtag actions to body bags
@nicolasbadano nicolasbadano added this to the 3.6.0 milestone Jun 23, 2016
@commy2 commy2 modified the milestones: 3.7.0, 3.6.0 Jun 27, 2016
@thojkooi thojkooi merged commit cd08e00 into master Jun 29, 2016
@thojkooi thojkooi deleted the dogtags branch June 29, 2016 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants