Jump to content

New and Improved Vardenfell Citizens


Recommended Posts

Changes:
=================================================================================================================
Citizens now attack if you ready your attack too close to them

Getting in a confrontation with a hostile citizen like a thug triggers a global variable used in the Citizen script

 

This means that nearby citizens will be alerted that you are trying to defend yourself and allow you to keep your attack readied by them untill the Thug or other script/scripts reset the global.

If you run away for a certain distance without equipping your bow, crossbow, or thrown weapon, The Citizens will continue to follow assuming you are trying to shoot them until you lower your weapon or equip a mellee weapon.

I have more to but it is working pretty good so far. The potion feature needs some tinkering. Hopefully I can get that fixed up and add a few more features like looting the player on 0 stamina ( Knockdown ), Staring causes fights, begging, and some dialogue options for when either fighter hits the ground. I have to recreate my NPC's and leveled lists but i got the leveled items complete and spawns placed in Balmora and Seyda Neen. If I have anymore progress I will share my findings with you all.

 

 

 

 

=================================================================================================================
CODE START: Citizen
=================================================================================================================
begin CitizenTest

float timer
short mode
short combatstatus
short hpotiontype
short fpotiontype
short mpotiontype
short scripthasstarted

elseif ( scripthasstarted != 1 )
if ( mode != 0 )
set scripthasstarted to 1
set mode to 0
endif
endif

if ( GetHealth < 50 )
set mode to 2
endif

if ( GetFatigue < 25 )
set mode to 3
endif

if ( GetMagicka < 1 )
set mode to 4
endif

