View unanswered posts | View active topics It is currently Thu Dec 26, 2024 5:06 pm



Reply to topic  [ 14 posts ] 
 Operatable vehicles/items. How? 
Author Message

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Operatable vehicles/items. How?
I've been thinking about this one a loong time now and I really want to see it in action. If youve ever played some fps games that have vehicles in them, you need to get close to the vehicle or its exit and press a key to activate it.

I'm pretty sure this should be possible to do in CC.

So think this:

There a helicopter on the pad and it belongs to the either team.
Now you bring a clone to the chopper and "do something" to activate it.
The clone or pilot or whatever actor was activating the vehicle is stored in the vehicle somehow.
The vehicle becomes operable and you can use it like you would use any other actor or craft in CC.
After youve had your fun with it, you "do something" to leave the vehicle.
Or alternatively if the vehicle is destroyed, make the controlling pilot be thrown out of it in a random direction.


I could imagine the "do something" parts could either be "press X button" or "crouch" or do some sort of wierd movement with the pilot actor to get him in/out. Can we add new options to the pie menu?

Another thing I'm guessing is that this will be possible to do only for a specific actor. That is fine since not everyone is supposed to control a vehicle.
And finally I bet the vehicle itself would need its own specific code to disable its movement and ability to select it when there is no actor inside and so on.

As for the vehicles, they can be your ordinary AHuman as a mech, ACrab as a tank or something or even ACraft as a craft.


Fri May 22, 2009 2:40 pm
Profile
User avatar

Joined: Wed Dec 13, 2006 12:10 am
Posts: 562
Location: Termina
Reply with quote
Post Re: Operatable vehicles/items. How?
thats a wonderfull idea I hope it gets done and let me guess M.P.A.M. and liner tank :P


Fri May 22, 2009 3:58 pm
Profile WWW
User avatar

Joined: Tue Aug 14, 2007 2:53 pm
Posts: 296
Location: Black Mesa Research Facility
Reply with quote
Post Re: Operatable vehicles/items. How?
Is this an idea for your Tournament-esque mod, or just an idea in general?


Fri May 22, 2009 10:33 pm
Profile
User avatar

Joined: Tue Jul 03, 2007 10:24 pm
Posts: 253
Location: In the house next door, eating your neighbors.
Reply with quote
Post Re: Operatable vehicles/items. How?
Great idea. I vote for the linear tank getting the first conversion to this. It kicks ass.


Fri May 22, 2009 10:58 pm
Profile

Joined: Thu Apr 12, 2007 2:53 am
Posts: 83
Reply with quote
Post Re: Operatable vehicles/items. How?
I'd say a stationary turret that you need to get close to to use would be a better application.


Sat May 23, 2009 12:17 am
Profile WWW
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post Re: Operatable vehicles/items. How?
I think that it would be possible to do so, though in a slightly hacky way.
You make a script so that when a variable called "haspilot" is = 0 and a player controlled actor is, say, 50 pixels max away from the vehicle's position, and a specific key in the keyboard is pressed, the actor is transported out of the screen, enough to make it not affected by other objects but not enough for it to AutoGib. Then, "haspilot" is set to = 1, and the vehicle can't be used by anyone else. Then, TLB's converter script would automatically switch the player to controlling the vehicle.
After that, if the player presses another key or tries to change the controlled actor and haspilot == 1, the vehicle goes into dormant AI state, the pilot is transported back to the vehicle's position + 20 pixels X, so that they don't gib each other, and haspilot is set to 0, making the vehicle ready to take in another unit.


It should work.
Theoretically, at least. :P


Sat May 23, 2009 12:34 am
Profile WWW
User avatar

Joined: Tue Jul 03, 2007 10:24 pm
Posts: 253
Location: In the house next door, eating your neighbors.
Reply with quote
Post Re: Operatable vehicles/items. How?
I don't see why that couldn't work. I mean, coding isn't my thing (atleast not yet) but that seems to make logical sense in every way.


Sat May 23, 2009 12:57 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Operatable vehicles/items. How?
you could actually just remove the "pilot" from the sim altogether and put it into a pointer stored by the item in question, and then just spawn it when the item gibs or when the pilot gets out. we might actually be able to use a dropship or rocket to allow the "doors" on a walker or whatever to be used to take an actor in. looks pretty possible.


Sat May 23, 2009 2:23 am
Profile WWW
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Operatable vehicles/items. How?
Easy.

You don't even need lots of code to disable the vehicle.

Just have it swich the player to his brain if the controlled actor's ID is the tank's ID, while disabling the AI controller.

The code for storing the actor is easy, and ejection is also easy.
I would use controllers for entering/exiting.


Sat May 23, 2009 3:07 am
Profile
User avatar

