Thread: Help with minigame features ... and npcs

Results 1 to 6 of 6
  1. #1 Help with minigame features ... and npcs 
    Donator

    Join Date
    Apr 2013
    Posts
    99
    Thanks given
    3
    Thanks received
    2
    Rep Power
    15
    Hello there

    i'm trying to make a minigame ... the minigame is all about killing npcs ,,,

    so there is one npc and more than a player so what i wanted to ask

    How can i give a reward which depends on how much the player took hp from the npc

    for example if the player got 40% of the npc's hp then he gets 40 points .....

    the points will be giving the points when the npc dies


    So how to actually do this ??
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Mar 2015
    Posts
    138
    Thanks given
    22
    Thanks received
    13
    Rep Power
    13
    What's the point in racking up points every time some hp is taken if you're going to reward the player when the NPC dies anyway?

    Within your minigame let's say the NPC id is named id so you could do this:

    Code:
    int points ; //stores the player's points
    switch( id )
    {
    	case 90 : //npc had 100 hp
    		points = points + 100 ;
    		break ;
    	case 80 : //npc has 500 hp
    		points = points + 500 ;
    		break ;
    	default :
    		return ;
    		break ;
    }
    This code is only useful to you if you know what to change each variable to, but this is how you could do it, manually. This is an easy way to do it as long as you know each NPCs hp.

    - - - Updated - - -

    Quote Originally Posted by mohammed View Post
    you miss understood ... sorry i can't explain well since i didn't sleep from 2 days !

    Example for the minigame
    Npc is spawned
    there is 3 players in the minigame

    Player number 1
    took 20% of the npc's hp

    player number 2
    took 50% of the npcs hp

    player number 3
    took 30% of the npc's hp

    So the result will be

    Player number 1
    got 20 points

    player number 2
    got 50 points

    player number 3
    got 30 points


    this is the example

    I hope you guys can help ...
    Oh okay, well, you should create a new npcPoint variable to be written into player files (like pest control points).
    Then in your minigame method/class you could perhaps create an array that will hold something like:

    Code:
    int pArray = { 1 , 2 , 3 , 4 } ;
    1,2,3,4 can represent the players so in this instance 4 would be the maximum amount of players.
    In your mini-game assign each player an id within that array and check to make sure no number is used more than once and do not allow for more than 4 players.
    Then, for each npc call to get their hp ( I do not have a method for this at hand ) or you could manually input it.
    Then with every hit a player gets on this npc let's say player 1 gets 20hp, assign this to

    Code:
    pArray[ 1 ] = pArray[ 1 ] + newPoints ;
    newPoints would be the hp that has been taken from the npc.
    At the end of the game when points are being distributed, just assign the points to each player that has been playing with a for loop:

    Code:
    for( i = 1 ; i <= 4 ; i++ )
    {
         npcPoint = pArray[ i ] ;
    }
    Obviously I haven't given you much code but I've given you a simple structure on how you could complete this task.
    Reply With Quote  
     

  3. #3  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    What you need to do is have a array saved for players on how much dmg they all took on the npc. If the npc die you just calculate the damage taken by each person in that team or w.e you tries to do. I would suggest making the points based on dmg you taken.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     

  4. #4  
    Donator

    Join Date
    Apr 2013
    Posts
    99
    Thanks given
    3
    Thanks received
    2
    Rep Power
    15
    Ok Now i think i can explain a bit .

    So do you guys Know how the pk system works in multi attack ?

    the player who gets the loot is the player who makes more damage ....

    and it's kind of the same as castle wars but instead of loot you get tokens ....

    So what really want in my mini-game is To make a winner which and the players gets points Which is actually calculated on how much damage they have done to the npc

    Winner definition : The player which does the biggest damage for the npc
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Mar 2015
    Posts
    138
    Thanks given
    22
    Thanks received
    13
    Rep Power
    13
    Quote Originally Posted by mohammed View Post
    Ok Now i think i can explain a bit .

    So do you guys Know how the pk system works in multi attack ?

    the player who gets the loot is the player who makes more damage ....

    and it's kind of the same as castle wars but instead of loot you get tokens ....

    So what really want in my mini-game is To make a winner which and the players gets points Which is actually calculated on how much damage they have done to the npc

    Winner definition : The player which does the biggest damage for the npc
    As me and arch337 both said, you would store this data in an array having each variable in said array corresponding to each player in the mini-game.
    The way to calculate this damage, your best bet would be to find the multi-pking PKP calculations and transferring it making it relevant to NPCs.
    Reply With Quote  
     

  6. #6  
    Donator

    Join Date
    Apr 2013
    Posts
    99
    Thanks given
    3
    Thanks received
    2
    Rep Power
    15
    Quote Originally Posted by DeviationX View Post
    As me and arch337 both said, you would store this data in an array having each variable in said array corresponding to each player in the mini-game.
    The way to calculate this damage, your best bet would be to find the multi-pking PKP calculations and transferring it making it relevant to NPCs.

    Thank you so much i figured it out

    and for the npc killer there is a method in npchandler -- > getnpckillerid(int i)
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Help, with tab clicking and combat
    By Burnt® in forum Help
    Replies: 0
    Last Post: 04-10-2009, 04:36 AM
  2. Need help with ::item command and master.
    By redregious in forum Help
    Replies: 16
    Last Post: 03-21-2009, 01:24 PM
  3. Need Help With 2 Things For NPCs
    By digistr in forum Help
    Replies: 3
    Last Post: 03-20-2009, 02:57 AM
  4. Replies: 0
    Last Post: 12-01-2008, 05:01 AM
  5. Helpful models. Items, objects and npcs!
    By Senses in forum Models
    Replies: 6
    Last Post: 09-11-2008, 08:33 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •