Thread Rating:
- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
putting cooldown on scrolls
|
Author |
Message |
Khaos
Master
Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11
|
RE: putting cooldown on scrolls
Code:
on=@SpellCast
if (<argo.type> == t_scroll)
if (<restest 1 i_memory_scroll_cooldown>)
src.smsg You cannot use a scroll again til <findlayer.layer_memory.baseid.i_memory_scroll_cooldown.timer> seconds.
return 1
endif
if (<argn1> == s_flamestrike)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 5
endif
endif
Add this to your players. You can control what scrolls do what by checking the argn1. No point in adding a ctag for every delay.
You would still need his memory object by the way.
Optimized in my edits some more. This should be more concise.
(This post was last modified: 02-18-2016 08:07 AM by Khaos.)
|
|
02-18-2016 08:04 AM |
|
|
dunnetott
Apprentice
Posts: 24
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Feb 2016
Reputation: 0
|
RE: putting cooldown on scrolls
Code:
on=@SpellCast
if (<argo.type> == t_scroll)
if (<restest 1 i_memory_scroll_cooldown>)
src.smsg You cannot use a scroll again til <findlayer.layer_memory.baseid.i_memory_scroll_cooldown.timer> seconds.
return 1
endif
if (<argn1> == s_flamestrike)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 5
endif
endif
do i need to put this after every spell or?
(This post was last modified: 02-18-2016 08:20 AM by dunnetott.)
|
|
02-18-2016 08:20 AM |
|
|
Khaos
Master
Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11
|
RE: putting cooldown on scrolls
Just plop it on SKILLCLASS 0 or a player event. This way it affects all players.
then you can edit this block or add more blocks to add more times.
Code:
if (<argn1> == s_flamestrike)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 5
endif
for instance you could do this to add in more timers to other spells from scrolls:
Code:
on=@SpellCast
if (<argo.type> == t_scroll)
if (<restest 1 i_memory_scroll_cooldown>)
src.smsg You cannot use a scroll again til <findlayer.layer_memory.baseid.i_memory_scroll_cooldown.timer> seconds.
return 1
endif
if (<argn1> == s_flamestrike||s_fireball)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 5
endif
if (<argn1> == s_poison)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 7
endif
endif
People use player events to control player triggers globally. I just use skillclass 0 and set my GM's to use skillclass # with a higher skillcap/statcap and gm code in triggers.
(This post was last modified: 02-18-2016 08:33 AM by Khaos.)
|
|
02-18-2016 08:32 AM |
|
|
Khaos
Master
Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11
|
RE: putting cooldown on scrolls
Findid SEEMS cleaner (it really isn't. It runs a loop), but I prefer to point to the object instead of having sphere check every layer in a forloop to find that ID.
Ctag could be useful, but you'd be storing a lot of tags and running a lot of timers as well. Though it might not seem intensive, though unlikely, if a server had 1,000 players all casting and using scrolls or whatever, the delays would pile up. If he wants to go that route, then sure, I can script up a quick example. But, it is not ideal.
FINDID and all that process loops through all objects on a character in all layers. This is more processing than needed when you can just point to the item itself.
Cleaner programming Less resource intensive.
(This post was last modified: 02-18-2016 08:55 AM by Khaos.)
|
|
02-18-2016 08:52 AM |
|
|
dunnetott
Apprentice
Posts: 24
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Feb 2016
Reputation: 0
|
RE: putting cooldown on scrolls
Code:
[SKILLCLASS 23]
DEFNAME=Class_human_arch_mage
NAME=Arch Mage
//EVENTS=e_human_arch_mage
STATSUM=260
SKILLSUM=10000.0
STR=70
INT=95
DEX=90
Alchemy=100.0
Anatomy=100.0
AnimalLore=100.0
ItemId=100.0
ArmsLore=100.0
Parrying=100.0
Begging=100.0
Blacksmithing=100.0
Bowcraft=100.0
Peacemaking=100.0
Camping=100.0
Carpentry=100.0
Cartography=100.0
Cooking=100.0
DetectingHidden=100.0
Enticement=100.0
EvaluatingIntel=100.0
Healing=100.0
Fishing=100.0
Forensics=100.0
Herding=100.0
Hiding=100.0
Provocation=100.0
Inscription=100.0
LockPicking=100.0
Magery=100.0
MagicResistance=100.0
Tactics=100.0
Snooping=100.0
Musicianship=100.0
Poisoning=100.0
Archery=100.0
SpiritSpeak=100.0
Stealing=100.0
Tailoring=100.0
Taming=100.0
TasteId=100.0
Tinkering=100.0
Tracking=100.0
Veterinary=100.0
Swordsmanship=100.0
Macefighting=100.0
Fencing=100.0
Wrestling=100.0
Lumberjacking=100.0
Mining=100.0
Meditation=100.0
Stealth=100.0
RemoveTrap=100.0
Necromancy=100.0
Focus=100.0
Chivalry=100.0
Bushido=100.0
Ninjitsu=100.0
Spellweaving=100.0
Mysticism=100.0
Imbuing=100.0
Throwing=100.0
ON=@ItemEquipTest
IF (<ACT.TDATA3> == 4) || (<ACT.TDATA3> == 1) || (<ACT.TDATA3> == 5) || (<ACT.TDATA3> == 3)
SRC.SYSMESSAGE You can't equip this armor.
RETURN 1
ENDIF
ON=@SPELLCAST
IF (<argn1>==1) || (<argn1>==2) || (<argn1>==3) || (<argn1>==4) || (<argn1>==5) || (<argn1>==6)
elseif (<argn1>==7) || (<argn1>==8) || (<argn1>==9) || (<argn1>==10) || (<argn1>==11) || (<argn1>==12)
elseif (<argn1>==13) || (<argn1>==14) || (<argn1>==15) || (<argn1>==16) || (<argn1>==17) || (<argn1>==18)
elseif (<argn1>==19) || (<argn1>==20) || (<argn1>==21) || (<argn1>==22) || (<argn1>==23) || (<argn1>==24)
elseif (<argn1>==27) || (<argn1>==28) || (<argn1>==29) || (<argn1>==31) || (<argn1>==32) || (<argn1>==33)
esleif (<argn1>==34) || (<argn1>==35) || (<argn1>==36) || (<argn1>==37) || (<argn1>==38) || (<argn1>==39)
elseif (<argn1>==40) || (<argn1>==41) || (<argn1>==42) || (<argn1>==43) || (<argn1>==44) || (<argn1>==45)
elseif (<argn1>==46) || (<argn1>==447) || (<argn1>==48) || (<argn1>==49) || (<argn1>==50) || (<argn1>==51)
elseif (<argn1>==52) || (<argn1>==53) || (<argn1>==54) || (<argn1>==55) || (<argn1>==56) || (<argn1>==57)
elseif (<argn1>==58) || (<argn1>==59) || (<argn1>==60) || (<argn1>==61) || (<argn1>==62) || (<argn1>==63)
elseif (<argn1>==64)
return 0 // Continue
else
SRC.SYSMESSAGE You do not know how that magic works.
return 1 // Stop
endif
on=@SpellCast
if (<argo.type> == t_scroll)
if (<restest 1 i_memory_scroll_cooldown>)
src.smsg You cannot use a scroll again til <findlayer.layer_memory.baseid.i_memory_scroll_cooldown.timer> seconds.
return 1
endif
if (<argn1> == s_flamestrike||s_fireball)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 5
endif
if (<argn1> == s_poison)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 7
endif
endif
This is 1 of my class scripts and i can still spam the flame strike scroll am i missing something?
i have put myself as skillclass 23 in game
and i put this in a def file
Code:
[ITEMDEF i_memory_scroll_cooldown]
ID=i_memory
TYPE=t_eq_script
NAME=Memory scroll cooldown
ON=@Timer
REMOVE
RETURN 1
(This post was last modified: 02-18-2016 11:11 AM by dunnetott.)
|
|
02-18-2016 09:47 AM |
|
|
Khaos
Master
Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11
|
RE: putting cooldown on scrolls
Code:
[SKILLCLASS 23]
DEFNAME=Class_human_arch_mage
NAME=Arch Mage
//EVENTS=e_human_arch_mage
STATSUM=260
SKILLSUM=10000.0
STR=70
INT=95
DEX=90
Alchemy=100.0
Anatomy=100.0
AnimalLore=100.0
ItemId=100.0
ArmsLore=100.0
Parrying=100.0
Begging=100.0
Blacksmithing=100.0
Bowcraft=100.0
Peacemaking=100.0
Camping=100.0
Carpentry=100.0
Cartography=100.0
Cooking=100.0
DetectingHidden=100.0
Enticement=100.0
EvaluatingIntel=100.0
Healing=100.0
Fishing=100.0
Forensics=100.0
Herding=100.0
Hiding=100.0
Provocation=100.0
Inscription=100.0
LockPicking=100.0
Magery=100.0
MagicResistance=100.0
Tactics=100.0
Snooping=100.0
Musicianship=100.0
Poisoning=100.0
Archery=100.0
SpiritSpeak=100.0
Stealing=100.0
Tailoring=100.0
Taming=100.0
TasteId=100.0
Tinkering=100.0
Tracking=100.0
Veterinary=100.0
Swordsmanship=100.0
Macefighting=100.0
Fencing=100.0
Wrestling=100.0
Lumberjacking=100.0
Mining=100.0
Meditation=100.0
Stealth=100.0
RemoveTrap=100.0
Necromancy=100.0
Focus=100.0
Chivalry=100.0
Bushido=100.0
Ninjitsu=100.0
Spellweaving=100.0
Mysticism=100.0
Imbuing=100.0
Throwing=100.0
ON=@ItemEquipTest
if (<act.tdata3> == 1||3||4||5)
src.smsg You can't equip this armor.
return 1
endif
on=@SpellCast
if (<argo.type> == t_spellbook)
if (<argn1> == 0||25||26||30)
smsg You do not know how that magic works.
return 1
endif
endif
if (<argo.type> == t_scroll)
if (<findlayer.layer_memory.baseid> == i_memory_scroll_cooldown)
src.smsg You cannot use a scroll again til <findlayer.layer_memory.baseid.i_memory_scroll_cooldown.timer> seconds.
return 1
endif
if (<argn1> == s_flamestrike||s_fireball)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 5
endif
if (<argn1> == s_poison)
serv.newitem i_memory_scroll_cooldown,,<uid>
new.timer = 7
endif
endif
try this
You were running 2 @SpellCast triggers which the first one was exiting off the second call with return 1 and return 0. I also cleaned up your allowed spells as well. This should run smoother. Let me know if there are any errors.
Added another check for spellbook casting versus scroll.
Added spell check for spell 0 to not be allowed.
(This post was last modified: 02-18-2016 01:37 PM by Khaos.)
|
|
02-18-2016 11:49 AM |
|
|
User(s) browsing this thread: 6 Guest(s)