does anybody know how to do this?
I need to know how to access the splitted gels ghost variables and how to check if two gels collide
Edited by Shadowblitz16, 01 January 2017 - 11:31 PM.
Posted 01 January 2017 - 10:47 PM
does anybody know how to do this?
I need to know how to access the splitted gels ghost variables and how to check if two gels collide
Edited by Shadowblitz16, 01 January 2017 - 11:31 PM.
Posted 02 January 2017 - 04:32 PM
does anybody know how to do this?
I need to know how to access the splitted gels ghost variables and how to check if two gels collide
To combine two npcs on collision, or based on distance, try:
const int NPC_COMBINE_DISTANCE = 10; const int COMBINE_ON_COLLISION = 0; //1 == collision, 0 == distance void CombineNPCs(int old_npc_id, int new_npc_id){ int npcs[3]; int q[2]; for ( q[0] = Screen->NumNPCs(); q[0] > 0; q[0]++ ) { npcs[0] = Screen->LoadNPC(q[0]); if ( npcs[0]->ID == old_npc_id ) { for ( q[1] = q[0]+1; q[1] <= Screen->NumNPCs(); q[1]++ ) { npcs[1] = Screen->LoadNPC(q[1]); if ( q[1]->ID == old_npc_id ) { if ( NPCS_COMBINE_ON_COLLISION ) { if ( Collision(npcs[0], npcs[1] ) { npcs[2] = Screen->CreateNPC(new_npc_id); Remove(npcs[0]); Remove([npcs[1]); } } else { if ( NPC_DistXY(npcs[0], npcs[1], NPC_COMBINE_DISTANCE ) { npcs[2] = Screen->CreateNPC(new_npc_id); Remove(npcs[0]); Remove([npcs[1]); } } } } } } } //base enemy, combine into, base enemy, combine into, ... int NPC_CombineList[]={NPC_GEL, NPC_ZOL, NPC_GELFIRE, NPC_ZOLFIRE}; void CombineNPCs(int list){ int npcs[3]; int q[10]; //q[5] = type q[4] = SizeOfArray(list) for ( q[0] = Screen->NumNPCs(); q[0] > 0; q[0]++ ) { npcs[0] = Screen->LoadNPC(q[0]); for ( q[3] = 0; q[3] < q[4]; q[3]+=2 ) { if ( npcs[0]->ID == q[3] ) { q[5] = list[ q[3] ]; for ( q[1] = q[0]+1; q[1] <= Screen->NumNPCs(); q[1]++ ) { npcs[1] = Screen->LoadNPC(q[1]); if ( q[1]->ID == q[5] ) { if ( NPCS_COMBINE_ON_COLLISION ) { if ( Collision(npcs[0], npcs[1] ) { npcs[2] = Screen->CreateNPC(new_npc_id); Remove(npcs[0]); Remove([npcs[1]); } } else { if ( NPC_DistXY(npcs[0], npcs[1], NPC_COMBINE_DISTANCE ) { npcs[2] = Screen->CreateNPC(new_npc_id); Remove(npcs[0]); Remove([npcs[1]); } } } } } } } } bool NPC_DistXY(npc a, npc b, int distance) { int distx; int disty; if ( a->X > b->X ) distx = a->X - b->X; else distx = b->X - a->X; if ( a->Y > b->Y ) disty = a->Y - b->Y; else disty = b->Y - a->Y; return ( distx <= distance && disty <= distance ); }
Posted 02 January 2017 - 04:55 PM
thankyou but I don't understand your code
also what about editing spawned gels attribute for splitting?
I need to edit their Ghost_Jump variables
Edited by Shadowblitz16, 02 January 2017 - 05:19 PM.
Posted 02 January 2017 - 05:39 PM
Posted 02 January 2017 - 07:29 PM
ZoriaRPG I don't like the way the slime split works in zquest also I don't know how to access the ghost variables from a spawned enemy from i n the enemy that spawned it
also I mean't like I don't understand your code I would like to understand it so that I can learn from it. can you comment telling me what everything is and does?
Posted 02 January 2017 - 08:16 PM
ZoriaRPG I don't like the way the slime split works in zquest also I don't know how to access the ghost variables from a spawned enemy from i n the enemy that spawned it
also I mean't like I don't understand your code I would like to understand it so that I can learn from it. can you comment telling me what everything is and does?
Edited by ZoriaRPG, 02 January 2017 - 08:36 PM.
Posted 02 January 2017 - 09:40 PM
thankyou so much I will review the code
however I have one more question
is there a way to set a script to run when a ghosted enemy dies?
right now I am checking if the enemy is dead after every waitframe and before every loop in my slime script however it doesn't seem like its working.
Posted 02 January 2017 - 09:45 PM
thankyou so much I will review the code
however I have one more question
is there a way to set a script to run when a ghosted enemy dies?
right now I am checking if the enemy is dead after every waitframe and before every loop in my slime script however it doesn't seem like its working.
if ( ghost->HP <= 0 ) RunFFCScript(...);You can also call RunFFCScript() in your Ghost_Waitframe(), if you wrote a custom Ghost_Waitframe() function for the enemy.
Posted 02 January 2017 - 11:30 PM
ok thankyou so much you've been very helpful
sadly I forgot to ask one of my questions when I actually said it was my last question
however I'm going to aks it anyways
is there a way to make the slimes death effect not fall when the slime is killed in the air?
right now when I kill the slime in the air the death effect falls like the slime is falling
Posted 03 January 2017 - 11:41 AM
ok thankyou so much you've been very helpful
sadly I forgot to ask one of my questions when I actually said it was my last question
however I'm going to aks it anyways
is there a way to make the slimes death effect not fall when the slime is killed in the air?
right now when I kill the slime in the air the death effect falls like the slime is falling
Posted 03 January 2017 - 12:04 PM
ok thankyou
EDIT: ZoriaRPG you never set "old_npc_id" to anything what is it supposed to be?
I'm guessing the gel from the first loop index right?
EDIT 2: you also seem to use an int to store your loaded npc's which throws an error
EDIT 3: setting Ghost_Jump to 0 is not working with the falling death effect it still seems to fall to the ground
Edited by Shadowblitz16, 03 January 2017 - 03:09 PM.
Posted 03 January 2017 - 03:09 PM
ZoriaRPG you there?
I have this code right here
but it seems that the gels z position are being set to what the jump should be even though I have no code setting it 60/10
right now the gels warp up high with the additional jump velocity when splitting instead of starting at the zols z position with the additional jump velocity
void Zol_Tribble(ffc this, npc ghost, int child, int height, bool tribble) { if (!tribble) return; if (Ghost_GotHit() && Ghost_HP > -999 ) { //If the base enemy is at the brink of death... //Stop slime velocity Ghost_Vx = 0; Ghost_Vy = 0; //Check if flash flag is set and if so flash if (Z4ZOL_FLASH_BEFORE_SPLIT) { Ghost_StartFlashing(32); Ghost_Waitframes(this, ghost, false, false, 32); } //Spawn smaller slimes npc gel1 = Screen->CreateNPC(child); //Create two enemies in its place. npc gel2 = Screen->CreateNPC(child);//Based on its 'Death Attribute 3' value. //If we set a sound for tribbling npcs, play it. if ( Z4ZOL_TRIBBLE_SFX > 0 ) Game->PlaySound(0); //Spawn smaller slime 1 and set its x, y, and jump gel1->X = Ghost_X + 1 * 4; //Place the new npcs at the location of the gel1->Y = Ghost_Y + 0; //enemy that we are replacing, -/+ gel1->Z = Ghost_Z; if (Z4ZOL_BOUNCE_AFTER_TRIBBLE) gel1->Jump = 60/10; //Spawn smaller slime 2 and set its x, y, and jump gel2->X = Ghost_X - 1 * 4; //a randomised distance. gel2->Y = Ghost_Y + 0; gel2->Z = Ghost_Z; if (Z4ZOL_BOUNCE_AFTER_TRIBBLE) gel2->Jump = 60/10; //Silently kill the bigger slime, removing it fully. Ghost_HP = -9999; Ghost_X = -9999; Ghost_Y = -9999; } }
Edited by Shadowblitz16, 03 January 2017 - 06:02 PM.
Posted 04 January 2017 - 01:20 AM
ZoriaRPG you there?
I have this code right here
but it seems that the gels z position are being set to what the jump should be even though I have no code setting it 60/10
gel2->Z = Ghost_Z; if (Z4ZOL_BOUNCE_AFTER_TRIBBLE) gel2->Jump = 60/10;
//Silently kill the bigger slime, removing it fully. Ghost_HP = -9999; Ghost_Z = 0; ghost->Jump = 0;Also...
if (Ghost_GotHit() && Ghost_HP > -999 ) { //If the base enemy is at the brink of death...You probably want:
if (Ghost_GotHit() && Ghost_HP > -999 && Ghost_HP <= 0 ) { //If the base enemy is at the brink of death...Hell, the function isn't even setting up the Ghost_* values, and there are no inputs for them. Ghost.zh might be able to live with that, though.
Edited by ZoriaRPG, 04 January 2017 - 01:31 AM.
Posted 04 January 2017 - 02:16 PM
I am trying to make the gels split when they are hit not when they die
then I want to make them flash a while if a certain constant is set and then I want to set their z position(jump position) to that of the zol and then add z velocity(jump velocity)
the function Ghost_GotHit() said in the Ghost.zh docs that it didn't take any parameters
also I am using the child and height variable I just set the to values so you know what they were and I am dividing height by 10 so they people can specify a more accurate jump height
also the script you gave me look fine now that I look at it I will get back to you if it throws any more errors
0 members, 0 guests, 0 anonymous users