Staredit Network > Forums > Modding Assistance > Topic: (help with) overcharge Dragoon
(help with) overcharge Dragoon
Nov 11 2018, 5:04 pm
By: Lagi  

Nov 11 2018, 5:04 pm Lagi Post #1



here Ravenwolf publish his overcharge plugin for Dragoon

Using 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?
Quote
//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.

Nov 11 2018, 6:04 pm KYSXD Post #2



Based on the line
c++
unit->sprite->teamColor = unit->playerId;
and the CSprite structure I think you are looking for "sprite->playerId"

Give it a try.




Nov 11 2018, 6:30 pm Lagi Post #3



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.

Nov 11 2018, 6:57 pm KYSXD Post #4



Quote from Lagi
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.




Nov 11 2018, 7:20 pm Lagi Post #5



it works

=====

now the code is not compiling because of smartcast function
Collapse Box


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.

Nov 11 2018, 9:36 pm KYSXD Post #6



Code
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.




Nov 13 2018, 5:55 pm Lagi Post #7



this work, and make unit black as cosmic abyss

Quote
unit->sprite->playerId = 160; //black color

this one not revert the color to the original one;
Quote
unit->sprite->playerId;

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
Quote
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.

Nov 13 2018, 8:12 pm KYSXD Post #8



Quote from Lagi
this work, and make unit black as cosmic abyss

Quote
unit->sprite->playerId = 160; //black color

this one not revert the color to the original one;
Quote
unit->sprite->playerId;

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;




Nov 13 2018, 9:04 pm Lagi Post #9



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 :lol: )


============

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.cpp

add this to game_hook.cpp at the end of file inside: namespace plugins {
Game_hook.cpp


+ add at the begining:
Quote
namespace plugins {
void runOvercharge(CUnit *unit);
}

+add in next frame:
Collapse Box


====
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.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
[2024-4-17. : 1:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
[2024-4-16. : 5:05 pm]
Vrael -- Its simple, just send all minerals to Vrael until you have 0 minerals then your account is gone
[2024-4-16. : 4:31 pm]
Zoan -- where's the option to delete my account
[2024-4-16. : 4:30 pm]
Zoan -- goodbye forever
Please log in to shout.


Members Online: Vanfhf05