Thread: [Elvarg] Proper Way To Create a Cutscene

Results 1 to 5 of 5
  1. #1 [Elvarg] Proper Way To Create a Cutscene 
    Registered Member B E N's Avatar
    Join Date
    May 2012
    Posts
    142
    Thanks given
    14
    Thanks received
    3
    Rep Power
    36
    Hey guys, I made a thread a couple days ago about camera movement for a cutscene, I have that figured out for the most part. My next question would be: What is the correct approach to programming a cutscene as far as dialogue, moving and rotating the camera, and certain actions such having an npc die/spawn, or forcing combat?

    Pretty much what I'm asking is how do I create a sequence of events that have a short pause in between them?

    Kind of like if NPC1 talks above the head, how to do I make it so NPC2 waits until that text is finished to respond to NPC1.

    Would it just be a series of tasks, or is there a better way?



    EDIT: I guess to add to this, all I really need to know is the best way to add a delay before the next NPC speaks. Like NPC1 talks, then it waits 3 seconds, then NPC2 talks. Any help or a point in the right direction would help.
    Last edited by Corey; 06-25-2019 at 01:14 PM.
    Reply With Quote  
     

  2. #2  
    Registered Member B E N's Avatar
    Join Date
    May 2012
    Posts
    142
    Thanks given
    14
    Thanks received
    3
    Rep Power
    36
    bump
    Reply With Quote  
     

  3. #3  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    975
    Thanks given
    47
    Thanks received
    160
    Rep Power
    366
    For dialogues themselves I have a system which involves abstract DialogueNodes which include methods like "sendSpecificsToPlayer" and "advance".
    "sendSpecificsToPlayer" is triggered by a method that sends the complete node. That is triggered by npc interaction or implementations of the "advance" function.
    "advance" is triggered by a dialogue continue option and by dialogue option selection.

    Implementations of those DialogueNodes have class names such as "EmptyNode", "OptionDialogue", "NpcDialogue", etc.

    Expansion for a cutscene could include a new node (delayNode) that when "advanced" triggers a time delay before advancing to the next node.
    Same could be done for a "NpcTalkNode", "CameraMovementNode", etc.

    Do you get what I mean?

    But of course that would require an Action/Event system which not every server has.
    My informative threads:
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Registered Member B E N's Avatar
    Join Date
    May 2012
    Posts
    142
    Thanks given
    14
    Thanks received
    3
    Rep Power
    36
    Quote Originally Posted by TheChosenOne View Post
    For dialogues themselves I have a system which involves abstract DialogueNodes which include methods like "sendSpecificsToPlayer" and "advance".
    "sendSpecificsToPlayer" is triggered by a method that sends the complete node. That is triggered by npc interaction or implementations of the "advance" function.
    "advance" is triggered by a dialogue continue option and by dialogue option selection.

    Implementations of those DialogueNodes have class names such as "EmptyNode", "OptionDialogue", "NpcDialogue", etc.

    Expansion for a cutscene could include a new node (delayNode) that when "advanced" triggers a time delay before advancing to the next node.
    Same could be done for a "NpcTalkNode", "CameraMovementNode", etc.

    Do you get what I mean?

    But of course that would require an Action/Event system which not every server has.
    Thank you for your response, it certainly points me in the right direction. I now know what I need to do and how to approach this.
    Reply With Quote  
     

  6. #5  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    975
    Thanks given
    47
    Thanks received
    160
    Rep Power
    366
    Just so you can get a better understanding on how I did this I'll post a couple of my hardcoded tests. They are run on server startup and the created objects are put in a HashMap. More specifically, the first dialogue in a sequence.
    Code:
    private static void glory(HashMap<Integer, DialogueNode> starterNodes, int id){
        OptionDialogue node = new OptionDialogue("Edgeville", "Karamja", "Draynor Village", "Al Kharid");
        DialogueNode nodeEdge = new EmptyNode();
        nodeEdge.setAction(new DialogueAction(){
            @Override
            public void performAction(Player player){
                if(player.getMinigame() == null)
                    World.getWorld().submit(new GloryTeleport(player, GloryTeleport.EDGEVILE));
                else
                    player.getActionSender().sendMessage("You can't teleport while staying at this minigame.");
            }
        });
        DialogueNode nodeKaramja = new EmptyNode();
        nodeKaramja.setAction(new DialogueAction(){
            @Override
            public void performAction(Player player){
                if(player.getMinigame() == null)
                    World.getWorld().submit(new GloryTeleport(player, GloryTeleport.KARAMJA));
                else
                    player.getActionSender().sendMessage("You can't teleport while staying at this minigame.");
            }
        });
        DialogueNode nodeDraynor = new EmptyNode();
        nodeDraynor.setAction(new DialogueAction(){
            @Override
            public void performAction(Player player){
                if(player.getMinigame() == null)
                    World.getWorld().submit(new GloryTeleport(player, GloryTeleport.DRAYNOR));
                else
                    player.getActionSender().sendMessage("You can't teleport while staying at this minigame.");
            }
        });
        DialogueNode nodeAlKharid = new EmptyNode();
        nodeAlKharid.setAction(new DialogueAction(){
            @Override
            public void performAction(Player player){
                if(player.getMinigame() == null)
                    World.getWorld().submit(new GloryTeleport(player, GloryTeleport.AL_KHARID));
                else
                    player.getActionSender().sendMessage("You can't teleport while staying at this minigame.");
            }
        });
        node.setOptionDialogues(nodeEdge, nodeKaramja, nodeDraynor, nodeAlKharid);
        starterNodes.put(id, node);
    }
    Code:
    private static void test3(HashMap<Integer, DialogueNode> starterNodes, int id) {
        NormalTextDialogue node1 = new NormalTextDialogue("You found a hidden tunnel! Do you want to enter it?");
        OptionDialogue node2 = new OptionDialogue("Yea! I'm fearless!",  "No way! That looks scary!");
        DialogueNode node2a = new EmptyNode();
        DialogueNode node2b = new EmptyNode();
        node2a.setAction(new DialogueAction() {
            @Override
            public void performAction(Player player) {
                player.setTeleportTarget(Location.create(3300, 3300, 0));
                player.getActionSender().sendMessage("You were fearless so I teleported you to these coordinates lol.");
            }
        });
    
        node2b.setAction(new DialogueAction() {
            @Override
            public void performAction(Player player) {
                player.getActionSender().sendMessage("Chicken!");
            }
        });
    
        node1.addNextNode(null, node2);
        node2.setOptionDialogues(node2a, node2b);
        starterNodes.put(id, node1);
    }
    Code:
    private static void test2(HashMap<Integer, DialogueNode> starterNodes, int id) {
        DialogueNode node1 = new NPCTalkDialogue(TalkDialogue.Emotions.CALM2, "Hi, my name is Frank.", "What's your name?");
        OptionDialogue node2 = new OptionDialogue("Tell the truth.", "Tell a silly lie.");
    
        DialogueNode node3a = new PlayerTalkDialogue(TalkDialogue.Emotions.DEFAULT, "I'm <playerName>. Nice to meet you");
        DialogueNode node4a = new NPCTalkDialogue(TalkDialogue.Emotions.HAPPY, "Nice to meet you too.");
        DialogueNode node5a = new PlayerTalkDialogue(TalkDialogue.Emotions.CALM2, "I'll be taking my leave now.");
        DialogueNode node6a = new NPCTalkDialogue(TalkDialogue.Emotions.ALMOSTCRYING, "Please!","Don't leave me!");
        OptionDialogue node7a = new OptionDialogue("Leave Frank.", "Stay with him.");
    
        DialogueNode node8aa = new PlayerTalkDialogue(TalkDialogue.Emotions.DEFAULT, "I'm sorry but I have other things to do as well.", "Goodbye!");
    
        DialogueNode node8ab = new PlayerTalkDialogue(TalkDialogue.Emotions.DISINTERESTED, "Ok.", "I'll stay for some longer.");
        DialogueNode node9ab = new NPCTalkDialogue(TalkDialogue.Emotions.HAPPY, "Nah.", "It was just a test.", "But please, take this.");
        DialogueCondition cond10aba = new DialogueCondition() {
            public boolean condition(Player player) {
                return player.getInventory().hasRoomFor(new Item(995, 10));
            }
        };
        DialogueNode node10aba = new NormalTextDialogue("Frank gives you some money and waves you goodbye", "as you take your leave.");
        DialogueAction actionNode10aba = new DialogueAction() {
            public void performAction(Player player) {
                player.getInventory().add(new Item(995, 10));
            }
        };
        DialogueCondition cond10abb = new DialogueCondition() {
            public boolean condition(Player player) {
                return !player.getInventory().hasRoomFor(new Item(995, 10));
            }
        };
        DialogueNode node10abb = new NormalTextDialogue("Frank wants to give you some money but drops it", "on the ground as you have no space in your backpack", "He waves you goodbye as you take your leave.");
        DialogueAction actionNode10abb = new DialogueAction() {
            public void performAction(Player player) {
                new DroppedItem(player.getLocation(), 995, 10, player);
            }
        };
    
        DialogueNode node3b = new PlayerTalkDialogue(TalkDialogue.Emotions.DEFAULT, "I'm the hero known as Link!");
        DialogueNode node4b = new NPCTalkDialogue(TalkDialogue.Emotions.MORESAD, "Liar.");
        DialogueNode node5b = new NormalTextDialogue("Frank walks away.", "Maybe I shouldn't have joked around?");
    
        node1.addNextNode(null, node2);
        node2.setOptionDialogues(node3a, node3b);
        node3a.addNextNode(null, node4a);
        node4a.addNextNode(null, node5a);
        node5a.addNextNode(null, node6a);
        node6a.addNextNode(null, node7a);
        node7a.setOptionDialogues(node8aa, node8ab);
        node8ab.addNextNode(null, node9ab);
        node9ab.addNextNode(cond10aba, node10aba);
        node10aba.setAction(actionNode10aba);
    
        node9ab.addNextNode(cond10abb, node10abb);
        node10abb.setAction(actionNode10abb);
    
        node3b.addNextNode(null, node4b);
        node4b.addNextNode(null, node5b);
        starterNodes.put(id, node1);
    }
    Code:
    private static void test1(HashMap<Integer, DialogueNode> starterNodes, int id) {
        DialogueNode node1 = new NPCTalkDialogue(TalkDialogue.Emotions.CALM2, "Hi, my name is Frank.", "What's your name?");
        DialogueCondition conNode2A = new DialogueCondition() {
            public boolean condition(Player player) {
                return player.getParameter("dialogueTestKnowsName") == null;
            }
        };
        DialogueCondition conNode2B = new DialogueCondition() {
            public boolean condition(Player player) {
                return player.getParameter("dialogueTestKnowsName") != null;
            }
        };
        DialogueNode node2a = new PlayerTalkDialogue(TalkDialogue.Emotions.DEFAULT, "I'm <playerName>. Nice to meet you");
        DialogueNode node2b = new PlayerTalkDialogue(TalkDialogue.Emotions.DEFAULT, "I've already told you my name.");
        node1.addNextNode(conNode2A, node2a);
        node1.addNextNode(conNode2B, node2b);
        DialogueAction actionNode2A = new DialogueAction() {
            public void performAction(Player player) {
                player.setParameter("dialogueTestKnowsName", Boolean.TRUE);
            }
        };
        node2a.setAction(actionNode2A);
    
        DialogueNode node3a = new NPCTalkDialogue(TalkDialogue.Emotions.LAUGH1, "Orly?");
        node2a.addNextNode(null, node3a);
        DialogueNode node4a = new PlayerTalkDialogue(TalkDialogue.Emotions.ANNOYED, "Yarly!");
        node3a.addNextNode(null, node4a);
        DialogueNode node5a = new PlayerTalkDialogue(TalkDialogue.Emotions.DISINTERESTED, "I'll be going now...", "See you later...");
        node4a.addNextNode(null, node5a);
        DialogueNode last = new NormalTextDialogue("You leave Frank to do whatever he was doing before.");
        node5a.addNextNode(null, last);
    
        DialogueNode node3b = new NPCTalkDialogue(TalkDialogue.Emotions.HAPPY, "Ah!", "Now I remember.", "<playerName> wasn't it?");
        node2b.addNextNode(null, node3b);
        DialogueNode node4b = new PlayerTalkDialogue(TalkDialogue.Emotions.HAPPY, "Correct!");
        node3b.addNextNode(null, node4b);
        DialogueNode node5b = new NPCTalkDialogue(TalkDialogue.Emotions.HAPPY, "Yup ^^");
        node4b.addNextNode(null, node5b);
        node5b.addNextNode(null, last);
        starterNodes.put(id, node1);
    }
    My informative threads:
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 18
    Last Post: 11-18-2013, 07:44 AM
  2. [PI] Is it possible to create a cutscene?
    By Beanerrr in forum Help
    Replies: 14
    Last Post: 04-12-2012, 09:59 PM
  3. Proper way to manage a server
    By istory in forum Tutorials
    Replies: 8
    Last Post: 08-18-2010, 07:10 PM
  4. Bad way to create skills?
    By Cjay00091 in forum Help
    Replies: 11
    Last Post: 01-20-2010, 05:32 AM
  5. Best way to create a stable server?
    By xLin in forum Application Development
    Replies: 18
    Last Post: 05-09-2009, 08:28 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •