[Changed]Script Help

Started by Kazamatta, April 18, 2012, 06:21:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Kazamatta

I want to create a spell scroll that will use all mana and lasts for only that one attack. It will allow the user to kill one enemy with one strike. The following code is what I have but am unsure if its correct.


Main scroll page::
Item Id: 10182  Catagory: SpellScroll  Name: One Hit KO

Desc: This spell will intantly kill any enemy. Theree is only one in entire game so use it wisely. Can be used by any class except Warrior.

Identified  Use only if equipped

Base Price: 0

Details::
Ability Requirements: All set to 5 
Destroy after use       Charges 1      Remaining 1

Spell: One Hit KO

Modifiers: All set to 0

Script:
function OnCopySpell(){
if (target.tID == 10160){ //10160 is wizard spellbook ID
msg("Cannot copy this spell into this spellbook.");
return false;
}
}



Spell Page::
ID: 1016  Spell Level: 12    Name: One Hit KO

Desc: Will kill any enemy instantly. Cannot be used in final 3 battles. Only one in game.
Duration: -1 round   Offensive

Modifiers: Str: 999  All damage and attack modifiers set to 9999.
Damage Table: 1 @ 9999 Modifier: +9999
Trigger: -1 Duration: -1

Requirements: 50 mana (Can't figure out how to make it use all mana.)

Resistence % Modifiers: All set at 0

Script:
function OnExecute(){
Target.Kill();
Sender.SetValue(32,0,-1);
Echo("~<:Purple>"+Sender.Name+" cast One Hit KO to instantly kill enemy.");
}

Kazamatta

I also dont know where to script in the item code at.

Throndir

Try the Package Manager and download the Spells from the TEP TJ project in the LTR wiki.

Can't remember exactly, but yeah you use the OnExecute function.

You shouldn't have more than one OnExecute function. This will likely result in errors. Also, your else if statement should be within a function not by itself.

Throndir

Just looked at some sample spells I created in there. In an item, go to the details tab, then under Spells, click on View/Add. I think the rest should be self explanatory. You should take a look at the spell scroll items included in the DIE project, the TEP TJ project. And whatever other projects made their own spells.

Throndir

For making it use up all the mana, use SetValue to change its mana into 0.