Jump to content

!unflip [revised]


=VG= XOR

Recommended Posts

[EDIT]: Figured i might as well update  & give this post a final look through before i forget about it, Feel free to use this if/when/how/as you see fit... 

Quote

To me, modding is as much a part of experiencing video games as is playing them, hence why I've authored quiet a few of these types of posts. To give those of you who play this particular Mod you so enjoy, a different perspective than just that of players, with the hopes of dissuading you of A common misconception in the world of online gaming, the idea that the only  game you can play is the one in the title.  Cheers.

 !unflip flips any vehicle into neutral pitch & roll and drops it from 2m higher, for use if vehicle flipped/stuck.

Quote

ONLY AVAILABLE TO COMBAT ENGINEERS when invoked as the driver or only person in a given vehicle because unlike logi's, they can actually be flown in, if need be and in crewman operated vehicles command can only be executed in the blind due to crew kit restrictions which makes command only usable for a brief window.

 

 

Add to mods\pr\python\game\__init__.py

import cmd_unflip
cmd_unflip.init()

And Copy attachment below to mods\pr\python\game

import bf2, host, time, re, ConfigParser, game.realityadmin as radmin, game.realityconstants as CONSTANTS, game.realitykits as rkits, game.realitycore as rcore

"""	!unflip flips vehicle into neutral pitch & roll.

ONLY AVAILABLE TO COMBAT ENGINEERS when invoked as the driver or only person in a given vehicle because unlike logi's, they can actually be flown in, if need be and in crewman operated vehicles command can only be executed in the blind due to crew kit restrictions which makes command only usable for a brief window. This way it's more accessible but not trivially so, as you still need crates which trans might lend a hand with to grab the kit which requires at least 3 people in a squad, which makes it only available to at least properly manned squads and not some 2man locked tank squad for instance. And a global use message is sent to allow admins to identify command spam, if that is ever an issue still. A fair compromise, no, and maybe a cogent reason to use the infrequently used kit.
"""

def init():
	host.registerHandler('ChatMessage', onChatMessage)

	
#_stripPrefix(): removes context prefixes from a chat lines and returns the trimmed chat line
def _stripPrefix(text):
	text = text.replace( "HUD_TEXT_CHAT_TEAM", "" )
	text = text.replace( "HUD_TEXT_CHAT_SQUAD", "" )
	text = text.replace( "HUD_CHAT_DEADPREFIX", "" )
	text = text.replace( "*\xA71DEAD\xA70*", "" )
	
	return text.strip()

def onChatMessage(playerID, msgText, channel, flags):
	p = bf2.playerManager.getPlayerByIndex(playerID)
	playerVehicle = bf2.objectManager.getRootParent(p.getVehicle())
	playerName = p.getName()
	playerTeam = p.getTeam()
	playerPos = playerVehicle.getPosition()
	playerRot = playerVehicle.getRotation()
	kit = p.getKit()
	playerKitName = kit.templateName
	playerKit = rkits.getKitTypeString(playerKitName)
	if rkits.getKitTypeString(playerKitName) not in ('engineer', ):	#if not combat engineer
		radmin.personalMessage("!" + str(command) + " may only be used by combat enginner as driver or lone occupant of vehicle", p)
		return
	"""
	command parse, If findall doesn't find a match, it will return an empty list []: resulting in 'IndexError: list index out of range' exception which causes gamecrash when rcon debug is enabled, this also prevents game init until player spawns.	*rationale for exception handling below*
	"""
	try:
		text = _stripPrefix(msgText)
		pattern = re.compile(r'!(\w*) ?(\S*) ?(.*)')
		matches = pattern.findall(text)
		command = matches[0][0]
		if matches[0][1] != "":			#parameter 1 if exists
			parameter1 = matches[0][1]
		else:
			parameter1 = None
		if parameter1 != None and matches[0][2] != "":			#parameter 2 if exists
			parameter2 = matches[0][2]
	except:
		return

	if text[0:1] == "!":	# unless the first character is ! don't do anything	
		if command == "unflip":
			if not p.isAlive():
				return
			if p.getDefaultVehicle() == p.getVehicle() :	#if player not inside vehicle
				return

			passengers = playerVehicle.getOccupyingPlayers()
			if len(passengers) == 0:
				return
			driver = passengers[0]
			# for passenger in rootVehicle.getOccupyingPlayers():
				# if passenger != player:
			
			if p == driver:
				playerVehicle.setPosition((playerPos[0], playerPos[1]+2, playerPos[2]))
				playerVehicle.setRotation((playerRot[0], playerRot[1]*0, playerRot[2]*0))
				radmin.globalMessage(str(playerName) + " used command !unflip [" + str(kit) + ","  + str(playerKitName) + "," + str(playerKit) + "]")
			else:
				radmin.personalMessage("!" + str(command) + " may only be used by combat enginner as driver or lone occupant of vehicle", p)

 

