Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Basic Revive System #45

Open
SuggestName opened this issue Nov 3, 2018 · 1 comment
Open

Basic Revive System #45

SuggestName opened this issue Nov 3, 2018 · 1 comment

Comments

@SuggestName
Copy link

Então eu fiz uma função simples para usar como revive das pokeball

luascript.h

static int luaItemRevivePokemon(lua_State* L);

luascript.cpp

int LuaScriptInterface::luaItemRevivePokemon(lua_State* L) { // item:revivePokemon() Item* item = getUserdata<Item>(L, 1); if (item) { Pokemon* pokemon = g_game.getPokemonByGUID(item->getPokemonId()); if (pokemon) { pokemon->revivePokemon(); g_game.transformItem(item, pokemon->getChargedIcon()); } } return 1; }

e

registerMethod("Item", "revivePokemon", LuaScriptInterface::luaItemRevivePokemon);

No Pokemon.h

void revivePokemon();

no pokemon.cpp

void Pokemon::revivePokemon() { setHealth(getMaxHealth()); eventWalk = 0; }

no action

function onUse(player, item, fromPosition, target, toPosition, isHotkey) if (target:isItem()) then target:revivePokemon() end end

@tuxico
Copy link

tuxico commented May 5, 2019

Otima função, você participa do discord?
A gente poderia desenvolver em conjunto boa parte desse projeto.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants