here Ravenwolf publish his overcharge plugin for DragoonUsing KYSXD plugin I'm trying to adapt RavenWolf code to work.
I encounter there "
teamColor" - definition/declaration (not sure what is the proper name)
thing is it seems to work under different name in newish Framework.
how
teamColor suppose to be rewrite to be understand by code?
this code is compiling without error. Commented section is
teamcolor, with what it supposed to be changed?
//Ravenwolf - overcharge
void runOvercharge(CUnit *unit){
if (unit->id == UnitId::ProtossDragoon && unit->hitPoints > 0){//if unit its a dragoon and its alive
if (unit->mainOrderId = OrderId::CarrierStop){ //*1 (See comments after the code)
unit->stimTimer=60; //*2 (See comments after the code)
unit->mainOrderId = OrderId::HoldPosition2;
unit->currentButtonSet = UnitId::zealot;//*3 (See comments after the code)
unit->status= unit->status | 0x1000;//canot receive orders
}
if (unit->stimTimer>0){
/*if (unit->stimTimer>31){ //swap between black and original color during the overload duration
if (unit->stimTimer % 2 == 0)// if stimTimer is an even number turns to original color
unit->sprite->teamColor=unit->playerId;
else // if stimTimer is an odd number turns to blck color
unit->sprite->teamColor=160;
}else{*/
if (unit->stimTimer==31)
unit->mainOrderId = OrderId::Stop;//set to stop so it wont attack any more until enabled
if (unit->stimTimer==30){
unit->status= unit->status | 0x8;//disabled
// unit->sprite->teamColor=160; //black color
}
if (unit->stimTimer==1){
unit->status= unit->status & ~0x8;//enabled
unit->status= unit->status & ~0x1000;//can receive orders again
//unit->sprite->teamColor=unit->playerId; //original color
unit->rankIncrease=200;//*4 (See comments after the code)
}
}
}
if (unit->rankIncrease>0){//cooldown
unit->rankIncrease--;
if (unit->rankIncrease==0)
unit->currentButtonSet = UnitId::dragoon;//backs to the original buttonSet
}
} //Ravenwolf - overcharge end
None.
Based on the line
unit->sprite->teamColor = unit->playerId;
and the
CSprite structure I think you are looking for "sprite->playerId"
Give it a try.
thanks
unit->sprite->playerId
expression like is build-able (not sure how it look in game)
what about the other color (black)?
unit->sprite->160
this is error
syntax for this stuff is unknown to me.
====================
using Ravenwolf code (without colors), make the Dragoons not move at all in game (or respond to commands or rally points)
I create new button set, asign Dragoon into it, include stopCarrier itp.
It seems to me I'm lacking some basic knowledge, with creating new button set (modifying existing one works well).
None.
thanks
unit->sprite->playerId
expression like is build-able (not sure how it look in game)
what about the other color (black)?
unit->sprite->160
this is error
syntax for this stuff is unknown to me.
====================
using Ravenwolf code (without colors), make the Dragoons not move at all in game (or respond to commands or rally points)
I create new button set, asign Dragoon into it, include stopCarrier itp.
It seems to me I'm lacking some basic knowledge, with creating new button set (modifying existing one works well).
I think you meant unit->sprite->playerId = 160.
What you are using is a struct:
structure->member.
In the code, for example, unit is a CUnit structure, sprite (a CSprite structure) is a member of unit and playerId is a member of sprite.
it works
=====
now the code is not compiling because of smartcast function
Collapse Box
1>------ Build started: Project: GPTP, Configuration: Debug Win32 ------
1> game_hooks.cpp
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(554): error C2065: 'firstCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(556): error C2065: 'firstCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(557): error C2065: 'lastCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(559): error C2065: 'lastCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(559): error C2227: left of '->getIndex' must point to class/struct/union/generic type
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(561): error C2065: 'custom_unit_array' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(566): error C2065: 'lastCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(566): error C2227: left of '->getIndex' must point to class/struct/union/generic type
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(567): error C2065: 'custom_unit_array' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(568): error C2065: 'lastCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(570): error C2065: 'lastCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(570): error C2227: left of '->getIndex' must point to class/struct/union/generic type
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(571): error C2065: 'custom_unit_array' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(601): error C2065: 'lastOrderArray' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(613): error C2065: 'lastOrderArray' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(722): error C2065: 'firstCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(722): error C2065: 'custom_unit_array' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(790): error C2065: 'firstCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(790): error C2065: 'custom_unit_array' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(808): error C2065: 'firstCaster' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(840): error C2065: 'ORDER_TYPE_COUNT' : undeclared identifier
1>c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(851): fatal error C1075: end of file found before the left brace '{' at 'c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(279)' was matched
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
but the VS have no problem to compile the SMARTCAST code when i revert back all Overcharge changes
i'm getting insane!
===========ok
fu&%$#@ Curly brackets
Post has been edited 1 time(s), last time on Nov 11 2018, 8:29 pm by Lagi.
None.
c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(851): fatal error C1075: end of file found before the left brace '{' at 'c:\users\m\downloads\starcraft modding\framework-work\framework plugin source\hooks\game_hooks.cpp(279)' was matched
I think you are missing braces.
this work, and make unit black as cosmic abyss
unit->sprite->playerId = 160; //black color
this one not revert the color to the original one;
any one have any idea how to revert color back to player original?
====================
edit:
update:
the value have to be the player color (low value: 1 to 8..), otherwise its black.
from player.cpp
graphics::ColorId PLAYER::getColor(u8 playerId) {
if(playerId < PLAYER_COUNT)
return playersColors[playerId];
else
return graphics::BLACK; // return 0/Black if error
Post has been edited 2 time(s), last time on Nov 13 2018, 6:23 pm by Lagi.
None.
this work, and make unit black as cosmic abyss
unit->sprite->playerId = 160; //black color
this one not revert the color to the original one;
any one have any idea how to revert color back to player original?
Set the value to... something.
unit->sprite->playerId is a value, that's it.
Try setting it to anything, like the player's Id:
unit->sprite->playerId = unit->playerId;
i do this
unit->sprite->playerId = 0
zer0 give the color of first player (human)
for the other vaule i put too high number to receive error => black
====
but i will try your also, thanks
====edit:
i use your version (in case thousand of people will use my mod in multi in near future
)
============
SOLVED (thing is to adjust the timings (stim timer & rankincrease), but its just a pure pleasure
)
to build .gtp to add in Firegraft (plugin tab), check file:
https://github.com/KYSXD/GPTP-For-VS2008/blob/0.1/GPTP/hooks/game_hooks.cppadd this to
game_hook.cpp at the end of file inside:
namespace plugins {Game_hook.cpp
//Ravenwolf - overcharge
void runOvercharge(CUnit *unit){
if (unit->id == UnitId::ProtossDragoon && unit->hitPoints > 0) //if unit its a dragoon and its alive
{
if (unit->mainOrderId == OrderId::CarrierStop){ //*1 (See comments after the code)
unit->stimTimer=20; //*2 (See comments after the code)
unit->mainOrderId = OrderId::HoldPosition2;
unit->currentButtonSet = UnitId::zealot;//*3 (See comments after the code)
unit->status= unit->status | 0x1000;//canot receive orders
}
if (unit->stimTimer>0){
if (unit->stimTimer>11){ //swap between black and original color during the overload duration
if ((unit->stimTimer) % 2 == 0)// if stimTimer is an even number turns to original color
unit->sprite->playerId =160;
else // if stimTimer is an odd number turns to blck color
unit->sprite->playerId = unit->playerId; }
else { //stim time <31
if (unit->stimTimer==11)
unit->mainOrderId = OrderId::Stop;//set to stop so it wont attack any more until enabled
if (unit->stimTimer==10){
unit->status= unit->status | 0x8;//disabled
unit->sprite->playerId =160; //black color
}
if (unit->stimTimer==1){
unit->status= unit->status & ~0x8;//enabled
unit->status= unit->status & ~0x1000;//can receive orders again
unit->sprite->playerId = unit->playerId; //original color
unit->rankIncrease=4;//*4 (See comments after the code)
}
} //end of stim time <31
} //end of stim timer >0
if (unit->rankIncrease>0){//cooldown
unit->rankIncrease--;
if (unit->rankIncrease==0)
unit->currentButtonSet = UnitId::dragoon;//backs to the original buttonSet*/
}//cooldown
} // end of if dragoon
} //Ravenwolf - overcharge end
+ add at the begining:
namespace plugins {
void runOvercharge(CUnit *unit);
}
+add in next frame:
Collapse Box
namespace hooks {
/// This hook is called every frame; most of your plugin's logic goes here.
bool nextFrame() {
if(!scbw::isGamePaused()) { //If the game is not paused
scbw::setInGameLoopState(true); //Needed for scbw::random() to work
graphics::resetAllGraphics();
hooks::updatePsiFieldProviders();
plugins::runOvercharge(unit);
} //Loop through all visible units in the game - end
====
when done hit F7 to build solution,
if errors in Output, gl
===
in Firegraft need to create new order.
I do it like that (it also require to be researched, but for first test change condition from
spell... into
Always)
Post has been edited 4 time(s), last time on Nov 13 2018, 9:37 pm by Lagi.
None.