HEAVENLY LIGHT:
For some reason, it doesn't do all surfaces and mats.
Code:
# spell_heavenly.cog # Turns night into day. # [Grismath] #==============================================================# symbols message activated message selected int level local int bin=35 local int mana local int cost=200 local sound castSound=morning.wav local int soundChannel=-1 local int num_surf local int num_sect local int player local int i local material newsky=sky-blue.mat local end #==============================================================# code #------------------------------------------------------ activated: player=GetSourceRef(); level=GetInv(player, bin); mana=GetInv(player, 14); if(level==0) { Print("Spell Untrained"); Return; } if((!IsInvActivated(player, bin)) && (GetThingHealth(player) > 0)) { mana = GetInv(player, 14); if(mana >= cost || GetInv(player, 14) >= GetInv(player, 69)) { if(GetInv(player, 64) != 1) ChangeInv(player, 14, mana-cost); SetInvActivated(player, bin, 1); PlayMode(player, 24); soundChannel = PlaySoundThing(castSound, player, 0.8, -1, -1, 0x80); SetBinWait(player, bin, 0.2); num_surf=GetSurfaceCount(); for(i=0; i<num_surf; i=i+1) { if(GetSurfaceFlags(i)==0x204) { SetSurfaceMat(i, newsky); } } num_sect=GetSectorCount(); for(i=0; i<num_sect; i=i+1) { SetSectorLight(i, 0.7, 2); } call stop_power; } } return; #------------------------------------------------------ selected: Print("Heavenly Light"); return; #------------------------------------------------------ stop_power: SetInvActivated(player, bin, 0); return; #------------------------------------------------------ end
For some reason, it doesn't do all surfaces and mats.