cmd_unflip.py

  • Like 1
  • Upvote 2
Link to comment
Share on other sites

I see no reason to restrict the use of this command beyond what it is right now.  A suggestion like this really belongs on the PR website forums as a proper suggestion post.

If any players are abusing in-game commands, you can feel free to use the !report function, or create a report here on our forums, and we'll take care of it.  Telling us we have "a certain someone" abusing this feature as if you are somehow protecting(?) this person's identity for any reason is akin to allowing evil persist while good men (you) do nothing.  If you have a problem, you can create a public report on our forums, or lodge a private report with Head Administrators such as myself, m823us, or MelonMuncher via private message.

 

edit:  there was a large misunderstanding where I had incorrectly assumed that Project Reality already had such a command.  We've since settled this misunderstanding.  :hi: 

  • Like 1
Link to comment
Share on other sites

1 hour ago, =VG= SemlerPDX said:

I see no reason to restrict the use of this command beyond what it is right now.  A suggestion like this really belongs on the PR website forums as a proper suggestion post.

If any players are abusing in-game commands, you can feel free to use the !report function, or create a report here on our forums, and we'll take care of it.  Telling us we have "a certain someone" abusing this feature as if you are somehow protecting(?) this person's identity for any reason is akin to allowing evil persist while good men (you) do nothing.  If you have a problem, you can create a public report on our forums, or lodge a private report with Head Administrators such as myself, m823us, or MelonMuncher via private message.

Oook, I either misspoke or you seriously misunderstood the function of this post. I'm not complaining about anyone or anything, it just happens vehicles flipping is a more frequent occurrence now, especially in world war 2 maps, a friend just 'suggested' an 'unflip' command due to frustration & I just figured why not & posted this here...

 

So yeah it's less an abused command & more a missing command, hence this post. Apologies if I misspoke 😟 yiykes.

 

Just to be clear once more, command isn't abused, it doesn't even exist & I'm not requesting it be restricted, more suggesting a new addition... Feel free to move it to suggestions if you'd please. My bad,I guess 🔫

  • Upvote 2
Link to comment
Share on other sites

Just my 2 cents, but unflipping vehicles adds a large 'arcade-y' factor to PR in my opinion. The point of the game is realism and no hand-holding, so part of being a driver is keeping your vehicle upright and actively avoiding getting stuck/flipping. In real life, there's no !unflip command if I turn my Toyota sunny side up either :P. If you flip a vehicle then tough titties, the vehicle is lost amd squad moves on foot. Project Reality.

 

Just my 2 cents, I'm not a fan of removing 'hazards' from this game since there aren't many to begin with.

  • Upvote 3
Link to comment
Share on other sites

5 minutes ago, =VG= Acro1 said:

Just my 2 cents, but unflipping vehicles adds a large 'arcade-y' factor to PR in my opinion. The point of the game is realism and no hand-holding, so part of being a driver is keeping your vehicle upright and actively avoiding getting stuck/flipping. In real life, there's no !unflip command if I turn my Toyota sunny side up either :P. If you flip a vehicle then tough titties, the vehicle is lost amd squad moves on foot. Project Reality.

 

Just my 2 cents, I'm not a fan of removing 'hazards' from this game since there aren't many to begin with.

Thats a good point. But when bugs occur or a tank flips to a hedge, that isn't so real life, and can be frustrating. Sometimes a vehicle will touch something so small and just yoink upside down, kinda annoying but yeah, not super common. I don't see how having the command at hand is such a pain, but, yano...not my decision to make anyways!

  • Upvote 1
Link to comment
Share on other sites

22 hours ago, X0R said:

Oook, I either misspoke or you seriously misunderstood the function of this post.

Well, turnabout is fair play - I think you misunderstand my post.  What is wrong with the current flip command?  Why should it change?  If you have an issue with a vehicle, you use the command, bing-bang-boom done.

