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

Magic shield from Act 2

+
S

Silderon

Senior user
#1
Dec 25, 2013
Magic shield from Act 2

Hey guys!
I wanted to use a shield against undead warriors (shield is used by Detmold\Filippa in the original game). I found out that you need to add a special item to a NPCs character and after that shield will appear. It does work: shield appeared but it doesn't affect monsters. I looked for a script of shield-item and I found it in q201_magic_shield.ws
Here is a piece I'm interested in:

Code:
event OnInteractionActivated( interactionName : name, activator : CEntity )
	{
		var actor : CActor;
		
		actor = (CActor)activator;
		encounter = (CEncounter) theGame.GetNodeByTag('quest_fog_main_encounter');
		
		if(activator.HasTag('monster') && enable)
		{
			if (((CActor)activator).GetCharacterStats().HasAbility('q201 lethal dmg ability'))
			{
				actor.GetCharacterStats().RemoveAbility( 'q201 lethal dmg ability' );
				actor.DecreaseHealth(((CActor)activator).initialHealth * 0.7 , true, NULL );
				actor.PlayEffect('medalion_detection_fx', actor);
				if(FactsQuerySum('owl_stopped') != 1)
				{
					actor.GetCharacterStats().AddAbility( 'q201 damage on time for monster' );
					actor.PlayEffect('magic_shield_hit', actor);
					MagicLightning(actor, fogGuide);
				}
				
			}
			else
			{
				actor.DecreaseHealth(((CActor)activator).initialHealth * 0.7 , true, NULL );
				actor.PlayEffect('medalion_detection_fx',actor);
				if(FactsQuerySum('owl_stopped') != 1)
				{
					actor.GetCharacterStats().AddAbility( 'q201 damage on time for monster' );
					actor.PlayEffect('magic_shield_hit', actor);
					MagicLightning(actor, fogGuide);
				}
				
			}
		}
		else if(activator == thePlayer && enable)
		{
			AreaEnvironmentDeactivate("AreaEnvironment_boss_out");
			AreaEnvironmentActivate("AreaEnvironment_boss1");
		
			if (thePlayer.GetCharacterStats().HasAbility('q201 damage on time for player'))
			{
				thePlayer.GetCharacterStats().RemoveAbility( 'q201 damage on time for player' );
			}
			if(FactsQuerySum('owl_stopped') == 1)
			{
				encounter.SetEnableState(false);
				Log("MAIN FOG ENCOUNTER" + encounter + " IS ENABLED = " + encounter.IsEncounterActive() );
			}
			
		}
	}
	event OnInteractionDeactivated( interactionName : name, activator : CEntity )
	{
	
		var actor : CActor;
		actor = (CActor)activator;
		encounter = (CEncounter) theGame.GetNodeByTag('quest_fog_main_encounter');
		
		if(activator.HasTag('monster')&& enable)
		{
			//actor.GetCharacterStats().AddAbility( 'q201 lethal dmg ability' );
			actor.GetCharacterStats().RemoveAbility( 'q201 damage on time for monster' );
			actor.StopEffect('medalion_detection_fx');
			actor.StopEffect('magic_shield_hit');
		}
		else if(activator == thePlayer && enable)
		{
			thePlayer.GetCharacterStats().AddAbility( 'q201 damage on time for player' );
			AreaEnvironmentDeactivate("AreaEnvironment_boss1");
			AreaEnvironmentActivate("AreaEnvironment_boss_out");
			
			if(FactsQuerySum('owl_stopped') == 1)
			{
				encounter.SetEnableState(true);
				Log("MAIN FOG ENCOUNTER" + encounter + " IS ENABLED = " + encounter.IsEncounterActive() );
			}
			
		}
	}
