Harlekin Posted May 19, 2016 Posted May 19, 2016 Hey, i'll hope im right here.. i have an strange Problem and i will try to discribe it right..^^ Ill try to make an simple portal-Script Scriptname Rikushai_Ryugan_PortalPortScript extends ObjectReference ObjectReference Property OtherPortal Auto SPELL Property CooldownSpell Auto MagicEffect Property CDCondition Auto bool Function HasMagicEffect(MagicEffect akEffect) native Event OnTriggerEnter(ObjectReference akTriggerRef) if !(Game.GetPlayer().HasMagicEffect(CDCondition)) CooldownSpell.Cast(akTriggerRef, akTriggerRef) akTriggerRef.MoveTo(OtherPortal) Utility.Wait(2.0) endIf EndEvent for the player-character it works fine... after an teleportion, you become an debuff for 15 secounds that forbid to reteleport ( so you dont flicker between the Portals.) But that wont work for NPC's - of course while "Game.GetPlayer()" speaks to the player. if i change "Game.GetPlayer()" to "akTriggerRef" sould it work but it wont... ._. ill become an fail-Log Starting 1 compile threads for 1 files... Compiling "Rikushai_Ryugan_PortalPortScript"... C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Rikushai_Ryugan_PortalPortScript.psc(11,18): HasMagicEffect is not a function or does not exist No output generated for Rikushai_Ryugan_PortalPortScript, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on Rikushai_Ryugan_PortalPortScript and im really out of idears - Scripting in Papyrus is really new for me and this issue is to high for me.. could someone help me?
Guest Posted May 19, 2016 Posted May 19, 2016 Here some code and some explanations Scriptname Rikushai_Ryugan_PortalPortScript extends ObjectReference ObjectReference Property OtherPortal Auto SPELL Property CooldownSpell Auto MagicEffect Property CDCondition Auto Event OnTriggerEnter(ObjectReference akTriggerRef) Actor triggerer = akTriggerRef as Actor if triggerer && !triggerer.HasMagicEffect(CDCondition) CooldownSpell.Cast(triggerer, triggerer) triggerer.MoveTo(OtherPortal) Utility.Wait(2.0) endIf EndEvent HasMagicEffect applies to Actors not to ObjectReferences. But you can cast an ObjectReference to an Actor.In case the cast will work then the Ref is an actual actor, and you can check the magic effect and cast the spell if you need. In this case your script will work for any posible NPC and the Player.
Harlekin Posted May 19, 2016 Author Posted May 19, 2016 Here some code and some explanations Scriptname Rikushai_Ryugan_PortalPortScript extends ObjectReference ObjectReference Property OtherPortal Auto SPELL Property CooldownSpell Auto MagicEffect Property CDCondition Auto Event OnTriggerEnter(ObjectReference akTriggerRef) Actor triggerer = akTriggerRef as Actor if triggerer && !triggerer.HasMagicEffect(CDCondition) CooldownSpell.Cast(triggerer, triggerer) triggerer.MoveTo(OtherPortal) Utility.Wait(2.0) endIf EndEvent HasMagicEffect applies to Actors not to ObjectReferences. But you can cast an ObjectReference to an Actor.In case the cast will work then the Ref is an actual actor, and you can check the magic effect and cast the spell if you need. In this case your script will work for any posible NPC and the Player. thank you so much, that will solve also some other problems with some other of my Scripts too - Really, thank you
Harlekin Posted May 19, 2016 Author Posted May 19, 2016 No problem. just one more question: Can it be, that the magic effect 'if' works only in this instance of the script that added the Magic effect? otherwise i cant explain why my first portal respect the if condition but the 2. not .. xD
Harlekin Posted May 19, 2016 Author Posted May 19, 2016 the problem is - i get an instant teleport back, if i use an Portal. The 2. Portal ignore the If-Condition.. why ever. i will try for some moments.. and then i delete the triggers and made it with activators but i know then my next problem... "Npcs dosent uses my Portals!" xDD edit:!! Its alive.. eeeh its Work!... i dont know why but it works! xD .. after i deleted all and made it again on the same way o.O ... who cares.. it works! xDDD.. can now be closed/deleted or something like that Thanks again.^^
Guest Posted May 19, 2016 Posted May 19, 2016 OK. If you use Activators, then you need to add AI Packages to the NPCs to use them. Not easy. Triggers are better. Can I ask what the Magic Effect does? How is it defined? It expires after a few seconds? I think you use the magic effect to understand if you come from the other portal. And it is OK to do so. Do not have any script in the magic effect, and probably no visual effects (up to you), but be sure it lasts for a few seconds (30 seconds for example) so when you go in the next portal the trigger effect will not run. Then, when the magic effect is removed by the tie expiration, the portal will do the job again. The code is already good like that. Probably you just need to specify a few seconds for the magic effect to last (about 30 secs should be fine.)
Harlekin Posted May 19, 2016 Author Posted May 19, 2016 oh i edit my last post. okay, again^^ it works now i had an bug.. i dont know where but after i started that new with new triggers... works.^^ The magic effect is (for now) completely without FX.. and it is only for the cooldown. If the magic effect works on you you are not able to walk threw an Portal. Youre right.^^i had an cooldown for 15 sec. I think one of my Portals was a bit buggy from Changing scripts from my "working"process ... or maybe more testing Process. xD Now i'm happy. and now comes two spells (or maybe one if i can handle that) to change the Position of the Portals.^^
Recommended Posts
Archived
This topic is now archived and is closed to further replies.