• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed Problem with companions firing rockets

Bartolomeu o Portugues

Buccaneer
Staff member
Administrator
Storm Modder
Storm Modeller
Pieter, I found a weird behaviour with the rockets. When my companions use them. They explode at my feet :unsure
 
Pieter, I found a weird behaviour with the rockets. When my companions use them. They explode at my feet :unsure
Must be related to this code by @Jack Rackham in quests_common.c:
Code:
    case "pchar_rocket_hit":
       GetCharacterPos(Pchar, &x, &y, &z);
       CreateParticleSystem("canfire" , x, y, z, 5.1, 4.0, 0.0, sti(20) );     //nr 18
       CreateParticleSystem("blast" , x, y, z, 5.1, 4.0, 0.0, sti(20) );     //nr 35
       CreateParticleSystem("blast_dirt_small" , x, y, z, 5.1, 4.0, 0.0, sti(20) );   //nr 31
       CreateParticleSystem("splinters" , x, y+1.2, z, 5.1, 4.0, 0.0, sti(20) );
       CreateParticleSystem("splinters2" , x, y+1.2, z, 5.1, 4.0, 0.0, sti(20) );

       PlaySound("OBJECTS\DUEL\pistol_mtoon.wav");
     break;

     case "NPC_rocket_hit":
       NPChar = characterFromID(Pchar.npc_rocket);
       GetCharacterPos(NPchar, &u, &v, &w);
       CreateParticleSystem("canfire" , u, v, w, 5.1, 4.0, 0.0, sti(20) );     //nr 18
       CreateParticleSystem("blast" , u, v, w, 5.1, 4.0, 0.0, sti(20) );     //nr 35
       CreateParticleSystem("blast_dirt_small" , u, v, w, 5.1, 4.0, 0.0, sti(20) );   //nr 31
       CreateParticleSystem("splinters" , u, v+1.2, w, 5.1, 4.0, 0.0, sti(20) );
       CreateParticleSystem("splinters2" , u, v+1.2, w, 5.1, 4.0, 0.0, sti(20) );
     
       PlaySound("OBJECTS\DUEL\pistol_mtoon.wav");
     break;
Do you know which quest case it is executing when it explodes at your feet? Check compile.log .
 
Probem is probally in here:
Code:
NPChar = characterFromID(Pchar.npc_rocket);

Cause the Pchar didnt fire it the game doesn't know who shot it....
 
I don't think I made cases for officers. Sorry I don't have time to check now.
In fact, I use the function LAi_SetOfficerType for the Portuguese troops following me. That's pretty funny to see them targeting someone in the opposite side and the rocket coming back to me to explode :D
 
Maybe I can find some time tomorrow (in school) to see if I can fix that.
Would be nice. Else I might have some time also later to fix it but please try first :). It shouldn't be that hard to fix it I think.
We just need to save the character.id of the person shooting somewhere and call this character instead of using PChar.
 
I like what your saying because that's exactly what I never have been able to do with
the standard mket/mtoon. I'll discuss that further with you at a later moment.
Have to pack my things now (my computer) for another very long car trip.
 
If you do want to get into doing it PROPERLY, don't forget about EventHandlers. I think those are technically the best way to do it.
Bit more "programmy" but it can work very well. I've used them in the past.
 
Back
Top