But in the game if works only if player character is out of shield (he takes damage like in the original game) and in the shield (he doesn't take damage from not being outside the shield area). If someone else passes through the shield, nothing happens.
My first guess was that the monster-condition is wrond, but here what we have:
Code:
if(activator.HasTag('monster') && enable)
it must have "monster" tag (done, cause all the monsters have that tag) and something should be enabled. As long as conditions for player work fine and there we have "enable"-condition too, I am pretty sure that "something" is enabled.
So what can be a reason for none-reacting on monsters?
As a shield carrier I use q201_detmold_guide entity template (the same that is used in the original game). Monsters are spawned via Entity Spawner.
 
Last edited: Dec 25, 2013
S

shak-otay

Senior user
#2
Dec 25, 2013
Hi Milten,
your post is hard to read/understand.

I really would recommend you to start scriptStudio and try to set a breakpoint (BP) in the event OnInteractionActivated().
Then activate the shield ingame.

In case the BP is hit you can step through the script which will make it easier to understand what's going on.

(I know from experience that breakpoints don't work in some scripts but anyway you should try.)

btw: "enable" seems to be a boolean that shows whether the shield is active or not (but I'm not sure on this, see event OnSpawned(), event OnDestroyed() )
 
Last edited: Dec 25, 2013
S

Silderon

Senior user
#3
Dec 25, 2013
Is it hard to read cause my English is not very good or why?
A noob question: how can I run scriptStudio? I made all my changes in Notepad++.
Can you tell me more abour those breakpoints? I have never worked with them earlier.
 
S

shak-otay

Senior user
#4
Dec 25, 2013
Milten said:
Is it hard to read cause my English is not very good or why?
Click to expand...
Your english is, well, ok so far (don't think that mine is better).
But I read your post 3 times and still had to guess what you mean exactly.
But don't worry - that may also be caused by the fact that I don't understand the function of the shield exactly.
(For example when the player is the "activator", what does this mean exactly?)

A noob question: how can I run scriptStudio?
Click to expand...
Run scriptStudio.Release.exe in the /bin folder.
Can you tell me more abour those breakpoints? I have never worked with them earlier.
Click to expand...
Breakpoints stop the execution of a script at the point where they are placed in the script.
There is a wiki entry: http://wiki.cdprojektred.com/redkit/Script+debugging

(Feel free to ask if something is unclear.)
 
Last edited: Dec 25, 2013
S

Silderon

Senior user
#5
Dec 25, 2013
Didn't you play the game?
In the Act II we play as Stennis or Henselt who are on the negotiations. After that henselt activated a curse of Sabrina Glevissig which summons shosts, undead warriors of Aedirn and Kaedwen to fight Henselt. Detmold (or Filippa) creates a magical shield that causes damage to all th undead warriors that try to pass through it (that is OnActivation event and that is what doesn't work in my case). If player character goes out the shield, he starts to loose health (that is OnDeactivation event and works fine).
I wanna use this shield for the same reason as CD Projekt did.
Is that clear?

I just don't get it how OnActivation event could work fine at the same time when OnDeactivation works really strange o_O see no logic in that.

Jesus, thanks for explaining, I'll check your link tomorrow.
 
S

shak-otay

Senior user
#6
Dec 25, 2013
Milten said:
Didn't you play the game?
Click to expand...
Hehehehe, I'm still at Flotsam. Found modding more interesting than playing on.
Is that clear?
Click to expand...
Yep, thx (just spoiled me the game, but ok...).

I just don't get it how OnActivation event could work fine at the same time when OnDeactivation works really strange o_O see no logic in that.
Click to expand...
That's where BPs could help.

btw: I just had a look at q207_henselt.w2pase. From that I finally found Filippa's owl having the magic shield in its inventory. That's cool! (did you know this?)

View attachment 380
 

Attachments

  • q207_henselt-filippas_owl.JPG
    q207_henselt-filippas_owl.JPG
    43.1 KB Views: 62
Last edited: Dec 25, 2013
S

Silderon

Senior user
#7
Dec 26, 2013
Uhm... sorry. I said some basic things you will see at the beginning of the Act II, so the game should not be spoiled.

Yep, I know that, I wrote about shield-item in my first messageю
 
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.