Magic shield from Act 2

+
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:
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:
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.
 
Is it hard to read cause my English is not very good or why?
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?
Run scriptStudio.Release.exe in the /bin folder.
Can you tell me more abour those breakpoints? I have never worked with them earlier.
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:
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.
 
Didn't you play the game?
Hehehehe, I'm still at Flotsam. Found modding more interesting than playing on.
Is that clear?
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.
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: 85
Last edited:
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ю
 
Top Bottom