• Welcome to Freedom Reborn Archive.
 

Updated Attribute: Driver

Started by Mystik, July 19, 2007, 03:41:43 PM

Previous topic - Next topic

Mystik


Mystik

sorry meant to post this in the scripting, could a mod possibly move it?

Mystik

no help? :(

well if you cant get driver to work,this attribute works,
just make 2 attributes in ffedit "pilot" and "jet"
copy and paste the script into the ffx file

create a character called ff_cruiser and give it the jet attribute

catwhowalksbyhimself

Dude, you posted  your original post yesterday.  Chill.  Be patient.  Give someone a chance to actually respond.

BentonGrey

Yeah TR, the guys that are really great at scripting don't get on but a couple times a day, so they probably just haven't seen this yet. :)

Mystik


catwhowalksbyhimself


BentonGrey

Yep, ha, I often wait for a couple days for answers to EZScript questions, because these fellows are busy. ^_^

Lunarman

Couldn't you do something akin to the Matrix mod, where moving objects could be controlled by scripting? I'd take a look at that if I were you.

Epimethee

The basic problem is that Driver/Vehicle is currently very much broken, so any adaptation is an exercise in frustration at this point. Sorry. :(

Mystik

actually my script works, I am able to summon my jet and get in, I just want to adjust the position and movement of my spawned jet

driver works too, there is a line of code that looks like this :

def initdriver(char,update=0):
    #find their vehicle
    template=getVehicle(char)
    name=getFormName()
    FFX_Spawn(name,template,char)
    OnEnterVehicle(name,char)
    Mission_CustomAction('CUSTOM_ENTERVEHICLE',char,name,'OnEnterVehicle',5,0)
    Mission_CustomAction('CUSTOM_EXITVEHICLE',name,name,'OnExitVehicle',5,0)
    Object_SetVar(name,'driver',char)


it should look like this:

def initdriver(char,update=0):
    #find their vehicle
    template=getVehicle(char)
    name=getFormName()
    FFX_Spawn(name,template,char)
    Mission_CustomAction('CUSTOM_ENTERVEHICLE',char,name,'OnEnterVehicle',5,0)
    Mission_CustomAction('CUSTOM_EXITVEHICLE',name,name,'OnExitVehicle',5,0)
    Object_SetVar(name,'driver',char)

BentonGrey

Hmm....then that may actually be the key to getting the FFX attribute to work, which would be pretty awesome.

Lunarman

Oh yes! Well done Thor.

The problem you're having I'm sure can be solved but the problem you have solved is the big one :)

Previsionary

couldnt you simply add some code to find the summoner's/pilot's location and then "Object_SpawnAt" to spawn it at the pilot's direct location and finally use a hover code? Just an idea.

Mystik

right now I'm working on a rider and bike/horse attribute if I get it work I'll post the script here

BentonGrey

I'm very interested in these advances, maybe there is hope for the vehicles in DCU after all?

Mystik

well i got the biker rider to half way work, I am able to get my rider to spawn with the bike beside it, then use a custom command to hop on  but I cant my rider to hop off when I my custom exitbite command

def initBike(char,update=0):
    #remove a portrait if there is one
    FFX_AdjustPortrait(char,0)
    Object_SetAttr(char,'heroPoints',Object_GetAttr(char,'heroPoints')-1) #Ep. 2006-08-25: bug patc


def initrider(char,update=0):
    #find their Bike
    template=getBike(char)
    name=getFormName()
    FFX_Spawn(name,template,char)
    Mission_CustomAction('CUSTOM_ENTERBike',char,name,'OnEnterBike',5,0)
    Object_SetVar(name,'rider',char)

def OnEnterBike(target,char):
    #make the Rider dissappear
    Object_SetPrimaryState(char,PCSTATE_EXILE,10000,0)
    Object_SetSecondaryState(char,SCSTATE_INVISIBLE,10000,0)
    Object_SetPrimaryState(target,PCSTATE_EXILE,10000,0)
    Object_SetSecondaryState(target,SCSTATE_INVISIBLE,10000,0)
    #find their BikeRider
    template=getBikeRider(char)
    name2=getFormName()
    FFX_Spawn(name2,template,char)
    FFX_AdjustPortrait(char,0)
    RegTimer('OnEnterBike2',1,0,name2)
    regDeath(name2,'OnBikeDie')
    Mission_CustomAction('CUSTOM_EXITBike',name2,name2,'OnExitBike',5,0)
    Object_SetVar(name,'bike',name2)

def OnEnterBike2(event):
    name2=event.object
    FFX_AdjustPortrait(name2,1)
    Mission_SelectHero(name2)
    AIEnable(name2) ###!Ep 2006-02-12: bug corrected

