• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Some (probably simple) errors

walukasz

New Member
Joined
Aug 15, 2009
Messages
36
Reaction score
1
Hi

I found script for shadow clone jutsu.
It should copy outfit, nick, hp etc.

I added following code to game.cpp:

CODE:

Code:
bool Game::playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type,
const std::string& receiver, const std::string& text)
{	
	Player* player = getPlayerByID(playerId);
	if(!player || player->isRemoved())
	return false;

std::string shadowclone = "clone"; // create a monster.xml setup all raw datas and give him same file name and ingame name as here, it will be changed when its going to be summoned.
uint16_t soulCost  = 0; //if you want the spell to cost soul, change this
uint16_t spellmana = 300; //add here how much mana u want the spell to cost.
if(text == "kage bunshin no jutsu")
{
  if(player->getMana() >= spellmana)
  {
		player->addManaSpent(spellmana);
		if(!player->hasFlag(PlayerFlag_HasInfiniteMana)){
			player->changeMana(-(int32_t)spellmana);
		}
	}

	if(!player->hasFlag(PlayerFlag_HasInfiniteSoul)){
		if(soulCost > 0){
			player->changeSoul(-(int32_t)soulCost);
		}
	}


	Monster* monster = Monster::createMonster(shadowclone);
        if(!monster)
        return false;
        MonsterType* mon = NULL; 
        mon = g_monsters.getMonsterType(shadowclone);
        if(!mon)
        return false;

        mon->health = player->getHealth();
        mon->maxhealth = player->getMaxHealth();
        mon->name = player->getName();
        mon->base_speed = player->getStepSpeed();
        mon->outfit.lookType = player->defaultOutfit.lookType;
        mon->outfit.lookHead = player->defaultOutfit.lookHead;
        mon->outfit.lookBody = player->defaultOutfit.lookBody;
        mon->outfit.lookLegs = player->defaultOutfit.lookLegs;
        mon->outfit.lookFeet = player->defaultOutfit.lookFeet;


	if(g_game.placeCreature(monster, creature->getPosition()))
g_game.addMagicEffect(creature->getPosition(), NM_ME_MAGIC_BLOOD); 
       else
       return false;

       player->addSummon(monster);


}

and during compilation(?) I got following errors:

ERRORS

Code:
4500 C:\Users\Renee\Downloads\SOURCE\game.cpp expected initializer before "Player"
4501 C:\Users\Renee\Downloads\SOURCE\game.cpp expected unqualified-id before "if"
4507 C:\Users\Renee\Downloads\SOURCE\game.cpp expected unqualified-id before "if

here are these lines

Code:
4500          Player* player = getPlayerByID(playerId);
4501          if(!player || player->isRemoved())
4507          if(text == "kage bunshin no jutsu")


Anyone can solve the problem?

I would be thankful ;)


[REP++] ;D
 
Back
Top