C++ Script Won't Work, Please Help! menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C++ Script Won't Work, Please Help!

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
     
    class Orb_of_Translocation : public GameObjectAIScript
    {
    public:
    Orb_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Orb_of_Translocation(GO); }
     
    void OnActivate(Player * pPlayer)
    {
    	if(pPlayer->getRace() == RACE_HUMAN)
    	pPlayer->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312);
    }
    {
    	else if(pPlayer->getRace() == RACE_ORC)
    	pPlayer->SafeTeleport(1, 0, -618.518, -4251.67, 38.718);
    }	
    {
    	else if(pPlayer->getRace() == RACE_DWARF)
    	pPlayer->SafeTeleport(0, 0, -6240.32, 331.033, 382.758);
    }	
    {
    	else if(pPlayer->getRace() == RACE_NIGHTELF)
    	pPlayer->SafeTeleport(1, 0, 10311.3, 832.463, 1326.41);
    }	
    {
    	else if(pPlayer->getRace() == RACE_UNDEAD)
    	pPlayer->SafeTeleport(0, 0, 1676.35, 1677.45, 121.67);
    }	
    {
    	else if(pPlayer->getRace() == RACE_TAUREN)
    	pPlayer->SafeTeleport(10, 0, -2917.58, -257.98, 52.9968);
    }	
    {
    	else if(pPlayer->getRace() == RACE_GNOME)
    	pPlayer->SafeTeleport(0, 0, -6240.32, 331.033, 382.758);
    }	
    {
    	else if(pPlayer->getRace() == RACE_TROLL)
    	pPlayer->SafeTeleport(1, 0,-618.518, -4251.67, 38.718);
    }	
    {
    	else if(pPlayer->getRace() == RACE_BLOODELF)
    	pPlayer->SafeTeleport(530, 0, 10349.6, -6357.29, 33.4026);
    }	
    {
    	else if(pPlayer->getRace() == RACE_DRAENEI)
    	pPlayer->SafeTeleport(530, 0, -3961.64, -13931.2, 100.615);
    }	
    {
    	pPlayer->BroadcastMessage("Error! You are an incorrect race!");
    };
     
    void SetupOrb_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Orb_of_Translocation::Create);
    }
    I've already made 2 threads concerning my scripts already, so I'm no longer worried that this script is"incorrect". Rather, I could use help on how to compile this correctly. So far, what I've done is I've put this into my MiscScripts folder in my Moon++ directory, and then compiled it as I would if I had just gotten a new revision. All the other scripts work fine, but my script doesn't. Does anyone know what I'm doing wrong?

    C++ Script Won't Work, Please Help!
  2. #2
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to make a setup.h script and something more to compile it right

    Not c++ expert so don't listen to me

  3. #3
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    void OnActivate(Player * pPlayer)
    {
    if(pPlayer->getRace() == RACE_HUMAN)
    pPlayer->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312);
    }

    Anything between the end of this and the next void will not work. Why are you closing the void after one if?

  4. #4
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh......wow, alright, so at the beginning, starting with "if", and at the last statment ,the one with the "Incorrect Race" statment, I should just add another set of brackets (or whatever {} are called)?

  5. #5
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You got {

    } in the function as you done, everything in the function should be inside of these 2 clams.

    How you writes if and else if is some different from lua, atleast how I have learned.
    Code:
    if(pPlayer->getRace() == RACE_HUMAN){
    	pPlayer->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312);
    }

  6. #6
    wisticc's Avatar Member
    Reputation
    2
    Join Date
    Jun 2008
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    indeed looks good

  7. #7
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #include "StdAfx.h"
    #include "Setup.h"

    class Orb_of_Translocation : public GameObjectAIScript
    {
    public:
    Orb_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Orb_of_Translocation(GO); }

    void OnActivate(Player * Plr)
    {
    if(Plr->getRace() == RACE_HUMAN)
    Plr->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312);
    else
    {
    if(Plr->getRace() == RACE_ORC)
    Plr->SafeTeleport(1, 0, -618.518, -4251.67, 38.71;
    else
    {
    if(Plr->getRace() == RACE_DWARF)
    Plr->SafeTeleport(0, 0, -6240.32, 331.033, 382.75;
    else
    {
    if(Plr->getRace() == RACE_NIGHTELF)
    Plr->SafeTeleport(1, 0, 10311.3, 832.463, 1326.41);
    else
    {
    if(Plr->getRace() == RACE_UNDEAD)
    Plr->SafeTeleport(0, 0, 1676.35, 1677.45, 121.67);
    else
    {
    if(Plr->getRace() == RACE_TAUREN)
    Plr->SafeTeleport(10, 0, -2917.58, -257.98, 52.996;
    else
    {
    if(Plr->getRace() == RACE_GNOME)
    Plr->SafeTeleport(0, 0, -6240.32, 331.033, 382.75;
    else
    {
    if(Plr->getRace() == RACE_TROLL)
    Plr->SafeTeleport(1, 0,-618.518, -4251.67, 38.71;
    else
    {
    if(Plr->getRace() == RACE_BLOODELF)
    Plr->SafeTeleport(530, 0, 10349.6, -6357.29, 33.4026);
    else
    {
    if(Plr->getRace() == RACE_DRAENEI)
    Plr->SafeTeleport(530, 0, -3961.64, -13931.2, 100.615);
    else
    {
    Plr->BroadcastMessage("Error! You are an incorrect race!");
    }}}}}}}}}}}
    };

    void SetupOrb_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Orb_of_Translocation::Create);
    }
    This is a revised script DoubleHex wrote me, and I figured out half my problem (I wasn't adding into my current projects, I is retaurd). When I do compile it though, I'm getting the errors I should've gotten, which is that:

    1>..srcMiscScriptsOoTstart.cpp(49) : error C2661: 'Player::SafeTeleport' : no overloaded function takes 5 arguments
    I don't know what that's telling me to do, so can anyone help out?

  8. #8
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SafeTeleport takes a locationvector, not seperate values. Use EventTeleport instead.

    And that code is very messy.

  9. #9
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #include "StdAfx.h"
    #include "Setup.h"

    class Orb_of_Translocation : public GameObjectAIScript
    {
    public:
    Orb_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Orb_of_Translocation(GO); }

    void OnActivate(Player * Plr)
    {
    if(Plr->getRace() == RACE_HUMAN)
    Plr->EventTeleport(0, 0, -8949.95, -132.493, 83.5312);

    else if(Plr->getRace() == RACE_ORC)
    Plr->EventTeleport(1, 0, -618.518, -4251.67, 38.71;

    else if(Plr->getRace() == RACE_DWARF)
    Plr->EventTeleport(0, 0, -6240.32, 331.033, 382.75;

    else if(Plr->getRace() == RACE_NIGHTELF)
    Plr->EventTeleport(1, 0, 10311.3, 832.463, 1326.41);

    else if(Plr->getRace() == RACE_UNDEAD)
    Plr->EventTeleport(0, 0, 1676.35, 1677.45, 121.67);

    else if(Plr->getRace() == RACE_TAUREN)
    Plr->EventTeleport(10, 0, -2917.58, -257.98, 52.996;

    else if(Plr->getRace() == RACE_GNOME)
    Plr->EventTeleport(0, 0, -6240.32, 331.033, 382.75;

    else if(Plr->getRace() == RACE_TROLL)
    Plr->EventTeleport(1, 0,-618.518, -4251.67, 38.71;

    else if(Plr->getRace() == RACE_BLOODELF)
    Plr->EventTeleport(530, 0, 10349.6, -6357.29, 33.4026);

    else if(Plr->getRace() == RACE_DRAENEI)
    Plr->EventTeleport(530, 0, -3961.64, -13931.2, 100.615);

    else
    Plr->BroadcastMessage("Error! You are an incorrect race!");

    };

    void SetupOrb_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Orb_of_Translocation::Create);
    }
    Life Puzzler WoW - Website | Forums

  10. #10
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, so in future reference Gastric/Spidey, the teleport needs to be event, not safe?

    Also, Gastric, I input and overwrote my code and used yours, and I got this error.

    1>..srcMiscScriptsOoTstart.cpp(52) : fatal error C1075: end of file found before the left brace '{' at '..srcMiscScriptsOoTstart.cpp(5)' was matched

  11. #11
    Zilver's Avatar Member
    Reputation
    5
    Join Date
    May 2008
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like a missing '}' in the end, but since i got no understanding of this i dunno.
    Remember to +Rep people who help you!

  12. #12
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I thought so too, and it is. Five { and four }, but every place I could think of adding the last }, I'd get more error messages, so I decided to let Gastric/Spidey use their C++ knowledge to discover where it should go. I am, however, trying to find out.

  13. #13
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea you forgot a brace at line 44, notepad++ rules!
    Last edited by doublehex; 06-02-2008 at 08:08 PM.


  14. #14
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1>..srcMiscScriptsOoTstart.cpp(15) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(1 : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(21) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(24) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(27) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(30) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(33) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(36) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(39) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(42) : error C2660: 'Player::EventTeleport' : function does not take 5 arguments
    1>..srcMiscScriptsOoTstart.cpp(52) : error C2059: syntax error : '}'
    1>..srcMiscScriptsOoTstart.cpp(52) : error C2143: syntax error : missing ';' before '}'
    1>..srcMiscScriptsOoTstart.cpp(52) : error C2059: syntax error : '}'
    That's what I get when I add in the closing bracket that DoubleHex told me to add.

  15. #15
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol look you open 2 brackets but only close 1, you need to close the Void OnActivate
    try this:
    #include "StdAfx.h"
    #include "Setup.h"

    class Orb_of_Translocation : public GameObjectAIScript
    {
    public:
    Orb_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Orb_of_Translocation(GO); }

    void OnActivate(Player * Plr)
    {
    if(Plr->getRace() == RACE_HUMAN)
    Plr->EventTeleport(0, 0, -8949.95, -132.493, 83.5312);

    else if(Plr->getRace() == RACE_ORC)
    Plr->EventTeleport(1, 0, -618.518, -4251.67, 38.71;

    else if(Plr->getRace() == RACE_DWARF)
    Plr->EventTeleport(0, 0, -6240.32, 331.033, 382.75;

    else if(Plr->getRace() == RACE_NIGHTELF)
    Plr->EventTeleport(1, 0, 10311.3, 832.463, 1326.41);

    else if(Plr->getRace() == RACE_UNDEAD)
    Plr->EventTeleport(0, 0, 1676.35, 1677.45, 121.67);

    else if(Plr->getRace() == RACE_TAUREN)
    Plr->EventTeleport(10, 0, -2917.58, -257.98, 52.996;

    else if(Plr->getRace() == RACE_GNOME)
    Plr->EventTeleport(0, 0, -6240.32, 331.033, 382.75;

    else if(Plr->getRace() == RACE_TROLL)
    Plr->EventTeleport(1, 0,-618.518, -4251.67, 38.71;

    else if(Plr->getRace() == RACE_BLOODELF)
    Plr->EventTeleport(530, 0, 10349.6, -6357.29, 33.4026);

    else if(Plr->getRace() == RACE_DRAENEI)
    Plr->EventTeleport(530, 0, -3961.64, -13931.2, 100.615);

    else
    Plr->BroadcastMessage("Error! You are an incorrect race!");

    }
    };

    void SetupOrb_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Orb_of_Translocation::Create);
    }


Page 1 of 2 12 LastLast

Similar Threads

  1. [Lua Script] Lua scripts won't work!
    By Leksikon in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 05-17-2011, 05:08 PM
  2. Character to Creature edits not working. Please help.
    By Aradroth in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 06-28-2008, 04:00 PM
  3. Ranged Weapons Not Working - Please help
    By r3anims in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 06-15-2008, 12:42 PM
  4. Need help MODEL EDITS WONT WORK Please help
    By thaukas in forum WoW ME Questions and Requests
    Replies: 9
    Last Post: 04-14-2008, 12:19 PM
  5. My Photoshop won't behave - please help
    By Survar in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-02-2007, 12:21 PM
All times are GMT -5. The time now is 06:47 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search