Brownjor10 Posted January 9, 2016 Posted January 9, 2016 Hey guys, I'm not really on the forums all that much, but I was wondering if anyone a little more code savvy, as I'm just learning and have only coded a weapon and some follow functions, could help me with something. I'm trying to mimic the Rakghoul disease from kotor 1. I want to make it so that if an npc named "rakghoul" kills an npc, the game spawns npc "rakghoul" at the last known enemy location. So, essentially, if a rakghoul kills someone, it spawns another, as if they were infected and turned in to a rakghoul. I've been playing around but can't seem to figure out how to make it work quite right. Like a zombie effect.
Asgarath83 Posted January 10, 2016 Posted January 10, 2016 mmm, i think should be a force power of a custom rakghoul NPCs.check the code of the droid that disappering their model when they are destroyed (probe droid, mouse droid)This code spawn an effect on a point of a model. you need to make the code part inside an if brank like if (health => 0 && ((self->client->NPC_class != PUT THE CLASS YOU CHOICE FOR THE RAKGHOUL, SHOULD BE FINE RANCOR OR WAMPA CLASS IF YOU GOT AN ANPC WITH CUSTOM GLA ANIMATION. NPC &&Q_stricmp("Rakghoul",self->NPC_type))for make itG_PlayEffect( G_EffectIndex( "rakghoul/mutation" ), self->client->renderInfo.torsoPoint ); PUT REMOVAL BODY CODEPUT SPAWN RAKGHOUL NPC CODE.
Brownjor10 Posted January 10, 2016 Author Posted January 10, 2016 How do you put in a spawn command on here, though? you can't just type "npc spawn rakghoul" like you would in the console. That part has been confusing me. Thanks for the help too, by the way.
eezstreet Posted January 11, 2016 Posted January 11, 2016 I don't know how NPCs are spawned offhand (try looking at what happens in g_cmds.cpp), but your code should definitely be in player_die, in g_combat.cpp. It handles both NPCs and players. You'll want to check if the killer is a Rakghoul and the deceased is not a Rakghoul. I disagree entirely that it needs a new force power.
Brownjor10 Posted January 27, 2016 Author Posted January 27, 2016 So, I've done some new code adding and created my own spawn function now. It works. Problem is... it always spawns the new Rakghoul at the center point of the current level. I've been trying to set up a radius spawn, but I can't get it right. How do you get the code to record the last known position and spawn the new Rakghoul there? Asgarath83 likes this
eezstreet Posted January 28, 2016 Posted January 28, 2016 Can you show us what you've done? It's a simple add, but I'll need to see how you've implemented everything so far.
Brownjor10 Posted July 18, 2016 Author Posted July 18, 2016 if (self->client->NPC_class == CLASS_WAMPA){//spawns a rakghoulif (self->health >= 0 && (Q_stricmpn("rakghoul", self->NPC_type, 13) == 0)){SP_NPC_RAKGHOUL(G_Spawn(), 16);}} I have this set inside the G_combat file as a perimeter for future spawning. I'm having a lot of trouble figuring out how to set a spawn area, though. Right not it seems to be spawning him in origin of the level, half way in the ground. I don't know how to make it spawn where the victim it killed is. I've made various new functions because I couldn't figure out how to make the normal ones even spawn him. I think I'm making it way harder than it needs to be.Also, this is making another spawn when I kill the already spawned rakghoul, but I want it to spawn when the rakghoul kills someone else. I was trying to make it work like the force crystals that the shadowtroopers drop, so it just spawns out of their dead body.
Asgarath83 Posted July 19, 2016 Posted July 19, 2016 if (self->client->NPC_class == CLASS_WAMPA){//spawns a rakghoulif (self->health >= 0 && (Q_stricmpn("rakghoul", self->NPC_type, 13) == 0)){SP_NPC_RAKGHOUL(G_Spawn(), 16);}} I have this set inside the G_combat file as a perimeter for future spawning. I'm having a lot of trouble figuring out how to set a spawn area, though. Right not it seems to be spawning him in origin of the level, half way in the ground. I don't know how to make it spawn where the victim it killed is. I've made various new functions because I couldn't figure out how to make the normal ones even spawn him. I think I'm making it way harder than it needs to be. Also, this is making another spawn when I kill the already spawned rakghoul, but I want it to spawn when the rakghoul kills someone else. I was trying to make it work like the force crystals that the shadowtroopers drop, so it just spawns out of their dead body. well, in that case you need to check the force crystal code for see how it works. also maybe can be useful the code related about the NPC that spawns the pickables weapons when they are killed.But also you need to make something different because you not want to spawn a MD3 or a GLM model, you wanna to spawn an NPC. you need to do a perfect functionally NPC rakghoult model and to make a code that spawn this particular NPC like the shadowtroopers force crystal. spawning a model in this case is not useful, because the model is not setted with AI. you need to call an NPC by the death of another NPC.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now