FYSA, !flip is available to everyone.   edit: my bad, didn't realize PR did not have a vehicle flip command, confused this command with similar console commands for other games

Is this maybe an issue where this command has been disabled by the PR engine but persists in our Rights Management commands list?  Or is this a matter of you not knowing this command already exists to flip vehicles?  Or is there yet something larger that I'm just not grasping here?

Link to comment
Share on other sites

@=VG= Acro1 I agree with your premise but disagree with your logic, agree to disagree then.

@=VG= SemlerPDX I'm aware of flip, but it doesn't function as intended, if it ever functions which it rarely does, in short it doesn't, try it. Hence !unflip, again try both, and tell me what works & what doesn't.

*!flip is basically a dummy command in it's current state.

  • Upvote 1
Link to comment
Share on other sites

10 minutes ago, X0R said:

I'm aware of flip, but it doesn't function as intended, if it ever functions which it rarely does, in short it doesn't, try it. Hence !unflip, again try both, and tell me what works & what doesn't.

*!flip is basically a dummy command in it's current state.

In that case, I'd refer back to my original reply (since why should WE have the only functional flip (unflip) command in the PR community of servers out there?):
 

2 hours ago, =VG= SemlerPDX said:

A suggestion like this really belongs on the PR website forums as a proper suggestion post.

 

Link to comment
Share on other sites

If it is a stupid game thing (driving on a flat plane, two ground segments intersect and appear fine to a person, but flip a vehicle like a game does), then it makes sense and is likely WHY this command exists, with the Rights Management definable by the Server License Holder to control use or misuse of it.  Misuse might be an idiot driving over something a vehicle should not, and getting stuck - therefore using a command like this is almost cheaty and outside the spirit of a military simulation style game.

BUT it certainly should function as intended, and this is the first I've ever heard of the flip command not being sufficient for unflipping vehicles, let alone any abuse of flip that would lead us to want to restrict it beyond the current "everyone" default setting.

Games are games, and they can get gamey -- in Arma, we have other vehicles we can use or put on the server/mission to deal with such things.. mods or just scripted ... and also console commands -- PR doesn't quite have the leeway to do "whatever" like a sandbox to include immersive 'unflip' tool vehicles like a tow truck, helicopter sling/hook, and so there's that wall of what should be and what has to be to maintain functionality (even if it could also detract from the immersion or spirit of gameplay mode)

Link to comment
Share on other sites

On 11/9/2020 at 12:40 AM, =VG= SemlerPDX said:

In that case, I'd refer back to my original reply (since why should WE have the only functional flip (unflip) command in the PR community of servers out there?):
 

 

For the same reason that we as human beings aspire to be better in every aspect instead of settling for mediocrity that might have taken hold of others. .

 

ftr, this is !flip, a dang  rng

def commandFlip(args, p):
    m = ''
    if len(args) == 1:
        m = args[0]
        if not re.match('^\\d+$', m):
            personalMessage('This command takes only one integer argument.', p)
            return False
    else:
        m = 1
    coin = random.randint(0, int(m))
    personalMessage('Result: %s' % str(coin), p, True)
    return True
On 11/9/2020 at 12:46 AM, =VG= SemlerPDX said:

BUT it certainly should function as intended, and this is the first I've ever heard of the flip command not being sufficient for unflipping vehicles, let alone any abuse of flip that would lead us to want to restrict it beyond the current "everyone" default setting.

See above, it's the function in it's current state in the latest PR version.

  • Upvote 2
Link to comment
Share on other sites

I am not trying to shit all over your suggestion, brother!  Misunderstandings are just that - innocent attempts to assist or to redirect to an appropriate venue for maximum result.  Respectfully, we did not develop PR and I was under the impression that there WAS a command for unflipping vehicles, and that it was the 'flip' command noted.  The people who did develop the game are ALWAYS the best place to suggest such improvements, and if this is an issue that needs attention, I imagine plenty of people would support such a suggestion.  Since it is apparently not already a function on the PR server, feel free to discuss whether it should be included or not, again not trying to shut you down, but I do feel like you should bring this up with the folks who made the game.

  • Like 1
Link to comment
Share on other sites

26 minutes ago, X0R said:

For the same reason that we as human beings aspire to be better in every aspect instead of settling for mediocrity that might have taken hold of others. 

