Setting up a "zelda-like" task/event script (Ascent, C++) menu

Shout-Out

User Tag List

Results 1 to 10 of 10
  1. #1
    swils's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setting up a "zelda-like" task/event script (Ascent, C++)

    Hey all. I've literally just gotten into C++ scripting (going to be putting the scripts into an Ascent server), and am getting a basic grasp of scripting a boss to perform actions at certain intervals, by reading various guides here.

    I want to do something slightly different, though. On the server (just getting on its feet), all of the GMs have been tasked with creating a fun event/area (some have done custom instances, mostly unscripted with just bosses scattered about. Others are working on long and arduous stairs/jumping events). My personal area is reminiscent of a hybrid between oldschool and newer Zelda's: Modular rooms (mostly square, and at least thus far, all the challenges can be remade with relative ease by moving or replacing the objects that make up the challenges). This can only go so far, though.

    My current idea is to (with the aid of one of the admins, who will create the necessary mobs/custom items for me), create "puzzles" that are basically as follows:
    There is a chest somewhere in the room, that holds "X" amount of (custom item) "Bomb". There's a door in the room, but the path to it is blocked by a "Cracked Rock" (custom mob).

    I am wondering if it is possible to do the following, and, if so, could anyone point me towards some C++ commands/script lines that would help me achieve this goal:

    1. (non-script) Is it possible to assign "Cracked Rock" a collizion size, such that you can't just run through it until you kill it, at which point it has a very short decay time, so will essentially disappear from the path?

    2. (script, I believe) I would ideally assign "Bomb" a spell (probably a low-level engineering bomb spell effect, since those items will be largely unused on the server). Currently, I have it in my mind to make "Cracked Rock" invulnerable *unless* it is in the AoE of "Bomb" (so that no amount of attacking it with any amount of damage will harm it unless the damage source is the spell from "Bomb"). What sort of scripting would I need in order to make this happen, if at all possible?

    3. (script) This one's a bit unrelated to the proposed puzzle above, but still fits under this thread. I want to re-create a "Wizrobe" that will basically "Mirror-Image" itself at set HP levels. I assume that I will need to write both an NPC script (to define its behavior each time), a separate Event script to spawn "X" amount of mirror images at certain points (X varies by HP level), and then another script to define the behaviors of those images (which I would want to mimic the original's health, but would deal 25% damage and take 1000% damage). Example scenario here would be, "Wizrobe" hits 80% HP, gets blinked to random point from a list of, say, 4 points, and then begins to cast a spell. Simultaneously, a mirror image gets created at a random point from the same list, but not at the same point that the original is moved to, and also begins casting a spell directed at the same target as the original.
    Rinse/Repeat for various HP levels and numbers of images.


    Any detailed help will be greatly appreciated, for *any* of the questions.
    Thanks very much in advance

    Setting up a "zelda-like" task/event script (Ascent, C++)
  2. #2
    The-Eradicator's Avatar Contributor

    Reputation
    149
    Join Date
    May 2007
    Posts
    829
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by swils View Post
    1. (non-script) Is it possible to assign "Cracked Rock" a collizion size, such that you can't just run through it until you kill it, at which point it has a very short decay time, so will essentially disappear from the path?
    What? NPCs don't have collision size, gameobjects can't be killed. What are you talking about here?

    Either way, no. You can't change that without clientside patches. Technically, you probably could do some core editing to achieve it but I find it unlikely that anyone will pull that off any time soon.

    Originally Posted by swils View Post
    3. (script) This one's a bit unrelated to the proposed puzzle above, but still fits under this thread. I want to re-create a "Wizrobe" that will basically "Mirror-Image" itself at set HP levels. I assume that I will need to write both an NPC script (to define its behavior each time), a separate Event script to spawn "X" amount of mirror images at certain points (X varies by HP level), and then another script to define the behaviors of those images (which I would want to mimic the original's health, but would deal 25% damage and take 1000% damage). Example scenario here would be, "Wizrobe" hits 80% HP, gets blinked to random point from a list of, say, 4 points, and then begins to cast a spell. Simultaneously, a mirror image gets created at a random point from the same list, but not at the same point that the original is moved to, and also begins casting a spell directed at the same target as the original.
    Rinse/Repeat for various HP levels and numbers of images.
    No emulators have replicated mirror-image (NPC with player appearance) functionality yet AFAIK.

  3. #3
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All of this is quite possible, however you would have to get creative.

    1. The collision on a mob thing would be hard to do, however you could spawn a gameobject blocking the door that would disappear once you killed the mob. OR you could spawn an invisible wall that would also disappear once you kill the mob.

    2. That is quite possible, however it would require a core edit (it could easily be achieved with a simple edit in Object:ealDamage)

    3. That would be easy. Create a new creature that would be identical to the first, but give it an aura that causes it to take 10x more damage and an aura that makes it deal 75% less damage, & give them spells with ai_agents. Have the main creature spawn 4 of those creatures at every X health percent.

  4. #4
    swils's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by The-Eradicator View Post
    What? NPCs don't have collision size, gameobjects can't be killed. What are you talking about here?

    Either way, no. You can't change that without clientside patches. Technically, you probably could do some core editing to achieve it but I find it unlikely that anyone will pull that off any time soon.



    No emulators have replicated mirror-image (NPC with player appearance) functionality yet AFAIK.

    As for your first question, what am I talking about, I detailed in my first post how I wanted to create a new mob called "Cracked Rock" (and to elaborate, change its model to that of a Rock doodad). I had it in my mind to then give it a collision size, which I apparently can't do.

    @Jotox, if this were WC3, I'd be set for making a trigger "If unit'Cracked Rock' is affected by spell'Bomb', kill unit'cracked rock'"
    and "If unit'Cracked Rock' dies, remove object'Wall'"
    Do you have any idea how such a script should be written? I'm not yet experienced enough with scripting to figure out how to relate 2 seperate objects (though, I'd love to learn--one application would be for recreating the gnomeregan end-boss fight, perhaps).

    Can you elaborate on the core edit for the bomb-spell and having it be the only thing that can damage the unit? Or, I just had a thought: following from the above script, I think I could (with some spell DB edits) use an item that spawns something (has to be something that spawns on the ground, visible), change the spawned ID to a custom object that resembles dynamite, then use a script to create an explosion effect after X seconds, and after the explosion, removed the spawned custom-bomb object, and the wall blocking the way. Again, I'd need to learn how to make a script that will recognize actions in an area, and then do something to multiple objects based on that action.

    As for the mirror images, I'd probably have to get a custom debuff made for the damage changes. Also, I'd guess that I can use scripts to modify the hp of the "images" to match that of the original.

    So TL;DR version is basically, does anyone have a guide or suggestions on how to write a script that relates multiple independent objects to each other?

  5. #5
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could.... set the cracked rock's hp to 1 billion, and then create a script for the bomb?

    here's a script for the bomb:
    Code:
    bool CrackedRock_Bomb(uint32 i, Spell * pSpell)
    {
    	Unit* target = pSpell->GetUnitTarget();
    	if(!pSpell->p_caster || !target) return true;
    
    	if(!target->IsCreature() || static_cast<Creature*>(target)->GetEntry() != (CRACKED_ROCK_ENTRY_ID) ) return true;
    
    	pSpell->p_caster->SpellNonMeleeDamageLog(target, pSpell->GetProto()->Id, target->GetUInt32Value(UNIT_FIELD_HEALTH), true);
    	return true;
    }
    
    void SetupCrackedRock(ScriptMgr * mgr)
    {
    	mgr->register_dummy_spell(BOMB_SPELL_ID, &CrackedRock_Bomb);
    }
    This is the .cpp file you could use for it. If you don't know how to compile a script, search for a guide here on mmowned.

    This script would cause the bomb (replace BOMB_SPELL_ID with the bomb spell's id) to instakill cracked rock.

  6. #6
    swils's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, that's awesome, thanks very much! Aye, I'll be teaching myself to script + compile, so that shouldn't be an issue.

    About the script, as I am just now learning, would you mind explaining a bit of it to me, namely, just what's what?

    CrackedRock_Bomb = script name, essentially?

    I'd have to replace "BOMB_SPELL_ID" with the appropriate ID as you said, as well as "CRACKED_ROCK_ENTRY_ID". Are there any other variables in there that I'd have to replace, like "UNIT_FIELD_HEALTH" (change that to zero?) ? &CrackedRock_Bomb, does that recall the part of the script written in the first set of brackets?
    Stuff with an asterisk after it, like "Unit*", "<Creature*>", do I need to replace those, or is the asterisk just part of the code?

    Sorry, I know these are probably really beginner questions, but since I've got a working code in front of me, that does what I want, I'd like to break it apart and understand the inner workings, so that I don't have to ask these sorts of questions again (Give a man a fish vs teach him to fish, and all that).
    +Rep because, again, thank you very much for the example script!
    *edit: Can't +rep you yet, since I think you helped me in my other thread and I +Rep'ed you there, heh. Have to "spread some love" before I can get back to you, but since I'll be referencing this thread in the future, I won't forget about ya, haha.

  7. #7
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the * and <Creature*> and UNIT_FIELD_HEALTH and stuff are all part of the code, all you hafta change is CRACKED_ROCK_ENTRY_ID and BOMB_SPELL_ID

    For a step by step explanation...

    The function CrackedRock_Bomb is triggered every time the bomb spell is cast.

    In the cracked_rock_Bomb function:

    If there is no target for the bomb, or the target isn't a unit, don't continue.
    If the target isn't a creature, or the target IS a creature but not cracked rock, don't continue.

    finally, it makes the caster of the bomb spell do damage to cracked rock equal to cracked rock's current health.

    I can't explain every little detail without going into an in-depth explanation of C++

  8. #8
    swils's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Jotox1 View Post
    I can't explain every little detail without going into an in-depth explanation of C++
    No worries, the stuff you did explain is immensely helpful, makes the code a lot easier to understand with my currently limited knowledge.

    One last question if you don't mind: As I understand it, the code is currently scripted such that the spell associated with the bomb is single-target? Or do those conditions (is a unit, is/isn't cracked rock) apply to AoE spells as well?

  9. #9
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, actually... it triggers the script once for every target of the spell, each time with the spell targets properly altered.

  10. #10
    swils's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ohh, okay I get it.

    Well I hope I haven't said it too much yet, but thank you very much for all the help/explanations, and especially the example script!
    will rep as soon as I can, haha

Similar Threads

  1. Quotes from Steven Write
    By Amedis in forum Community Chat
    Replies: 2
    Last Post: 11-14-2022, 10:26 AM
  2. Please, Mage PvP Set for level 60 Looks Like BadRasta.
    By grisse2 in forum WoW ME Questions and Requests
    Replies: 8
    Last Post: 10-23-2007, 08:45 AM
  3. WTB Powerleveling - Need Quotes!!
    By Drovos in forum Members Only Gold And Powerleveling Buy Sell
    Replies: 7
    Last Post: 10-14-2007, 10:26 AM
  4. Funny GM quotes
    By shadowfox47 in forum World of Warcraft General
    Replies: 9
    Last Post: 08-13-2007, 07:24 PM
All times are GMT -5. The time now is 06:27 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search