![]() |
2 Spell Additions - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: 2 Spell Additions (/showthread.php?tid=896) |
2 Spell Additions - Da Undead - 22-04-2007 Originally Coded By: NexSteve and Da Undead Originally For: Elysium Debugged Converted to Mirage By: Da Undead //\\PART 1//\\ Difficulty: 1/10 (C & P) Description: Adds a spell option to where you sacrifice hp for mp. .::Client Side::. modTypes Find: Code: Public Const SPELL_TYPE_SUBSP = 5 After, add: Code: Public Const SPELL_TYPE_SACRIFICE = 6 Done with modTypes Done with Client-Side .::Server Side::. modTypes Find: Code: Public Const SPELL_TYPE_SUBSP = 5 After Add: Code: Public Const SPELL_TYPE_SACRIFICE = 6 Very bottom of modTypes, add: Code: Public Function Rand(ByVal Low As Long, ByVal High As Long) As Long Done with modTypes Open modGameLogic Find: Code: If Player(index).TargetType = TARGET_TYPE_PLAYER Then After, before end select, add: Code: Case SPELL_TYPE_SACRIFICE Find: Code: Sub CastSpell(ByVal index As Long, ByVal SpellSlot As Long) After Damage As Long, add: Code: , DamageDelt As Integer End of modGameLogic. End of Server-Side ------------------------------------------------------------------------------------- //\\PART 2//\\ Description: Spends SP for MP. Add this both client and server side for modTypes after the 'SPELL_TYPE_SACRIFICE = 8' : Code: Public Const SPELL_TYPE_SPFORMP = 7 And this goes after/before the sacrifice cases on modGameLogic(SERVER) on both places : Code: Case SPELL_TYPE_SPFORMP ----------------------------------------- Any problems or questions, post here ![]() - Spodi - 22-04-2007 Heres a new Rand for you because that one makes me cry: Code: Public Function Rand(ByVal Low As Long, ByVal High As Long) As Long - Don't need Randomize - You're working with and returning a variant - You're making a loop and constantly "hoping it hits", which would freeze for hours if you specify high values with small gaps - It will go into an infinite loop if you specify the low as higher than the high - I ran the code Rand(2000000000, 1999999999) compiled with all optimizations ticked... and about 10 minutes later, its still running :lol: Also, just want to add, stuff like this: Code: (Int(GetPlayerMAGI(index) / 4) Can be written: Code: (GetPlayerMAGI(index) \ 4) Its faster since what you're doing is taking the extra processing to do floating-point division, then to remove that floating point with the Int(), so \ 4 just does straight integer division (much faster). - Da Undead - 22-04-2007 Thankyou spodi, updated tut ![]() - William - 22-04-2007 You also need to update. Code: DamageDelt = Rand(5, 1) Code: DamageDelt = Rand(1, 5) - Da Undead - 22-04-2007 What that for? - William - 22-04-2007 Well the random function states that it starts with Low and ends with High. So the most obviouse way to write it would be 1, 5. - Spodi - 22-04-2007 My bad, the one I gave you went Low/High, while your original was High/Low. - Nexarcon - 22-04-2007 Oh, it's spelt Sacrifice btw. - Da Undead - 23-04-2007 Spodi Wrote:My bad, the one I gave you went Low/High, while your original was High/Low. Oh well, i updated it to 5, 1 ![]() and spelling doesn't matter :p - Da Undead - 23-04-2007 UPDATED TUT! Added SP for MP in //\\PART 2//\\ (BOTTOM) of first post. - Rezeyu - 20-05-2007 Da Undead Wrote:Spodi Wrote:and spelling doesn't matter :p Actually, it should... Because you defined the spell in your server as: Code: Public Const SPELL_TYPE_SACRIFISE = 6 And in the CastSpell sub, you're looking for this: Code: Case SPELL_TYPE_SACRIFICE Correct me if I'm wrong of course. - Da Undead - 20-05-2007 Oh nice catch, updated ![]() Re: 2 Spell Additions - Rory - 12-08-2007 Also, you forgot to mention that you have to add stuff in the client side spell editor as well ![]() |