Re use of existing assets(Spoilers!)

Started by tornado, March 04, 2017, 08:07:11 AM

Previous topic - Next topic

tornado

Warning, this post contains spoilers for stuff I'm doing later. you have been warned.


So for my (first) PF map I'm planning on re-using a few assets front he game, specifically the large cannons from the last two levels(Origin, and Duty).
I'm going to mod the PRPL a bit, but I cant seem to find the assets for them(I've tried ctrl-i on the levels, no success).
Any  suggestions?
and now for the more complex tech specs:
Im working with the original(mostly without commented) code and am just tweaking a few thing here and there(Not giving too much away).
Im also trying to make it so it only works once lathed.
I have a rough idea of how to do this(invisible core on top that tells it to turn on when the invisible core is destroyed).
Here's the code fore the cannon:


$ParticleDistance:10.0
$FireEnergy:1000


SetImageRotation(Self "barrel" <-barrelRotation)

#trace2(<-*GlobalEnergy <-energy)
if (<-energy lt (<-FireEnergy))
if (<-hasFired and (<-*GlobalEnergy gte(1)) or (<-*GlobalEnergy gt(1499)))
<-energy add(1) ->energy
<-*GlobalEnergy sub(1) ->*GlobalEnergy
if (<-*GlobalEnergy lt(0)) 0 ->*GlobalEnergy endif

if (not(<-*showPRConv) and (<-energy gt(800)))
true ->*showPRConv
ShowConversation("ParticleRod")
endif
endif
else
@Fire
0 ->energy
endif

@DrawEnergyBar


:RandomShip
# removed the Not from ship.shipIsEnemy. should now target
enemies rather than Frendlies(unless a blue ParticleShip
is counted the same as a red ParticleShip

CreateList ->potentials
GetAllShipsInRange(0 0 9999 true) ->ships
do(<-ships.listCount 0)
<-ships[I] ->ship
if ((<-ship.shipIsEnemy) and (GetShipCMBuiltAmt(<-ship) gt(0)))
AppendToList(<-potentials <-ship)
endif
loop
if (<-potentials.listCount gt (0))
RandInt(0 <-potentials.listCount) ->randomShip
GetShipPixelCoords(<-potentials[<-randomShip])
else
-1 -1
endif

:Fire
#trace("FIRE")
true ->hasFired
PlaySound("Weapons28")
MapWidth ->mapW
MapHeight ->mapH

@RandomShip ->y ->x
if (<-x lt (0))
#Random target
0.0 ->x
RandFloat mul (<-mapH mul(3)) sub(<-mapH) ->y # let it pick a value a full screen below or higher than than actual screen.
endif

CurrentPixelCoords ->cy ->cx

<-x sub(<-cx) ->deltaX
<-y sub(<-cy) ->deltaY
Sqrt(<-deltaX mul(<-deltaX) add (<-deltaY mul(<-deltaY))) ->distance
<-ParticleDistance div(<-distance) ->frac

atan2(<-deltaY <-deltaX) ->barrelRotation

#trace3(<-cx <-cy <-frac)
while
<-cx gt(0)
repeat
<-cx add(<-deltaX mul(<-frac)) ->cx
<-cy add(<-deltaY mul(<-frac)) ->cy
if (<-cx gte(0) and (<-cy gte(0)) and (<-cx lt(<-mapW)) and (<-cy lt(<-mapH)) )
#If we make a particle right on top of a command module, the ship explodes instantly.
#As fun as that can be, it might be too frustrating for the player.  We want ship damage, not instant destruction
Distance(<-cx <-cy <-x <-y) ->distanceFromCM

if (<-distanceFromCM lt (12))
#nothing
else if (<-distanceFromCM lt (70))
#If we are near the ship but not too close, make more particles
do(8 0)
@CreateParticle(<-cx add(@Jitter) <-cy add(@Jitter))
loop
else
@CreateParticle(<-cx <-cy)
endif endif


endif
endwhile


:DrawEnergyBar
#0.33333 scale equals 1 cell width
9.0 ->barHeight
<-energy asfloat div(<-FireEnergy) ->fraction
<-fraction mul(<-barHeight) div(3) ->scaleY
SetImageScale(Self "bar" 0.2 <-scaleY)
SetImagePosition(Self "bar" 21 -18 add(<-fraction mul (72) div(4)) -0.05)

:Jitter
RandFloat mul(2) sub(1)

:CreateParticle
->py ->px
CreateParticle(<-px <-py 0 0 3 true) ->particle
if (<-particle gte(0))
1200 ->particle.particleMaxAge
2 ->particle.particleMaxSpeed
endif


:Awake
if (GetUpdateCount eq0)
PI ->barrelRotation
SetImage(Self "barrel" "Custom1_128")
SetImagePositionZ(Self "barrel" -0.05)
SetImageScale(Self "barrel" 3.1 3.1)
SetImageRotation(Self "barrel" <-barrelRotation)

SetImage(Self "bar" "Custom0pp")
SetImageColor(Self "bar" 255 0 0 255)
@DrawEnergyBar
endif




I'm missing most of my added comments in here for some reason, not sure as to why :(.
any help would be appreciated.

Thanks.
Now CEO of Particular Endeavors. http://knucklecracker.com/forums/index.php?topic=23752.new#new
We apologize for all inconveniences that we caused.
Quotefirst, you have to imagine a very big box, fitting inside a very samll box.
then, you have to build one

GoodMorning

Adding the following before the SetImageRotation call will give you the capacity to (un)freeze the Bertha from another script/core:


once
-?Frozen not if
1 ->Frozen #Do nothing until told to
endif
endonce

<-Frozen if
return
endif


You can also use Get/SetUnitIsEnemy on the Core, or react to the unit health reaching 0.001. However, the easiest way to activate this form exactly once is to have another (latheable) Core over it running the following:


:destroyed
CurrentCoords 0 1 GetAllUnitsInRange ->Units
<-Units GetListCount 0 do
<-Units[I] "ParticleRod.prpl" "Frozen" 0 SetScriptVar #V guarded this one well.
loop


You will also need something to increase the GlobalEnergy global over time, as you are borrowing from Origin. But that's another part of the map.
A narrative is a lightly-marked path to another reality.

knucracker


tornado

Now CEO of Particular Endeavors. http://knucklecracker.com/forums/index.php?topic=23752.new#new
We apologize for all inconveniences that we caused.
Quotefirst, you have to imagine a very big box, fitting inside a very samll box.
then, you have to build one

Karsten75

Since a single post in the forum can easily be overlooked, I've also placed this on the wiki:

http://knucklecracker.com/wiki/doku.php?id=prpl:custom_images

Anyone else is invited to contribute images as well.

tornado

Given the fact that I have no clue what I'm doing is going to Re-write everything from scratch(copy and paste jobs. I need to learn to run from those).
Now CEO of Particular Endeavors. http://knucklecracker.com/forums/index.php?topic=23752.new#new
We apologize for all inconveniences that we caused.
Quotefirst, you have to imagine a very big box, fitting inside a very samll box.
then, you have to build one