Joined: Fri Jun 01, 2007 12:17 am
Posts: 106
Reply with quote
Post Re: Operatable vehicles/items. How?
well, first I'd likely work with an ACDropship. After that, I think there are variables to make it non-controllable. Just check its internal inventory for an actor (functions for that in the docs, I'm sure) if one is present, get the actors team (?) and assign the dropship to that team and make it controllable. Then, reverse if there is no actor present.

I wish we could do this with all actors but ghosting it with LUa would be hard, I'm not sure if it's doable otherwise.

Had a look, ACRafts aren't documented atm. I really have no clue how crafts internally handle 'inventory' if it is like other actors inventory (say an AHuman) or not. I wish I could give you something solid but I've only got so much in my position.


Sat May 23, 2009 6:12 am
Profile WWW
User avatar

Joined: Sun May 17, 2009 5:20 am
Posts: 21
Reply with quote
Post Re: Operatable vehicles/items. How?
I don't think we can change the pie menu... Just make a gun with preset name "Keys". When you reload in ??? pixel radius of ACDropship, AHuman disappears and control of ACDropship is granted to "Owner of AHuman".

And don't ask me I don't know ... about LUA :D


Last edited by XxNoBexX on Sat May 23, 2009 7:08 pm, edited 1 time in total.



Sat May 23, 2009 8:34 am
Profile

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Re: Operatable vehicles/items. How?
:oops:

Uhh, can someone code this please?
So far I can think of the code doing this:

Pilot:
1. If within range of activation, press Z
2. Pilot is now loaded into a variable (screw the equipment) and stored within the vehicle


Vehicle:
1. If no pilot inside, be paralyzed (all controls are denied and unit cant be selected otherwise)
2. If pilot inside, restore all controls and become a selectable unit.
2. When activated by pilot, play sound (Engines turned on).
3. Pressing Z will drop out the pilot and the vehicle become inactive again.
4. If destroyed, drop out pilot
5. If hp is less than 0, gib the vehicle and drop the pilot.



Do note, this code should be universal and easily ported to any type of unit.
ACrab, AHuman, ACraft and so on.

And teams dont matter, players can hijack enemy vehicles and doing so will make the vehicle be owned by the team that hijacked, otherwise anyone can hijack anything.


Sat May 23, 2009 9:19 am
Profile
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: Operatable vehicles/items. How?
numgun wrote:
4. If destroyed, drop out pilot
5. If hp is less than 0, gib the vehicle and drop the pilot.

These should be exactly the same block of code.


Sat May 23, 2009 9:25 am
Profile WWW
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Operatable vehicles/items. How?
numgun wrote:
Vehicle:
1. If no pilot inside, be paralyzed (all controls are denied and unit cant be selected otherwise)
2. If pilot inside, restore all controls and become a selectable unit.
2. When activated by pilot, play sound (Engines turned on).
3. Pressing Z will drop out the pilot and the vehicle become inactive again.
4. If destroyed, drop out pilot
5. If hp is less than 0, gib the vehicle and drop the pilot.

Done for the vehicle.
All the pilot has to do is send it self inside, and activate the engine sound.
Oh, and I hope this does not crash CC on restart, as it checks if the activity is over.
Code:
function Create(self)
self.pilot = nil
end

function Destroy(self)
if not(self.pilot == nil or ActivityMan:GetActivity():ActivityOver()) then -- Not sure about second check, but should prevent game crash
self.Pod = CreateActor("Ejection Pod Name  Here")
self.Pod:AddInventoryItem(self.pilot)
self.Pod.Pos = self.Pod.Pos
self.Pod.Team = self.Pod.Team
MovableMan:AddActor(self.Pod)
end
end

function Update(self)
if self.pilot == nil then
self.InputMode = 3

    for player = 0, ActivityMan:GetActivity().PlayerCount - 1 do
   if MovableMan:IsActor(ActivityMan:GetActivity():GetControlledActor(player)) then
       if ActivityMan:GetActivity():GetControlledActor(player).ID == self..ID then
ActivityMan:GetActivity():SwitchToActor(ActivityMan:GetActivity():GetPlayerBrain(player),player,ActivityMan:GetActivity():GetTeamOfPlayer(player));
       end
   end
    end
else
self.Team = self.Pilot.Team
if (UInputMan:KeyHeld(?)) and (self:IsPlayerControlled()) then
self.Pilot.Pos.X = self.Pos.X + <someoffset>
self.Pilot.Pos.Y = self.Pos.Y + <otheroffset>
MovableMan:AddActor(self.Pilot)
end
if self.Health < 1 then
self:GibThis()
end


Sat May 23, 2009 5:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.173s | 14 Queries | GZIP : Off ]