if ( mode == 0 )
set mode to 1
if ( IsPlayerInCombat == 1 )
if ( GetDistance, Player < 125 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 1
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat
set combatstatus to 0
set mode to 1
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 1
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 1
endif
endif
endif
if ( GetDistance, Player > 500 )
if ( combatstatus == 1 )
StopCombat
set combatstatus to 0
set mode to 1
if ( Player->GetWeaponType == 9 )
set mode to 1
endif
if ( Player->GetWeaponType == 11 )
set mode to 1
endif
if ( Player->GetWeaponType == 13 )
set mode to 1
endif
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat
set combatstatus to 0
set mode to 1
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
if ( Player->GetWeaponType == -1 )
set mode to 1
endif
if ( Player->GetWeaponType == 0 )
set mode to 0
endif
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 1
endif
endif
endif
endif
if ( IsPlayerInCombat == 0 )
if ( GetDistance, Player < 125 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 1
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat
set combatstatus to 0
set mode to 1
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
StartCombat, Player
set combatstatus to 1
set mode to 1
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 1
endif
endif
endif
if ( GetDistance, Player > 500 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
StopCombat
set combatstatus to 0
set mode to 1
if ( Player->GetWeaponType == 9 )
set mode to 1
endif
if ( Player->GetWeaponType == 11 )
set mode to 1
endif
if ( Player->GetWeaponType == 13 )
set mode to 1
endif
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat, Player
set combatstatus to 0
set mode to 1
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 1
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 1
endif
endif
endif
endif
endif

if ( mode == 1 )
set mode to 0
if ( IsPlayerInCombat == 1 )
if ( GetDistance, Player < 125 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 0
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat
set combatstatus to 0
set mode to 1
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 0
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 0
endif
endif
endif
if ( GetDistance, Player > 500 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
if ( Player->GetWeaponType == 9 )
set mode to 0
endif
if ( Player->GetWeaponType == 11 )
set mode to 0
endif
if ( Player->GetWeaponType == 13 )
set mode to 0
endif
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat
set combatstatus to 0
set mode to 0
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
if ( Player->GetWeaponType == -1 )
set mode to 0
endif
if ( Player->GetWeaponType == 0 )
set mode to 0
endif
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 0
endif
endif
endif
endif
if ( IsPlayerInCombat == 0 )
if ( GetDistance, Player < 125 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 0
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat
set combatstatus to 0
set mode to 0
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
StartCombat, Player
set combatstatus to 1
set mode to 0
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 0
endif
endif
endif
if ( GetDistance, Player > 500 )
if ( combatstatus == 1 )
if ( Player->GetWeaponDrawn == 1 )
StopCombat
set combatstatus to 0
set mode to 0
if ( Player->GetWeaponType == 9 )
set mode to 0
endif
if ( Player->GetWeaponType == 11 )
set mode to 0
endif
if ( Player->GetWeaponType == 13 )
set mode to 0
endif
endif
if ( Player->GetWeaponDrawn == 0 )
StopCombat, Player
set combatstatus to 0
set mode to 0
endif
endif
if ( combatstatus == 0 )
if ( Player->GetWeaponDrawn == 1 )
set mode to 0
endif
if ( Player->GetWeaponDrawn == 0 )
set mode to 0
endif
endif
endif
endif
endif

if ( mode == 2 )
set mode to 0
if ( GetItemCount, "p_restore_health_s" > 0 )
AddSpell, "_NPCRestoreHealthB"
set hpotiontype to 1
set mode to 5
endif
if ( GetItemCount, "p_restore_health_q" > 0 )
AddSpell, "_NPCRestoreHealthB"
set hpotiontype to 2
set mode to 5
endif
if ( GetItemCount, "p_restore_health_e" > 0 )
AddSpell, "_NPCRestoreHealthB"
set hpotiontype to 3
set mode to 5
endif
if ( GetItemCount, "p_restore_health_c" > 0 )
AddSpell, "_NPCRestoreHealthB"
set hpotiontype to 4
set mode to 5
endif
if ( GetItemCount, "p_restore_health_b" > 0 )
AddSpell, "_NPCRestoreHealthB"
set hpotiontype to 5
set mode to 5
endif
endif

if ( mode == 3 )
set mode to 0
if ( GetItemCount, "p_restore_fatigue_s" > 0 )
AddSpell, "_NPCRestoreFatigueB"
set fpotiontype to 1
set mode to 6
endif
if ( GetItemCount, "p_restore_fatigue_q" > 0 )
AddSpell, "_NPCRestoreFatigueB"
set fpotiontype to 2
set mode to 6
endif
if ( GetItemCount, "p_restore_fatigue_e" > 0 )
AddSpell, "_NPCRestoreFatigueB"
set fpotiontype to 3
set mode to 6
endif
if ( GetItemCount, "p_restore_fatigue_c" > 0 )
AddSpell, "_NPCRestoreFatigueB"
set fpotiontype to 4
set mode to 6
endif
if ( GetItemCount, "p_restore_fatigue_b" > 0 )
AddSpell, "_NPCRestoreFatigueB"
set fpotiontype to 5
set mode to 6
endif
endif

if ( mode == 4 )
set mode to 0
if ( GetItemCount, "p_restore_magicka_s" > 0 )
AddSpell, "_NPCRestoreMagickaB"
set mpotiontype to 1
set mode to 7
endif
if ( GetItemCount, "p_restore_magicka_q" > 0 )
AddSpell, "_NPCRestoreMagickaB"
set mpotiontype to 2
set mode to 7
endif
if ( GetItemCount, "p_restore_magicka_e" > 0 )
AddSpell, "_NPCRestoreMagickaB"
set mpotiontype to 3
set mode to 7
endif
if ( GetItemCount, "p_restore_magicka_c" > 0 )
AddSpell, "_NPCRestoreMagickaB"
set mpotiontype to 4
set mode to 7
endif
if ( GetItemCount, "p_restore_magicka_b" > 0 )
AddSpell, "_NPCRestoreMagickaB"
set mpotiontype to 5
set mode to 7
endif
endif

if ( mode == 5 )
set mode to 0
if ( hpotiontype == 1 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreHealthB"
set hpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( hpotiontype == 2 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreHealthB"
set hpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( hpotiontype == 3 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreHealthB"
set hpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( hpotiontype == 4 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreHealthB"
set hpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( hpotiontype == 5 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreHealthB"
set hpotiontype to 0
set timer to 0
set mode to 0
endif
endif
endif

if ( mode == 6 )
set mode to 0
if ( fpotiontype == 1 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreFatigueB"
set fpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( fpotiontype == 2 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreFatigueB"
set fpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( fpotiontype == 3 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreFatigueB"
set fpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( fpotiontype == 4 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreFatigueB"
set fpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( fpotiontype == 5 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreFatigueB"
set fpotiontype to 0
set timer to 0
set mode to 0
endif
endif
endif

if ( mode == 7 )
set mode to 0
if ( mpotiontype == 1 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreMagickaB"
set mpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( mpotiontype == 2 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreMagickaB"
set mpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( mpotiontype == 3 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, "_NPCRestoreMagickaB"
set mpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( mpotiontype == 4 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, _NPCRestoreMagickaB
set mpotiontype to 0
set timer to 0
set mode to 0
endif
endif
if ( mpotiontype == 5 )
set timer to ( timer + GetSecondsPassed )
if ( timer > 5 )
RemoveSpell, _NPCRestoreMagickaB
set mpotiontype to 0
set timer to 0
set mode to 0
endif
endif
endif

end CitizenTest
=================================================================================================================
CODE END: Citizen
=================================================================================================================
=================================================================================================================
CODE START: Thug
=================================================================================================================
begin _Thug

short mode
short combatstatus

if ( mode == 0 )
if ( GetDistance, Player < 150 )
if ( combatstatus == 1 )
set mode to 1
endif
if ( combatstatus == 0 )
StartCombat, Player
set IsPlayerInCombat to 1
set combatstatus to 1
set mode to 1
endif
endif
if ( GetDistance, Player > 600 )
if ( combatstatus == 1 )
StopCombat
set IsPlayerInCombat to 0
set combatstatus to 0
set mode to 1
endif
if ( combatstatus == 0 )
set mode to 1
endif
endif
endif

if ( mode == 1 )
if ( GetDistance, Player < 150 )
if ( combatstatus == 1 )
set mode to 0
endif
if ( combatstatus == 0 )
StartCombat, Player
set IsPlayerInCombat to 1
set combatstatus to 1
set mode to 0
endif
endif
if ( GetDistance, Player > 600 )
if ( combatstatus == 1 )
StopCombat
set IsPlayerInCombat to 0
set combatstatus to 0
set mode to 0
endif
if ( combatstatus == 0 )
set mode to 0
endif
endif
endif

end _Thug
=================================================================================================================
CODE END: Thug
=================================================================================================================

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...