Once again, we do not currently run any scripts that make us any different than any other PR COOP server and we never have.  Maplist Randomizer is a cool feature, for if/when the server crashes or restarts (far less of a frequent thing these days than in past, thankfully) but essentially we are the same and have been the same as every other server except for our well trained Admins and how we direct players to play with regards to our rules, and general game flow (forcing COOP to more closely follow Deployment rules rather than a free-for-all of squadless blueberries, etc.).

Basically, we don't need gimmicks, and support overall the betterment of Project Reality itself as a whole.  (I mean, Xeno has even shared his Randomizer, not many were interested tho anyway... w/e)

Link to comment
Share on other sites

Updated thoughts & code in OP with feedback in mind before I distract myself with yet other shenanigans ;)

 

@=VG= Acro1 @=VG= Skitalez , let me know if I've swayed your positions, should you remain unmoved, we shall agree to disagree on this one, all said though thanks for the feedback, it was most welcome & appreciated. Have a good one.

  • Like 1
Link to comment
Share on other sites

@X0RI remain where I stand ;) Your code looks great, the functionality has it's use, but I consider 'flipping vehicles' a necessary hazard of the game. Deep ditches and steep terrain should be able to neutralize your vehicle like they do in real life. If everyone can unflip: YOLO'ing everywhere and even less care take of the vehicle, cuz "we'll just flip it". If only admins could do it: that's another frequent request they'd be bothered with all the time.

I like your idea about limiting to engineers, but I'm afraid it's easily circumvented and doesn't play nicely with the game:

  • 2-seater APC flips: driver takes engi and poof, vehicle good. Essentially 'always' has an engi on board.
  • Vehicle flips completely: Will likely go kaboom before an engi can be flown in or someone can switch to the kit.  If it survives: will likely be severely damaged.
  • Vehicle is stuck in ditch: command may place it in a position where it simply falls down again, and the almighty PR physics will likely send it to heaven instantly.
  • Vehicle is flipped on side on a sloped surface: Depending on the slope, it will likely tumble down again or get rocket-launched by almighty PR physics.

 

Considering this all too, my sentiment is pretty much the same as before: Un-flipping vehicles by command is too arcade-y and not realistic/hard enough for PR. You hit an obstacle and flip? Vehicle lost. You underestimated that gap in the road? Start walking. If anything, the 'flipping weakness' in vehicles illustrates that they should be cared for, not expended freely, and that adds to the realism aspect of the game. Vehicles are already getting dumped way more often than they should, and this would only add to that 'expendable' notion. One should actively keep their vehicle from flipping by not hitting the obstacles it can't cross and by not crossing insane ditches. A while back, there was even a warning in the loading screen telling you to be careful when off-roading vehicles, since eg trucks flip easily. I think it's still there.

 

So in summary again: Fan of the idea, the work and the code. It's clear that you put good thought into this :) . Not a fan of having it in PR. Had this been BF2 vanilla, that would have been different since that's a shoot'em'up gallery anyway.

  • Upvote 1
Link to comment
Share on other sites

I like it, and i don't like it. 

This command will remove the fear of getting stuck or flipping over, and will make everyone drive reckless.
It makes driving feel realistic and fun, i think i have seen it in post scriptum which made the game look absolutely funny and made people laugh when someone flipped a vehicle instead of actually ah shit mate you fucked up. 

It just feels alot easy to me, even tho i love the idea of it.

Yesterday we have saved a flipped apc that has been left by it's apc driver, little bump with a tank and my mg gunner returned it to base.
It felt a bit better than just doing !unflip.

  • Like 1
Link to comment
Share on other sites

I believe this could possibly work with a logistics truck and a repair station next to you, with at least 60 seconds of cooldown (meaning if the help arrives, you still have to wait inside the vehicle for !unflip to work). The problem is that there's only a few people that run dedicated logi squads, mainly because of blueberries that keep on stealing these vehicles, therefore 90% of the time you would probably die inside waiting or just decided to abandon the vehicle to save yourself (especially on a map like Bijar).

  • Upvote 2
Link to comment
Share on other sites

Did you guys know that m35 is like REALLLYY hard to flip ? Some of the logi is very easy to flip like the Star for Poland. But the m35 is react like there are balloon around it . I personally jump down from Jabal's bridge many times as a shortcut to rtb and over  few dozen if not hundred time that i try i just flip 4-5 times. But yeah unflip can be helpful in some situlation .

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use and Privacy Policy

back-to-top