Author Topic: How to make a PC inoffensive?  (Read 521 times)

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« on: July 24, 2014, 12:24:38 am »


               

I mean it can't use melee attacks, ranged attacks and no magic.


 


There is a way to do it? this will be very useful 



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #1 on: July 24, 2014, 12:31:07 am »


               

I would like to give inoffensive status to PC OnClickTransition to watch arena-coliseu battles.


 


I am having troubles like this =/


 


coliseutrouble.png



               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #2 on: July 24, 2014, 12:34:52 am »


               

I think the best way would be to create two factions. One for one arena combatant, another for the other. Set both factions to be hostile towards each other, but not hostile to players, defenders, commoners, or merchant faction. That way they duke it out without ever targeting anyone but each other.



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #3 on: July 24, 2014, 12:44:09 am »


               

Good idea... Is possible to change only the audience faction? 



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #4 on: July 24, 2014, 12:44:45 am »


               

It would be resolved changing the pvp settings to entering objects?



               
               

               


                     Modifié par WhiteTiger, 23 juillet 2014 - 11:58 .
                     
                  


            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #5 on: July 24, 2014, 01:04:53 am »


               

You could make the entire audience one faction if you wanted. You could just leave them as whatever you default them, probably commoner. As long as the custom factions aren't hostile towards the commoner faction they won't touch them. The only thing I might be concerned about is AoE spells being thrown around and blowing people up near the combatants. Though I think there is some switch that prevents neutral NPC's from being hurt by AoE spells in the x2_mod_def_load script. My memory is a little fuzzy on that matter.


 


PVP settings don't matter. Unless players are facing each other in the arena that is. 



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #6 on: July 24, 2014, 01:16:06 am »


               

If we give a friendly faction to PC he would be able to attacks, just clicking Shift + Attack, is allowed?



               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #7 on: July 24, 2014, 01:37:31 am »


               

He would be able to attack. The best option would probably be to make the enemy attack the PC first. It's always best to do this in my experience, but I'm sure there are ways around it. Factions can be twitchy. I always remove the GlobalEffect from every faction just to help. 



#include "NW_I0_GENERIC"
void main()
{
    SetIsTemporaryEnemy(oPC);
    DetermineCombatRound();

Just capture the PC through whatever means you need to. Like at the end of a conversation between the combatant and the player could use GetPCSpeaker(). If the PC attacks first without the enemy being hostile it can change the entire factions rep to the PC, and if you change the faction rep it affects everyone in that faction.


 


Also... not sure if you know this from your last statement. The PC has no faction. At least not one that can be toyed with and manipulated the same way as NPC. 


 


Here's a good read to kind of get you into factions. 


 


http://www.nwnlexico...acking_My_Enemy



               
               

               
            

Legacy_Frush O'Suggill

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #8 on: July 24, 2014, 03:49:05 am »


               

If I understand your intentions, what you might want to try is:


 


Create two new factions. Set each to be friendly to players, hostile to each other, and neutral to everything else. Set the area as no-PVP. The players will not be able to attack either combatant, but they will attack each other.



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #9 on: July 24, 2014, 04:19:36 am »


               

why the enemy needs to attack the combatant first?



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #10 on: July 24, 2014, 04:27:40 am »


               

we would need to give friendly faction to the audience for the creature not intend to attack him. how to do it?


 


could apply these actions on door transitions using oPC = GetEnteringObject() or we could apply by a trigger on the floor (entering arena / exiting arena)  because there is too much doors transitions so we can only pinch on the floor a lot of blueprint triggers


 


//EDIT


 


Or the enemy could be commoner and we just use 



SetIsTemporaryEnemy(oPC);

 to fighters


 


// it's ok for now, but the audience continues able to attack the fighters



               
               

               


                     Modifié par WhiteTiger, 24 juillet 2014 - 09:59 .
                     
                  


            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #11 on: July 24, 2014, 05:20:05 am »


               

Well done, everybody.


 


I used EffectSpellFailure() and a variable to cancell ranged attacks.


 


This script is on a trigger that activates only when someone enters the Coliseum



void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC)) return;
    if (GetIsDM(oPC)) return;

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectSpellFailure(), oPC);
    SetLocalInt(oPC, "arena", TRUE);
}

this way no spells can be casted there and who attack the combatant we will use effectpetrify in the event OnDamaged. this way:


 


if(GetLocalInt(oPC, "arena") == TRUE) EffectPetrify(oPC) (last attacker)


 


 


//EDIT


Thanks to Shadooow I just remembered when he said to me use this code in my werewolf system


 


 


//edit2


 


and thanks to mad poet for help



               
               

               


                     Modifié par WhiteTiger, 24 juillet 2014 - 06:10 .
                     
                  


            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #12 on: July 24, 2014, 07:29:59 am »


               

I'm just happy it all worked out for ya!  '<img'>



               
               

               
            

Legacy_WhiteTiger

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #13 on: August 02, 2014, 11:20:20 am »


               

note: player can use epic spells and scrolls on coliseu audience


 


I blocked the epic spells editing spell scripts


 


if(GetLocalInt(oPC, "arena") return;


 


But I dont know how to block scroll uses. Anybody know?



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
How to make a PC inoffensive?
« Reply #14 on: August 02, 2014, 11:35:34 am »


               


note: player can use epic spells and scrolls on coliseu audience


 


I blocked the epic spells editing spell scripts


 


if(GetLocalInt(oPC, "arena") return;


 


But I dont know how to block scroll uses. Anybody know?




wrong way to do it, use spellhook


 


if you dont have spellhook set yet either set it, instructions in the link above or since you have 1.71 you can use internal spellhook to do it, open 70_spellhook, locate void main()


and add this line under declared variables:


if(GetLocalInt(OBJECT_SELF, "arena"))


{


SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);

return;


}


 


this code will work in regular spellhook which is preffered to use though (since 70_spellhook might change in next CPP version and you would have to delete it and do this change again to get new features)