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.
[08:18 am]
KrayZee -- If Resident Evil 4 is getting a remake, they better make the plot believable. Like actually send an entire team to rescue the President's daughter but the team was ambushed and all equipment were lost. Leon is the only survivor and only kept a handgun. Later he would hitchhike and get picked up. He then asked to be dropped off the nearest town.
[04:01 am]
RIVE -- The significance is lessened by the probability of future RE titles ignoring either conclusion in favor of a rewrite anyway.
[03:59 am]
RIVE -- Mia's on the Chopper vs Mia's not on the Chopper.
[07:33 pm]
KrayZee -- RIVE
RIVE shouted: Also, what was the point of choosing between Mia or Zoe when there's no pay-off?
There is payoff since there are different endings.
[04:10 pm]
RIVE -- CV is stupid hard. (Those red hunters..) If that was remade, Capcom would water it down too much.
[04:08 pm]
RIVE -- Also, what was the point of choosing between Mia or Zoe when there's no pay-off?
[04:08 pm]
RIVE -- RE5 felt like a chore. 7's alright except the Eveline fight is a blander rehashed of Carla from 6 which is sad bc 6 was terrible.
[04:00 pm]
O)FaRTy1billion[MM] -- Zycorax
Zycorax shouted: Their names makes absolutely no sense.
1, 360, 1, 10. what's not to follow?
[02:22 pm]
Dem0n -- RE7 was actually fun AF tho. Pretty spooky too.
[2019-12-13. : 12:48 pm]
Zycorax -- Their names makes absolutely no sense.
Please log in to shout.


Members Online: Roy, Doodan, sami241947, Boliekes9, camronohayes