Thread: 718/742 Combat script help

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 718/742 Combat script help 
    Registered Member
    Join Date
    Oct 2012
    Posts
    141
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Hello I am currently working on a custom sliske boss for my server. I have all the attacks finished except for one. I would like to add it so when he reaches half health( 5000/10000) he spawns the barrows brothers to help him (note these brothers are different and have higher stats I already added them.) Can anyone please help ?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Selseus's Avatar
    Join Date
    Aug 2017
    Posts
    386
    Thanks given
    11
    Thanks received
    73
    Rep Power
    84
    Quote Originally Posted by candy1000102 View Post
    Hello I am currently working on a custom sliske boss for my server. I have all the attacks finished except for one. I would like to add it so when he reaches half health( 5000/10000) he spawns the barrows brothers to help him (note these brothers are different and have higher stats I already added them.) Can anyone please help ?
    I'm pretty sure you can look at Nex's combat script and take a look at her phasing. Once she gets to a point, she will spawn minions to attack you. Look and see where she transitions between her normal phase and minion phase.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2012
    Posts
    141
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Selseus View Post
    I'm pretty sure you can look at Nex's combat script and take a look at her phasing. Once she gets to a point, she will spawn minions to attack you. Look and see where she transitions between her normal phase and minion phase.
    Thats exactly what I did but for some reason I keep getting errors which say that the script doesn't recognise the .getHitpoints method even though it is used in the same way in the nex script
    Reply With Quote  
     

  4. #4  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by candy1000102 View Post
    Thats exactly what I did but for some reason I keep getting errors which say that the script doesn't recognise the .getHitpoints method even though it is used in the same way in the nex script
    Provide your code.
    Attached image
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Oct 2012
    Posts
    141
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Kris View Post
    Provide your code.
    Code:
    package com.rs.game.npc.combat.impl;
    
    import com.rs.game.Animation;
    import com.rs.game.Entity;
    import com.rs.game.ForceTalk;
    import com.rs.game.Hit;
    import com.rs.game.Hit.HitLook;
    import com.rs.game.Graphics;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.combat.CombatScript;
    import com.rs.game.npc.combat.NPCCombatDefinitions;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    import com.rs.utils.Utils;
    import com.rs.game.player.Appearence;
    import com.rs.cores.CoresManager;
    import com.rs.game.World;
    import com.rs.game.player.content.Magic;
    import com.rs.game.WorldTile;
    import com.rs.utils.Utils.EntityDirection;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.concurrent.TimeUnit;
    
    
    public class ZemouregalCombat extends CombatScript {
    
    
    
    	@Override
    	public Object[] getKeys() {
    		return new Object[] { "zemouregal" , 14270 };
    	}
    	public void processNPC() {
    	if( getHitpoints() == 9500 ); 
    			World.spawnNPC(1419, new WorldTile(2879, 3866, 0), -1, false, EntityDirection.WEST);
    			npc.setNextForceTalk(new ForceTalk("Fumus, don't fail me!"));	
    	}	
    	@Override
    	public int attack(final NPC npc, final Entity target) {
    		final NPCCombatDefinitions defs = npc.getCombatDefinitions();
    	
    
    
    		
    		
    		switch (Utils.getRandom(2)) {
    		case 0:
    			npc.setNextAnimation(new Animation(11338));
    			delayHit(
    					npc,
    					2,
    					target,
    					getMagicHit(
    							npc,
    							getRandomMaxHit(npc, defs.getMaxHit(),
    									NPCCombatDefinitions.MAGE, target)));
    			World.sendProjectile(npc, target, 2963, 34, 16, 40, 35, 16, 0);
    			break;
    		case 1:
    			npc.setNextAnimation(new Animation(11338));
    			delayHit(
    					npc,
    					2,
    					target,
    					getRangeHit(
    							npc,
    							getRandomMaxHit(npc, 500,
    							NPCCombatDefinitions.RANGE, target)));		
    	}	
    		return defs.getAttackDelay();
    	}		
    	
    	
    }
    Keep in mind I also tried changing the getHitpoints method to npc.getHitpoints with no luck

    BTW all npcs and qoutes are placeholder atm
    Reply With Quote  
     

  6. #6  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Alright well, for starters.. The processNPC() method here is never accessed. Moving on, this should be an override inside the NPC class (ClassName extends NPC not CombatScript). You'll need to make some.. E.g booleans in the npc class itself
    For example
    boolean spawnedMinions = false;

    @Override
    public void processNPC() {
    super.processNPC();
    if (!spawnedMinions && getHitpoints() <= 9500) {
    spawnedMinions = true;
    //spawn stuff.
    }
    }
    Attached image
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Oct 2012
    Posts
    141
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Kris View Post
    Alright well, for starters.. The processNPC() method here is never accessed. Moving on, this should be an override inside the NPC class (ClassName extends NPC not CombatScript). You'll need to make some.. E.g booleans in the npc class itself
    For example
    boolean spawnedMinions = false;

    @Override
    public void processNPC() {
    super.processNPC();
    if (!spawnedMinions && getHitpoints() <= 9500) {
    spawnedMinions = true;
    //spawn stuff.
    }
    }
    Ty for your help but minions are not spawnig
    Reply With Quote  
     

  8. #8  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by candy1000102 View Post
    Ty for your help but minions are not spawnig
    Show the code you've made now. Try to respond with the code you've created if the stuff isn't working the way you want it it to work.
    Attached image
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Oct 2012
    Posts
    141
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Code:
    package com.rs.game.npc.others;
    
    import com.rs.game.Animation;
    import com.rs.game.Entity;
    import com.rs.game.ForceTalk;
    import com.rs.game.Hit;
    import com.rs.game.Hit.HitLook;
    import com.rs.game.Graphics;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.combat.CombatScript;
    import com.rs.game.npc.combat.NPCCombatDefinitions;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    import com.rs.utils.Utils;
    import com.rs.game.player.Appearence;
    import com.rs.cores.CoresManager;
    import com.rs.game.World;
    import com.rs.game.player.content.Magic;
    import com.rs.game.WorldTile;
    import com.rs.utils.Utils.EntityDirection;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.concurrent.TimeUnit;
    
    
    public class Zemouregal extends NPC {
    
    @Override
    	public Object[] getKeys() {
    		return new Object[] { "zemouregal" , 14270 };
    	}
    
    	boolean spawnedMinions = false;
    
    	@Override
    	public void processNPC() {
    	super.processNPC();
    	if (!spawnedMinions && getHitpoints() <= 9500) {
    	spawnedMinions = true;
    	World.spawnNPC(1419, new WorldTile(2879, 3866, 0), -1, false, EntityDirection.WEST);
    	npc.setNextForceTalk(new ForceTalk("Fumus, don't fail me!"));
    }
    }	
    	@Override
    	public int attack(final NPC npc, final Entity target) {
    		final NPCCombatDefinitions defs = npc.getCombatDefinitions();
    	
    
    
    		
    		
    		switch (Utils.getRandom(2)) {
    		case 0:
    			npc.setNextAnimation(new Animation(11338));
    			delayHit(
    					npc,
    					2,
    					target,
    					getMagicHit(
    							npc,
    							getRandomMaxHit(npc, defs.getMaxHit(),
    									NPCCombatDefinitions.MAGE, target)));
    			World.sendProjectile(npc, target, 2963, 34, 16, 40, 35, 16, 0);
    			break;
    		case 1:
    			npc.setNextAnimation(new Animation(11338));
    			delayHit(
    					npc,
    					2,
    					target,
    					getRangeHit(
    							npc,
    							getRandomMaxHit(npc, 500,
    							NPCCombatDefinitions.RANGE, target)));		
    	}	
    		return defs.getAttackDelay();
    	}		
    	
    	
    }
    I moved the npc into others from impl
    Reply With Quote  
     

  10. #10  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by candy1000102 View Post
    Code:
    package com.rs.game.npc.others;
    
    import com.rs.game.Animation;
    import com.rs.game.Entity;
    import com.rs.game.ForceTalk;
    import com.rs.game.Hit;
    import com.rs.game.Hit.HitLook;
    import com.rs.game.Graphics;
    import com.rs.game.npc.NPC;
    import com.rs.game.npc.combat.CombatScript;
    import com.rs.game.npc.combat.NPCCombatDefinitions;
    import com.rs.game.tasks.WorldTask;
    import com.rs.game.tasks.WorldTasksManager;
    import com.rs.game.player.Player;
    import com.rs.game.player.Skills;
    import com.rs.utils.Utils;
    import com.rs.game.player.Appearence;
    import com.rs.cores.CoresManager;
    import com.rs.game.World;
    import com.rs.game.player.content.Magic;
    import com.rs.game.WorldTile;
    import com.rs.utils.Utils.EntityDirection;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.concurrent.TimeUnit;
    
    
    public class Zemouregal extends NPC {
    
    @Override
    	public Object[] getKeys() {
    		return new Object[] { "zemouregal" , 14270 };
    	}
    
    	boolean spawnedMinions = false;
    
    	@Override
    	public void processNPC() {
    	super.processNPC();
    	if (!spawnedMinions && getHitpoints() <= 9500) {
    	spawnedMinions = true;
    	World.spawnNPC(1419, new WorldTile(2879, 3866, 0), -1, false, EntityDirection.WEST);
    	npc.setNextForceTalk(new ForceTalk("Fumus, don't fail me!"));
    }
    }	
    	@Override
    	public int attack(final NPC npc, final Entity target) {
    		final NPCCombatDefinitions defs = npc.getCombatDefinitions();
    	
    
    
    		
    		
    		switch (Utils.getRandom(2)) {
    		case 0:
    			npc.setNextAnimation(new Animation(11338));
    			delayHit(
    					npc,
    					2,
    					target,
    					getMagicHit(
    							npc,
    							getRandomMaxHit(npc, defs.getMaxHit(),
    									NPCCombatDefinitions.MAGE, target)));
    			World.sendProjectile(npc, target, 2963, 34, 16, 40, 35, 16, 0);
    			break;
    		case 1:
    			npc.setNextAnimation(new Animation(11338));
    			delayHit(
    					npc,
    					2,
    					target,
    					getRangeHit(
    							npc,
    							getRandomMaxHit(npc, 500,
    							NPCCombatDefinitions.RANGE, target)));		
    	}	
    		return defs.getAttackDelay();
    	}		
    	
    	
    }
    I moved the npc into others from impl
    You still have CombatScript methods inside your NPC class.. You cannot have that. You need to keep the NPC class separate from the CombatScript class.
    Attached image
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. 718 Combat script help
    By candy1000102 in forum Help
    Replies: 10
    Last Post: 02-15-2016, 06:17 PM
  2. 718/742 run.bat help
    By flug in forum Help
    Replies: 3
    Last Post: 05-24-2013, 06:09 AM
  3. [718/742] Death Null Help
    By Lost Redemption in forum Help
    Replies: 0
    Last Post: 04-06-2013, 03:19 AM
  4. 718/742 - I NEED HELP WITH Random Logouts
    By Lost Redemption in forum Help
    Replies: 14
    Last Post: 02-23-2013, 07:04 AM
  5. 718/742 client crash help
    By Justino689 in forum Help
    Replies: 4
    Last Post: 02-02-2013, 10:20 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •