[System] Advanced Spaceship Technology

elmstfreddie

The Finglonger
Reaction score
203
Well, I'm not done yet, but I've started. I just wanted to make the thread to tell everyone what WILL be done:
This is a system that will use Str, Agi, and Int for triggered uses. Str will be used for shields, Agi will be used for Deflectors, and I'm still deciding what to do with Int (maybe laser power?).
Every time a hero is attacked, it will do the following:
Depending on your Agi (your Deflector's Power), you have a % chance to deflect the attack, taking no hull or shield damage.
If your deflectors fail, the attack will do damage to your shields. Shields are like a secondary HP. The damage dealt will be subtracted from your shields (str). If you have less shield power than the damage dealt, your shield power will be taken to 0, and your hull will take some damaging, depending on how much shield power there was. (for example someone does 10 damage, you have 5 shield power, your hull will take 5 damage).
Oh yeah, if your shield fails or your hull takes damage your screen will shake :p

For attacking:
I am planning on making lasers units that go forward forever (they are lasers, give me a good reason for them to stop :rolleyes:), until they hit a ship. The damage dealt will depend on the attacker's Int, and the defender's deflector chance, shields, etc.

Downfall:
Because I use Str, Agi, and Int for this system, you won't be able to use it for the normal stuff.

Working on:
Attacking

Completed:
Defence mechanisms (hull, shield, deflectors).

Defence Mechanism
Str = Shield HP
Agi = Deflector Strength
Just paste the code into your map to test, I won't release a test map until I have finished all coding so that I can add custom models to make it look nice.
JASS:
//-----------------Defence Mechanisms-----------------//

function Add_Every_Unit_Group takes nothing returns nothing
    call TriggerRegisterUnitEvent(gg_trg_Damage_Reduction,GetEnumUnit(),EVENT_UNIT_DAMAGED)
endfunction

function Add_Every_Unit takes nothing returns nothing
    local group Group = GetUnitsInRectAll(GetPlayableMapRect()) 
    call ForGroup(Group,function Add_Every_Unit_Group)
    call DestroyGroup(Group)
    set Group = null
endfunction 

function TextTagMessage takes texttag tt,real lifespan,integer colourred,integer colourgreen,integer colourblue,integer transparency,real fadepoint,real x,real y,real heightoffset,real xspeed,real yspeed,string message,real size,boolean show returns nothing
    call SetTextTagPermanent(tt,false)
    call SetTextTagLifespan(tt,lifespan)
    call SetTextTagColor(tt,colourred,colourgreen,colourblue,transparency)
    call SetTextTagFadepoint(tt,fadepoint)
    call SetTextTagPos(tt,x,y,heightoffset)
    call SetTextTagVelocity(tt,xspeed,yspeed)
    call SetTextTagText(tt,message,size)
    call SetTextTagVisibility(tt,show)
endfunction

constant function DeflectorChance takes integer Deflectors returns integer
    return (Deflectors + 0) * 1
endfunction

function Trig_Damage_Reduction_Conditions takes nothing returns boolean
    return (IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true) and (not(UnitHasBuffBJ(GetTriggerUnit(),'Immo')))
endfunction

function Trig_Damage_Reduction_Actions takes nothing returns nothing
    local unit Def = GetTriggerUnit()
    local integer Shield = GetHeroStr(Def,false)
    local integer Deflectors = GetHeroAgi(Def,true)
    local real DamageDealt = GetEventDamage()
    local texttag Message = CreateTextTag()
    local integer FlashRedL = 1
    if (GetRandomInt(1,100) < DeflectorChance(Deflectors)) then
        call SetUnitState(Def,UNIT_STATE_LIFE,((GetUnitState(Def,UNIT_STATE_LIFE)) + DamageDealt))
        call TextTagMessage(Message,1.00,0,255,0,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Deflected",0.0240,true)
    else
        if (Shield >= DamageDealt) then
        call SetUnitState(Def,UNIT_STATE_LIFE,((GetUnitState(Def,UNIT_STATE_LIFE)) + DamageDealt))
        call SetHeroStr(Def,(Shield - (R2I(DamageDealt))),false)
        call TextTagMessage(Message,1.00,0,0,255,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Shield Damage Taken",0.0240,true)
        else
            if (Shield > 0) then
                call SetUnitState(Def,UNIT_STATE_LIFE,((GetUnitState(Def,UNIT_STATE_LIFE)) + Shield))
                call SetHeroStr(Def,0,false)
                call TextTagMessage(Message,1.00,0,0,255,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Shield Failure",0.0240,true)
            else
                call TextTagMessage(Message,1.00,255,0,0,255,0.75,GetUnitX(Def),GetUnitY(Def),0.00,0.00,0.030,"Hull Damage Taken",0.0240,true)
                loop
                    exitwhen FlashRedL > 17
                    call SetUnitVertexColor(Def,255,(255 - (15 * FlashRedL)),(255 - (15 * FlashRedL)),255)
                    set FlashRedL = (FlashRedL + 1)
                endloop
                loop
                    exitwhen FlashRedL < 1
                    call SetUnitVertexColor(Def,255,(255 - (15 * FlashRedL)),(255 - (15 * FlashRedL)),255)
                    set FlashRedL = (FlashRedL - 1)
                endloop
            endif
        endif            
    endif
    set Def = null
    set Message = null
endfunction

function InitTrig_Damage_Reduction takes nothing returns nothing
    set gg_trg_Damage_Reduction = CreateTrigger()
    call TriggerAddCondition(gg_trg_Damage_Reduction,Condition(function Trig_Damage_Reduction_Conditions))
    call TriggerAddAction(gg_trg_Damage_Reduction,function Trig_Damage_Reduction_Actions)
    call Add_Every_Unit()
endfunction 
    
//-----------------Add New Units-----------------//

function Trig_Add_New_Unit_Actions takes nothing returns nothing
    call TriggerRegisterUnitEvent(gg_trg_Damage_Reduction,GetTriggerUnit(),EVENT_UNIT_DAMAGED)    
endfunction

function InitTrig_Add_New_Unit_Actions takes nothing returns nothing
    set gg_trg_Add_New_Unit = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_Add_New_Unit,GetPlayableMapRect())
    call TriggerAddAction(gg_trg_Add_New_Unit,function Trig_Add_New_Unit_Actions)
endfunction
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
int should be laser power (distance,damage)
This system seems original and will it be in GUI or Jass?
Also how will you be removing str and agi tomes?
 

elmstfreddie

The Finglonger
Reaction score
203
Also how will you be removing str and agi tomes?
?? I don't get what you are asking. But Str and Agi will have no real affect, Str and Agi will all be for triggered affects, and their normal affects will be removed. So tomes would change the triggers. Like if you str tomed, you would get more shield power. If you agi tomed, you would get a higher deflector chance. If you int tomed, you will get better attacking capabilities.
int should be laser power (distance,damage)
I did in the end decide it will be attack damage, but I like the idea that it affects distance also.
This system seems original and will it be in GUI or Jass?
You'll hate me - it's in JASS.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Nice idea, I would be intrested in checking the triggers, although I have in mind a solid idea on how I would have done it.

The trickiest part would be the laser, making it work like a regular bullet will need careful programming, however it's doable indeed.

Good luck!
 

elmstfreddie

The Finglonger
Reaction score
203
I was going to make the laser replace normal attack, so you can right click like normal... But I came across a problem.
I couldn't detect if smart was attacking, and not anything else.
But I just got an idea. Maybe if the order was smart, and the target was an enemy, he would attack?
Yeah, that's what I'll do.

Good luck!
Thanks >_<

Nice idea, I would be intrested in checking the triggers, although I have in mind a solid idea on how I would have done it.
When I'm finished the triggers will be posted. I just gotta do the attack mechanism.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
I think a regular shooting chould be more original rather then a regular attacking. However if you want to make it regular attacking you could check unit current order using integers, I'm sure I saw a thread about it once in wc3c.
 

elmstfreddie

The Finglonger
Reaction score
203
Well yes, that's all OrderId is, is an integer.
But it's impossible to tell what smart is, so I'm just going to check if the targeted person is an enemy. I'm pretty sure if you right click an enemy it's always going to be attack ;).
But regular attacking will be triggered, I just wanted to keep the old school right click so it makes more sense, instead of having to click an ability then click a target blah blah blah.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
" Well yes, that's all OrderId is, is an integer. "

I believe smart has also different integer values, but I'm not sure of that completely, the members in wc3c love to disscuss those things, if you are intrested go check there.

" so I'm just going to check if the targeted person is an enemy "

Yes, that works perfectly, I used this way in few triggers of mine.
 

elmstfreddie

The Finglonger
Reaction score
203
Ok, releasing my "Defence Mechanism" code.
I am working on the Attack Mechanism at the moment.
Defence Mechanism is in perfect working order.
 

elmstfreddie

The Finglonger
Reaction score
203
Oh... If I posted the code that has in the condition that the unit doesn't have the buff 'Immo', that will have to do with my laser shooting system, sorry :eek:
Anyhow, I am working on the laser system still.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
btw: I think you should do this instead:
JASS:


It is more quicker, just get rid of the locals and put it back the way it did when it leaked then add the bj on top of it, unless you want it to be anti-bj. :D
 

elmstfreddie

The Finglonger
Reaction score
203
Uhh... No thanks, I prefer destroying. I'm against using that for no particular reason (I've NEVER used that. I think I did once, before I knew about setting the group to a variable then destroying it).
It also gives more flexability.
But I looked at the BJ, and it just destroys the group at the end. At the end it checks if want destroy group = true, if it is then call destroygroup etc.
Anyhow...
 

elmstfreddie

The Finglonger
Reaction score
203
OK, I just gotta make a laser unit, an ability, and a buff.
Then I will make the code perfect, put it into a map, and test it.

Unless I come across some hideous problem, this will be out some time tomorrow afternoon.
Knowing me something bad will happen, but otherwise it looks pretty good.
I hope SOMEONE is looking forward to this ^^
 

elmstfreddie

The Finglonger
Reaction score
203
Which makes it easy to import into your map.
After I finish, you could PM me how you want to edit it and I could try to mod it for you.

Edit > Remember how I said I'd post it this aft if nothing went hideously wrong?
Well, something went hideously wrong.
It's giving me errors on EVERY, SINGLE, LINE.
Yet, if I disable my attacking triggers it doesn't give me any...
So, I gotta find wtf I did wrong in my attacking triggers.
But I have school soon... So this aft I will fix it.
 

johnnyfire

New Member
Reaction score
8
naaa.... thats cool i can only understand gui so i would have problems with it anyway...
hmmm can it be done in gui, maybe, i wonder?
 

elmstfreddie

The Finglonger
Reaction score
203
Well, yes.
But it'd be more difficult =/
But yes, I could.
Once I get around to fixing the coding (Not now I don't feel like it haha), I might start to make a GUI version of it for GUIers out there... Maybe, maybe not. We'll see.
 

johnnyfire

New Member
Reaction score
8
Hey, don't worry about it... i'm don't have any use for it (yet)... and i know how freakin hard it is to work in gui, especially when you've already done the work to find it crashes wc3 (happened 4 freakin times)... (have you tried my buggy squads map, it doesn't crash anymore?)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top