#1 30-03-2010 13:13

gtasearcher
Registered: 30-03-2010
Posts: 1

My first try at FPS...

Well it was better than I first thought.

{$CLEO}
0000:

const
    ALL_COOL = 0@
    X = 1@
    Y = 2@
    Z = 3@
    A = 4@
    DUMMY_OBJ = 5@
    DUMMY_PL = 6@
    DUMMY = 7@
    JOY = 8@
    SPARE = 9@
    CAR = 10@
    WEAPON = 11@
    GUN = 12@
end



thread 'FPS'

if
    ALL_COOL == 1
then
    while true
        wait 0
        if
            not Player.Defined($PLAYER_CHAR)
        then
            continue
        end
        0826: enable_hud 0
        //0581: enable_radar 0 
        0605: $PLAYER_ACTOR "RUN_PLAYER" "PED" 4.0 0 0 0 0 -1
        
    end
end

//---MAIN---

while true
    ALL_COOL = true
    gosub @checkPlayer
    if
        ALL_COOL == false
    then
        continue
    end
    
    //---object creation---
    Model.Load(1220)
    repeat
        wait 0
    until Model.Available(1220)
    
    Actor.StorePos($PLAYER_ACTOR, X, Y, Z)
    A = Actor.Angle($PLAYER_ACTOR)
    
    DUMMY_OBJ = Object.Create(1220, X, Y, Z)
    Object.Angle(DUMMY_OBJ) = A
    
    0750: set_object DUMMY_OBJ visibility 0 
    0382: set_object DUMMY_OBJ collision_detection 0
                                                    
    //---FPS creation---
    DUMMY_PL = Player.Create(#NULL, X, Y, Z)
    DUMMY    = Actor.EmulateFromPlayer(DUMMY_PL)
//  DUMMY = Actor.Create(23, #NULL, X, Y, Z)
//  Player.Build(DUMMY_PL)
//  070A: AS_actor DUMMY attach_to_object DUMMY_OBJ offset 0.0 -3.0 0.0 on_bone 6 17 perform_animation "NULL" IFP_file "NULL" time 1  
//  Camera.SetBehindPlayer(DUMMY_PL) 
    04F4: put_actor $PLAYER_ACTOR into_turret_on_object DUMMY_OBJ offset_from_object_origin 0.0 0.0 0.0 orientation 0 both_side_angle_limit 360.0 lock_weapon 0
    0337: set_actor $PLAYER_ACTOR visibility 0
    0619: enable_actor $PLAYER_ACTOR collision_detection 0
    0337: set_actor DUMMY visibility 1
    
    //Y += 5.0
    //018A: 30@ = create_checkpoint_at X Y Z 
    
    0A92: create_custom_thread "fps.cs" 1   
    while true
        wait 0
        0470: WEAPON = actor DUMMY current_weapon 
        04F4: put_actor $PLAYER_ACTOR into_turret_on_object DUMMY_OBJ offset_from_object_origin 0.0 0.0 0.0 orientation 0 both_side_angle_limit 360.0 lock_weapon WEAPON        
        0337: set_actor $PLAYER_ACTOR visibility 0
        0619: enable_actor $PLAYER_ACTOR collision_detection 0
        0337: set_actor DUMMY visibility 1
        
        if
            Actor.Driving(DUMMY)
        then
            0822: enable_bumper_camera_view 0 
        end
             
        if
            00E1: 0 14
        then
            05BC: AS_actor DUMMY jump 1
            repeat
                wait 0
            until 80E1: not 0 14 
        end
        
        if
            0ADC: test_cheat "1"
        then
            0169: set_fade_color_RGB 255 255 255
            wait 0
            fade 0 25
            wait 25
            015D: set_gamespeed 5.0
            wait 5000
            015D: set_gamespeed 1.0
            fade 1 25
            wait 25
            0169: set_fade_color_RGB 0 0 0
        end
    end 
    
//  0792: disembark_instantly_actor DUMMY

    
    

    
       
//  04C4: store_coords_to X Y Z from_actor $PLAYER_ACTOR with_offset 0.0 0.5 0.2
//  Camera.SetPosition(X, Y, Z, 0.0, 0.0, 0.0)
//  04C4: store_coords_to X Y Z from_actor $PLAYER_ACTOR with_offset 0.0 1.0 0.2
//  Camera.PointAt(X, Y, Z, 2) 
    0A93:
end                                            
        
:checkPlayer
wait 0
if
    not Player.Defined($PLAYER_CHAR)
then
    ALL_COOL = false
end
if
    not Player.Controllable($PLAYER_CHAR)
then
    ALL_COOL = false
end

return

Alright here's the idea:

- create a 'dummy' player that is actually the 'interacting' player
- sync certain operations with the 'actual ' player who is in turret mode

Well all is well. BUT I'm currently having 2 problems:

- I know it's hard, and that turret mode blocks some stuff, but I'd like to make DUMMY visible.
- I don't even understand how my own script works sad I didn't even attach the two actors (DUMMY and $PLAYER_ACTOR). It just works out like that.

I hope my code is readable. And please, don't tell me Ryosuke already did it a million times. I know. It's just that I don't like his FPS mod for some personal reasons...

Anyone wants to help me with these two issues, please? sad

Offline

Board footer

Powered by FluxBB