def OnBikeDie(event):
    Bike=event.object ###!Ep 2006-07-10: Jet wasn't definedz
    Rider=Object_GetVar(Jet,'rider') ###!Ep 2006-07-10: changed char to Jet
    Mission_RemoveCustomAction('CUSTOM_ENTERJet',rider,Jet)
    if FFX_HasPortrait(Jet):
        OnExitJet('',Jet)

def OnExitBike(dummy,char):
    #figure out who our rider is...
    rider=Object_GetVar(char,'rider')
    pos=Get_ObjectPos(char)
    FFX_Teleport(rider,pos)
    alignWith(rider,char)
    Object_SetPrimaryState(rider,PCSTATE_EXILE,0,REMOVE_STATE)
    Object_SetSecondaryState(rider,SCSTATE_INVISIBLE,0,REMOVE_STATE)
    FFX_AdjustPortrait(char,0)
    AIDisable(char)
    RegTimer('OnEnterBike2',0.5,0,rider)
    template=getBike(char)
    name=getFormName()
    FFX_Spawn(name,template,char)
    Mission_CustomAction('CUSTOM_ENTERBike',char,name,'OnEnterBike',5,0)


def getBike(char):
    temp=getByTemplate(char,FFX_BIKER_CUSTOM,1)
    return temp

def getBikeRider(char):
    temp=getByTemplate(char,FFX_BIKER_CUSTOM,2)
    return temp

FFX_BIKER_CUSTOM=[
["default","ff_cruiser","microwave",""],
]





any help would be truly helpful

Mystik

bump

I surprised no one even tested the working driver code

BentonGrey

Sorry man, I've been pretty busy the last week (not like I'd be any help to begin with, but still).

Previsionary

It might actually help if you posted some log files (after you tried the attribute of course) so coders and such can actually get an idea about what kind of help to offer.

Zorro

Well, at least this explains why I was never able to get Tony Stark with a Driver attribute into his armor that had the vehicle attribute.

Epimethee

Quote from: Thor Reborn on August 11, 2007, 02:34:08 PM
bump

I surprised no one even tested the working driver code
I finally did. (Little time and even less energy available for coding recently.) Your workaround works indeed very well, kudos! This fix changes the behaviour Dr Mike had in mind, i.e., only the vehicle appears at the beginning, but it does work (and personally, I might even prefer it working the way you fixed it).

Here's a slightly updated version, which prevents the car from running on its own at the beginning. (Also, the vehicle shouldn't appear on the same exact spot as the hero.)
def initdriver(char,update=0):
    #find their vehicle
    template=getVehicle(char)
    name=getFormName()
    pos=Get_ObjectPos(char)
    pos=(pos[0]+30, pos[1]+30, pos[2])
    cshelper.spawn(name, template, pos)
    alignWith(name, char)
    Mission_CustomAction('CUSTOM_ENTERVEHICLE',char,name,'OnEnterVehicle',5,0)
    Mission_CustomAction('CUSTOM_EXITVEHICLE',name,name,'OnExitVehicle',5,0)
    Object_SetVar(name,'driver',char)
    AIDisable(name)


def OnExitVehicle(dummy,char):
    #figure out who our driver is...
    driver=Object_GetVar(char,'driver')
    pos=Get_ObjectPos(char)
    pos=(pos[0]+20, pos[1]+20, pos[2])
    FFX_Teleport(driver,pos)
    alignWith(driver,char)
    Object_SetPrimaryState(driver,PCSTATE_EXILE,0,REMOVE_STATE)
    Object_SetSecondaryState(driver,SCSTATE_INVISIBLE,0,REMOVE_STATE)
    FFX_AdjustPortrait(char,0)
    AIDisable(char)
    RegTimer('OnEnterVehicle2',0.5,0,driver)

Epimethee

Note: I just made a quick test with your pilot code, but probably due to the quick hack I used, I had a few major errors. Since it's very late, I'll call it quit for now. So the only immediate "help" I can provide is asking very basic questions:

Do the attributes create traceback errors in script.log?

Did you try adding print commands (e.g. print "OnEnterBike() step 1") at various points in your code so you could hopefully pinpoint the exact line where things stop working?

P.S.: Maybe a this should be moved to the script forum?

stumpy


Mystik

actually I'm still pretty new at this so I dont even know where to view the log files

Previsionary

Quote from: Thor Reborn on August 14, 2007, 07:25:48 AM
actually I'm still pretty new at this so I dont even know where to view the log files

FF.log and script.log are two text files that are located in the FFVTTR main folder.

stumpy

Check. See the >stickied topic< at the top of the Technical Issues forum for details on this.

Epimethee

Thor, don't hold your breath (RL getting in the way), but I'm trying to add options to the existing Driver/Vehicle so it might do something like what you want. bump the thread or PM me if I don't get back to you soon enough for your mod work.

Mystik

thank you for the effort :thumbup:
well I'm gonna keep my fingers crossed

Mystik

just a bump to see if you had the chance to make any progress