Help with your scripting

A little help please

A little help please

Postby epsilonion » 04 Sep 2015, 18:22

Whats my objective:
What I am trying to do is a scene fly by, camera on a spline path, at the end of the spline path the camera hits the back of a character head (triggerbox), delete the character, delete the trigger box, set fixed camera to be disabled, spawn the fps preset and set that as player.

This is to be a intro to a level and goes into playing as the fps preset.

Quick question:
Is the "set camera active" tick box (in the camera properties) an action where I can use action.setActionParam(entity.getEntityIDFromTag("example camera tag"), 1, "set camera active", "0");

What I have so far:
Code: Select all
obj = 0 -- | Define a variable for our object ID
Playerid = 0 -- define the payerid
spawnHeightOffset       = 1
spawnPresetName       = "FPS Kit  Player A"

function onInit(objID)
   sky.lprint("Head Collision script!");
    obj = objID;
end

function onTrigger_Enter(hitID)
   --CameraName = entity.getEntityName(hitID);
   sky.lprint("Head Collision Hit= ");
   
   --spawn the FPS player
   x,y,z = entity.getPosition(obj); --Get the current position
   -- Spawn the FPS Char preset.
   spawnID = entity.spawnPreset(spawnPresetName , x, y + spawnHeightOffset, z );
   
        -- get the objid from the fps player
   Playerid = entity.getIDFromTag("Player");
   -- Set fixed camera as none active or player in this case.
   fpsSystem.setAsPlayer(entity.getIDFromTag("headtrig1"),0);
   -- set FPS char preset as player
   fpsSystem.setAsPlayer(Playerid,1);
   
   --Delete the camera
   entity.delete( entity.getIDFromTag("t_Camera - 2D Fixed_555304") );
   -- Delete the colission box, so it can not be hit again and again.
   entity.delete( entity.getIDFromTag("headtrig1") );
   --delete the character model
   entity.delete( entity.getIDFromTag("char1") );
end


I have tried in the code above to stop the camera been the player (if thats correct I have no idea) but want it to stop been active and the player to switch to the FPS character preset.

Thank you in advance
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: A little help please

Postby SolarPortal » 04 Sep 2015, 19:29

Good idea, i would like to see this completed as we haven't had any cutscenes yet :)

Quick question:
Is the "set camera active" tick box (in the camera properties) an action where I can use action.setActionParam(entity.getEntityIDFromTag("example camera tag"), 1, "set camera active", "0");

Yes, you can do it this way or you can call this lua command:
Code: Select all
camera.setActiveCamera(entityID);

I think this is a quicker way of doing what you are asking. :)

Edit: Just realised there is no deactivate of the camera, so yes calling through the action system to manage it will be fine and just as fast ;)

fpsSystem.setAsPlayer(entity.getIDFromTag("headtrig1"),0);

Not quite sure what you will achieve with this command.
I would simply turn the FPS player off using the command passing in the id and then the set the FPS as player by the same id.

The command will only work with sceneEntities with the "FPS System Player" action.

Hope this helps clarify a few things :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: A little help please

Postby SolarPortal » 05 Sep 2015, 21:15

well after a little while of figuring out why the camera would not turn off from script, i managed to come up with what you were asking in very minimal code. You will however need a new version of skyline as the i had to change a couple of things to make it work, so i can see how frustrating it will have been for you ;)

But here is a video of a basic cutscene:


There are still some issues that i can see and will make changes too,
1 ) The camera has no way of being turned on or off as in stop all updated movement or play it
2 ) There is no way of getting the current id of the camera to change to or store for later use.

We have also chatted and think it would be cool if you could use the positioning of the entities to affect the physics position instead of the other way around meaning the code will be in the trigger and not the sensor on the camera.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: A little help please

Postby epsilonion » 06 Sep 2015, 01:16

That's exactly what I was wanting to do...

Now imagine a voice over explaining what's happened in the game world to how come your a soldier alone in the woods at that point you go from a camera clipping the tops of the trees, In to the woods and then your incontrol of the soldier
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 874
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 8 guests

cron