73 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| //::///////////////////////////////////////////////
 | |
| //:: Footcatcher Trap
 | |
| //:: trap_footcatch
 | |
| //:: Copyright (c) 2023 Project RATDOG
 | |
| //:://////////////////////////////////////////////
 | |
| /*
 | |
| 
 | |
| */
 | |
| //:://////////////////////////////////////////////
 | |
| 
 | |
| #include "prc_inc_spells"
 | |
| #include "NW_I0_SPELLS"
 | |
| 
 | |
| void CreateObject2(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=FALSE);
 | |
| 
 | |
| void main()
 | |
| {
 | |
|     //Declare major variables
 | |
|     int nDuration 		= 4;
 | |
| 	int nDamage			= d3(1);
 | |
| 	
 | |
|     object oTarget 		= GetEnteringObject();
 | |
| 	
 | |
|     location lTarget 	= GetLocation(oTarget);
 | |
| 	
 | |
|     effect eStopped 	= EffectCutsceneImmobilize();
 | |
| 	eStopped			= ExtraordinaryEffect(eStopped);
 | |
| 	
 | |
| 	effect eDamage		= EffectDamage(nDamage);
 | |
|     effect eVis1 		= EffectVisualEffect(VFX_DUR_ENTANGLE);
 | |
| 	effect eVis2 		= EffectVisualEffect(VFX_IMP_POISON_S);
 | |
| 	
 | |
| 	effect ePoison		= EffectPoison(POISON_LARGE_SCORPION_VENOM);
 | |
| 	ePoison				= ExtraordinaryEffect(ePoison);
 | |
| 	
 | |
| 	effect eLink1		= EffectLinkEffects(eStopped, eVis1);	
 | |
| 	eLink1				= ExtraordinaryEffect(eLink1);
 | |
| 	
 | |
|     //Find first target in the size
 | |
|     oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_SMALL, lTarget);
 | |
|     //Cycle through the objects in the radius
 | |
|     while (GetIsObjectValid(oTarget))
 | |
|     {
 | |
|         if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, 20, SAVING_THROW_TYPE_NONE))
 | |
|         {
 | |
| 	//:: Apply damage & hold effect
 | |
|             ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);
 | |
|             ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink1, oTarget, RoundsToSeconds(nDuration));
 | |
| 			SendMessageToPC(oTarget, "You've stepped thru a false floor, into a spiked trap.");
 | |
| 			
 | |
| 			if(!MySavingThrow(SAVING_THROW_FORT, oTarget, 18, SAVING_THROW_TYPE_POISON))
 | |
| 			{
 | |
| 		//:: Apply poison 
 | |
|             ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget);
 | |
|             ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePoison, oTarget, RoundsToSeconds(nDuration));
 | |
| 			
 | |
| 			}
 | |
| 			
 | |
|         }
 | |
|         //Get next target in the shape.
 | |
|         oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_SMALL, lTarget);
 | |
|     }
 | |
|     //respawn trap
 | |
|     DelayCommand(598.0, CreateObject2(GetObjectType(OBJECT_SELF), GetResRef(OBJECT_SELF), GetLocation(OBJECT_SELF)));
 | |
|     DelayCommand(600.0, DestroyObject(OBJECT_SELF));
 | |
| }
 | |
| 
 | |
| void CreateObject2(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=FALSE)
 | |
| {
 | |
|     CreateObject(nObjectType, sTemplate, lLocation, bUseAppearAnimation);
 | |
|     return;
 | |
| }
 |