Forums
Games
Cyberpunk 2077 Thronebreaker: The Witcher Tales GWENT®: The Witcher Card Game The Witcher 3: Wild Hunt The Witcher 2: Assassins of Kings The Witcher The Witcher Adventure Game
Jobs Store Support Log in Register
Forums - CD PROJEKT RED
Menu
Forums - CD PROJEKT RED
  • Hot Topics
  • NEWS
  • GENERAL
    THE WITCHER ADVENTURE GAME
  • STORY
    THE WITCHER THE WITCHER 2 THE WITCHER 3 THE WITCHER TALES
  • GAMEPLAY
    THE WITCHER THE WITCHER 2 THE WITCHER 3 MODS (THE WITCHER) MODS (THE WITCHER 2) MODS (THE WITCHER 3)
  • TECHNICAL
    THE WITCHER THE WITCHER 2 (PC) THE WITCHER 2 (XBOX) THE WITCHER 3 (PC) THE WITCHER 3 (PLAYSTATION) THE WITCHER 3 (XBOX) THE WITCHER 3 (SWITCH)
  • COMMUNITY
    FAN ART (THE WITCHER UNIVERSE) FAN ART (CYBERPUNK UNIVERSE) OTHER GAMES
  • RED Tracker
    The Witcher Series Cyberpunk GWENT
THE WITCHER
THE WITCHER 2
THE WITCHER 3
MODS (THE WITCHER)
MODS (THE WITCHER 2)
MODS (THE WITCHER 3)
Menu

Register

[Mod Help] Making guards angry on command

+
Z

Zhior

Forum regular
#1
Sep 13, 2015
[Mod Help] Making guards angry on command

I'm currently looking for a way to trigger the guards hostility but I've had no luck finding the function or whatever that does this. I was hoping someone would help me.
 

Guest 2364765

Guest
#2
Sep 13, 2015
Depends on how you want to do that.
You may try using
FactsAdd( "guards_alerted" );
 
  • RED Point
Reactions: Zhior
Z

Zhior

Forum regular
#3
Sep 14, 2015
Hey thanks for the reply. I'm a fan of your mods btw. I probably should've explained what I aim to do. I'm trying to make a mod that will make guards hostile towards you depending on the armor you're wearing.

After a lot of trial and error (I'm fairly new to all this but trying to learn as much as I can) I managed to discover how to determine if the player is wearing a specific armor set. Unfortunately that's all I've got so far. I don't know how to add something that will make guards notice if you are wearing that specific armor or how to make them turn on you.

If you've got any ideas I'd love to hear them.

Edit: Oh and your suggestion didn't work unfortunately, at least not the way I tried to implement it.
 
Last edited: Sep 14, 2015

Guest 2364765

Guest
#4
Sep 14, 2015
Well, other solution i can think of would be to add a repeating timer whenever player wears desired armor.
Something like this:
timer function angryguards( deltaTime : float, id : int )
{
var actors : array<CActor>;
var npc : CNewNPC;
var i : int;

actors = GetActorsInRange(thePlayer, 100, 99);
for(i = 0; i < actors.Size(); i += 1)
{
npc = ((CNewNPC)actors);
if(npc.GetNPCType() == ENGT_Guard)
{
((CActor)npc).SetAttitude( thePlayer, AIA_Hostile );
}
}

}
Click to expand...
 
  • RED Point
Reactions: Zhior
Z

Zhior

Forum regular
#5
Sep 15, 2015
Ok so I combined your suggestion with what little I had:

if( witcher && witcher.GetItemEquippedOnSlot(EES_Armor, armor) )
if( GetInventory().GetItemName(armor) == 'DLC1 Temerian Armor' )
for(i = 0; i < actors.Size(); i += 1)
{
npc = ((CNewNPC)actors);
if(npc.GetNPCType() == ENGT_Guard)
((CActor)npc).SetAttitude( thePlayer, AIA_Hostile );
}

I am able to run this function with a specific trigger but I don't understand how the "timer function" works. I tried adding the whole function to the CActor class (actor.ws) but it doesn't work..

Also would you happen to know if the game differentiates between the different types of guards? Or are they all included in ENGT_GUARD? As you can probably tell by my code, I want Redanian and Nilfgaardian soldiers to react differently.

Thanks so much for your help man, I really appreciate it.
 
Last edited: Sep 15, 2015

Guest 2364765

Guest
#6
Sep 15, 2015
Zhior said:
Ok so I combined your suggestion with what little I had:

if( witcher && witcher.GetItemEquippedOnSlot(EES_Armor, armor) )
if( GetInventory().GetItemName(armor) == 'DLC1 Temerian Armor' )
for(i = 0; i < actors.Size(); i += 1)
{
npc = ((CNewNPC)actors);
if(npc.GetNPCType() == ENGT_Guard)
((CActor)npc).SetAttitude( thePlayer, AIA_Hostile );
}

I am able to run this function with a specific trigger but I don't understand how the "timer function" works. I tried adding the whole function to the CActor class (actor.ws) but it doesn't work..

Also would you happen to know if the game differentiates between the different types of guards? Or are they all included in ENGT_GUARD? As you can probably tell by my code, I want Redanian and Nilfgaardian soldiers to react differently.

Thanks so much for your help man, I really appreciate it.
Click to expand...

just find a timer function inside any class and copy it. Bear in mind that currently timer functions only work inside classes that have timer functions.
As for the different guards, reacting differently, only method i can imagine would be to filter by entity template.

You'd need to get CEntity of each guard and use entity.GetReadableName(). Possibly you could use either popup or hud message to display the paths and write them down.

Then just filter them by that readable name.
 
Z

Zhior

Forum regular
#7
Sep 15, 2015
Holy shit, you're awesome. I got it working! I'll try to differentiate between guards when I get back from school today.
 
Last edited: Sep 15, 2015
Share:
Facebook Twitter Reddit Pinterest Tumblr WhatsApp Email Link
  • English
    English Polski (Polish) Deutsch (German) Русский (Russian) Français (French) Português brasileiro (Brazilian Portuguese) Italiano (Italian) 日本語 (Japanese) Español (Spanish)

STAY CONNECTED

Facebook Twitter YouTube
CDProjekt RED Mature 17+
  • Contact administration
  • User agreement
  • Privacy policy
  • Cookie policy
  • Press Center
© 2018 CD PROJEKT S.A. ALL RIGHTS RESERVED

The Witcher® is a trademark of CD PROJEKT S. A. The Witcher game © CD PROJEKT S. A. All rights reserved. The Witcher game is based on the prose of Andrzej Sapkowski. All other copyrights and trademarks are the property of their respective owners.

Forum software by XenForo® © 2010-2020 XenForo Ltd.