I know I'm still not good at the whole Danmakufu business, but I've made use of the player script tutorial to make a custom spellcard of my own. What I wanted to do was spawn spontaneous lightning strikes (160x600 long) lengthwise along the playing field, followed by a flash of white. However, when I tested it out, it wouldn't run as nothing happened. The following code for activation is here:
@Spellcard{
SetSpeed(1, 1);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
UseSpellCard("CCoil", 0);
CutIn(KOUMA,"SlowSpell",cutimg);
}else{
//UseSpellCard("LBurst", 0);
CutIn(KOUMA,"FreeSpell",cutimg);
}
}
Everything looks fine and all, but here's the entire for "CCoil", which is what I'm starting off with:
script_spell CCoil{
let lightning=get~".\img\teslalightningtex.png
let spellcount=0;
task LightningRipple(){
let objlightning=Obj_Create(OBJ_SPELL);
let xpos=GetCenterX+rand(0,416);
let ypos=GetCenterY;
Obj_SetAlpha(objlightning,200);
ObjEffect_SetTexture(objlightning,lightning);
ObjEffect_SetRenderState(objlightning,ADD);
ObjEffect_CreateVertex(objlightning,4);
ObjEffect_SetPrimitiveType(objlightning,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(objlightning,0,0,0);
ObjEffect_SetVertexUV(objlightning,1,160,0);
ObjEffect_SetVertexUV(objlightning,2,0,600);
ObjEffect_SetVertexUV(objlightning,3,160,600);
while(!Obj_BeDeleted(objlightning)){
ObjEffect_SetVertexXY(objlightning,0,xpos+(60*cos(120)),ypos+(60*sin(120)));
ObjEffect_SetVertexXY(objlightning,1,xpos+(60*cos(240)),ypos+(60*sin(240)));
ObjEffect_SetVertexXY(objlightning,2,xpos+(60*cos(300)),ypos+(60*sin(300)));
ObjEffect_SetVertexXY(objlightning,3,xpos+(60*cos(60)),ypos+(60*sin(60)));
ObjSpell_SetIntersecrionLine(objlightning,xpos+(60*cos(120)),ypos+(60*sin(120)),xpos+(60*cos(60)),ypos+(60*sin(60)),5,10,true);
yield;
}
}
}
task run{
SetPlayerInvincibility(300);
ForbidShot(true);
loop(45){yield;}
while(spellcount<101){
if spellcount%10==0{
LightningRipple();
LightningRipple();
LightningRipple();
PlaySE(GetCurrentScriptDirectory()~"lightning.wav");
if(spellcount==101){
PlaySE(GetCurrentScriptDirectory()~"crash.wav");}
}
spellcount++;
yield;
}
ForbidShot(false);
SetSpeed(3.5,2.5);
loop(90){yield;}
End();
}
I'm still not used to creating objects, so I don't know what I did wrong. The whole setting of the vertices and putting them on the field is rather confusing, as well as the use of other mathematical equations such as trigonometric functions and modulus. I didn't come into an error for some reason, but the spell just removed a counter and that was it.