Jump to content

[LE] Is there a way to link a Extends ActiveMagicEffect script with an Extends Quest script?


Rizalgar

Recommended Posts

Ok, I am trying to get it to compile, but the spell script throws errors about not matching the parent script (I'm assuming it means the Quest script)

Here is both of the scripts. The Spell script followed by the Quest script. Sorry about the spacing, I didn't think I'd have to do this.

Scriptname RS_Spell_SmokeRush_Script extends ActiveMagicEffect
{Smoke Rush Script}

Spell Property SmokeRush Auto

rsFrameworkAncientMagicks Function GetFrameworkAncientMagicks() Global
	Return (Game.GetFormFromFile(0x594A88, "Rizalgars Skyscape") as Quest) as rsFrameworkAncientMagicks
EndFunction

Event OnSpellCast(Form akSpell)
	
	If akSpell == SmokeRush
		GetFrameworkAncientMagicks().SmokeRush
	EndIf
	
EndEvent

Event OnEffectStart(Spell akSpell)
	
EndEvent 
Scriptname rsFrameworkAncientMagicks extends Quest
{Main framework for Ancient Magicks
handling XP, Damage and Damage effects}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Call to main RsFrameworkMenu ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rsFrameworkMenu Function GetFrameworkMenu() Global
	Return (Game.GetFormFromFile(0x294A97, "Skyscape.esm") as Quest) as rsFrameworkMenu
EndFunction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                              ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;
;;;;
;;;
;;
;
;;
;;;
;;;;
;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MiscObject Variables ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
MiscObject Property AirRune Auto
MiscObject Property WaterRune Auto
MiscObject Property EarthRune Auto
MiscObject Property FireRune Auto
MiscObject Property ChaosRune Auto
MiscObject Property DeathRune Auto
MiscObject Property BloodRune Auto
MiscObject Property SoulRune Auto
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                      ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;
;;;;
;;;
;;
;
;;
;;;
;;;;
;;;;;
;;;;;;;;;;;;;;;;;;;;;
;; Spell Variables ;;
;;;;;;;;;;;;;;;;;;;;;
Spell Property SmokeRush Auto
Spell Property SmokeBurst Auto
Spell Property SmokeBlitz Auto
Spell Property SmokeBarrage Auto
Spell Property ShadowRush Auto
Spell Property ShadowBurst Auto
Spell Property ShadowBlitz Auto
Spell Property ShadowBarrage Auto
Spell Property BloodRush Auto
Spell Property BloodBurst Auto
Spell Property BloodBlitz Auto
Spell Property BloodBarrage Auto
Spell Property IceRush Auto
Spell Property IceBurst Auto
Spell Property IceBlitz Auto
Spell Property IceBarrage Auto
Spell Property SmokeRushPoison Auto
;;;;;;;;;;;;;;;;;;;;;
;;                 ;;
;;;;;;;;;;;;;;;;;;;;;
;;;;;
;;;;
;;;
;;
;
;;
;;;
;;;;
;;;;;
;;;;;;;;;;;;;;;;;;;
;; XP Multiplier ;;
;;;;;;;;;;;;;;;;;;;
Float XPM = 1.0
;;;;;;;;;;;;;;;;;;;
;;               ;; 
;;;;;;;;;;;;;;;;;;;
;
;;
;;;
;;;;
;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;
;; Spell Calculations ;;
;;;;;;;;;;;;;;;;;;;;;;;;
Function SmokeRush(Actor akCaster, Actor akTarget, Spell akSpell)

	If akCaster == Game.GetPlayer()
		Int AirRuneCt = Game.GetPlayer().GetItemCount(AirRune)
		Int FireRuneCt = Game.GetPlayer().GetItemCount(FireRune)
		Int ChaosRuneCt = Game.GetPlayer().GetItemCount(ChaosRune)
		Int DeathRuneCt = Game.GetPlayer().GetItemCount(DeathRune)
		If AirRuneCt < 1 || FireRuneCt < 1 || ChaosRuneCt < 2 || DeathRuneCt < 2
			Game.GetPlayer().UnequipSpell(SmokeRush, 0)
			Game.GetPlayer().UnequipSpell(SmokeRush, 1)
			Debug.Notification("You lack the required runes")
		Else
			Int Poison = Utility.RandomInt(0,1)
				If Poison == 1
					Game.GetPlayer().RemoveItem(AirRune, 1)
					Game.GetPlayer().RemoveItem(FireRune, 1)
					Game.GetPlayer().RemoveItem(ChaosRune, 2)
					Game.GetPlayer().RemoveItem(DeathRune, 2)
					
					Int dam = Utility.RandomInt(1,13)
					
					akTarget.DamageAV("Health", dam)
					akTarget.AddSpell(SmokeRushPoison)
					
					Debug.Notification("The enemy is poisoned")
					
					Float BaseXP = 30
					Float MMXP = ((BaseXP) + dam * XPM)
					rsFrameworkMenu.rsXPGain("magic", MMXP)
				Else
					Game.GetPlayer().RemoveItem(AirRune, 1)
					Game.GetPlayer().RemoveItem(FireRune, 1)
					Game.GetPlayer().RemoveItem(ChaosRune, 2)
					Game.GetPlayer().RemoveItem(DeathRune, 2)
					
					Int dam = Utility.RandomInt(1,13)
					
					akTarget.DamageAV("Health", dam)
					
					Float BaseXP = 30
					Float MMXP = ((BaseXP) + dam * XPM)
					rsFrameworkMenu.rsXPGain("magic", MMXP)
			EndIf
		EndIf
	EndIf

EndFunction
;;;;;;;;;;;;;;;;;;;;;;;;
;;                    ;;
;;;;;;;;;;;;;;;;;;;;;;;;

Just realized I forgot to drop the .esp at the end of GetFormFromFile, but I doubt that's the reason.


the parameter types of function oneffectstart in the empty state on script rs_spell_smokerush_script do not match the parent script activemagiceffect ------- is the error I'm getting

 

Edit 2 ----- I forgot to drop the spell script back into OnEffectStart instead of OnSpellCast. But I have tried both ways

Edited by Rizalgar
Link to comment
Share on other sites

What you can do is call functions between scripts. You can also set scripts as properties on other scripts and get their properties/functions that way.

 

My preferred method of obtaining properties/functions from external scripts is via script property(I know this sounds confusing, and example will help)

 

 

Example:

some quest script...
 
Float property externalFloat auto
 
 
Float Function externalFunc()
  return 5.0
endFunction
some magic effect script..
 
rsFrameworkAncientMagicks property RScript auto
; fill this with the quest,
 
Event OnEffectStart(usual parameters..)
    Float thisFloat = RScript.externalFloat
    Float thatFloat = RScript.externalFunc()
EndEvent

Another way involves casting the quest to the script, which you have done, but this can be done outside of GetFormFromFile in your case, and done with a quest property.

Edited by Rasikko
Link to comment
Share on other sites

Yep, confused lol. Let me read it 40 more times and get back to you

 

Edit --- Yeah, super confused. I'm not sure where to put this in the script. Given I've been drinking, I think even sober I'd still be confused


New errors on compile with that. Saying the ak's aren't specified or whatever


\RS_Spell_SmokeRush_Script.psc(13,32): argument akcaster is not specified and has no default value
\RS_Spell_SmokeRush_Script.psc(13,32): argument aktarget is not specified and has no default value
\RS_Spell_SmokeRush_Script.psc(13,32): argument akspell is not specified and has no default value
\RS_Spell_SmokeRush_Script.psc(13,7): type mismatch while assigning to a float (cast missing or types unrelated)
\RS_Spell_SmokeRush_Script.psc(10,0): the parameter types of function oneffectstart in the empty state on script rs_spell_smokerush_script do not match the parent script activemagiceffect.

Edited by Rizalgar
Link to comment
Share on other sites

Anyone know why these errors are popping up? Are they not defined in the framework? I'm at a real loss here.

 

I got it to work, using Rasikko's method. In the external function call I just had to add (akTarget, akCaster).

Edited by Rizalgar
Link to comment
Share on other sites

The script (you provided us) extends to ActiveMagicEffect. This one exists as vanilla script, the source you'll find as "ActiveMagicEffect.psc", the executable is "ActiveMagicEffect.pex".

 

Any native event has specified parameters, that can be changed by name, but not changed by count, order or type !!!

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
  ; your code here
ENDEVENT

your code (responsible for compiler errors) as follow:

Event OnEffectStart(Spell akSpell)
    
EndEvent

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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